On Fri, May 22, 2020 at 4:17 AM Wei Hu <w...@freebsd.org> wrote: > > Author: whu > Date: Fri May 22 09:17:07 2020 > New Revision: 361360 > URL: https://svnweb.freebsd.org/changeset/base/361360 > > Log: > Socket AF_HYPERV should return failure when it is not running on HyperV > > [... snip ...] > @@ -354,6 +354,9 @@ hvs_trans_attach(struct socket *so, int proto, struct > { > struct hvs_pcb *pcb = so2hvspcb(so); > > + if (vm_guest != VM_GUEST_HV) > + return (ESOCKTNOSUPPORT); > + > HVSOCK_DBG(HVSOCK_DBG_VERBOSE, > "%s: HyperV Socket hvs_trans_attach called\n", __func__); >
This one may be OK, but none of these other methods should be able to be invoked if the attach failed. See this comment at around ^/sys/kern/uipc_socket.c#50: 50 * pru_detach() disassociates protocol layer state from an attached socket, 51 * and will be called exactly once for sockets in which pru_attach() has 52 * been successfully called. If pru_attach() returned an error, 53 * pru_detach() will not be called. Socket layer private. That said, I wonder if VNET_DOMAIN_SET provides the correct semantics here at all. You can't fail domain_init, but I don't think there's any value in this domain actually getting registered on non-HyperV guests, a fact which presumably won't change at runtime. I have some concerns about how hvsock works out with vnets, but I'll drop those on the initial commit thread. Thanks, Kyle Evans _______________________________________________ svn-src-head@freebsd.org mailing list https://lists.freebsd.org/mailman/listinfo/svn-src-head To unsubscribe, send any mail to "svn-src-head-unsubscr...@freebsd.org"