From owner-svn-src-all@freebsd.org Fri May 22 15:51:36 2020 Return-Path: Delivered-To: svn-src-all@mailman.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.nyi.freebsd.org (Postfix) with ESMTP id CBFFB2CC773; Fri, 22 May 2020 15:51:36 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from smtp.freebsd.org (smtp.freebsd.org [IPv6:2610:1c1:1:606c::24b:4]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "smtp.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 49T9vr548nz4Tkv; Fri, 22 May 2020 15:51:36 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: from mail-qk1-f182.google.com (mail-qk1-f182.google.com [209.85.222.182]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (Client CN "smtp.gmail.com", Issuer "GTS CA 1O1" (verified OK)) (Authenticated sender: kevans) by smtp.freebsd.org (Postfix) with ESMTPSA id A2BFA24C67; Fri, 22 May 2020 15:51:36 +0000 (UTC) (envelope-from kevans@freebsd.org) Received: by mail-qk1-f182.google.com with SMTP id i5so11077655qkl.12; Fri, 22 May 2020 08:51:36 -0700 (PDT) X-Gm-Message-State: AOAM532Q8ptJlIEQMFHUDX8YEo9CETMbY2NEbMxj31hG0shmqe2T0SKk LCgoGkH4dBpme8GSGr9xK1SDzLHbcC+xW31DkXA= X-Google-Smtp-Source: ABdhPJzhH1t4bRAbjrQUNNEJoXVXDen7p0Iz6JZzWJiKIaARwVA7GYJva6Zm7VmImiVUSctEX/rpXngemvR5EEIwEow= X-Received: by 2002:a37:2711:: with SMTP id n17mr15676461qkn.430.1590162696094; Fri, 22 May 2020 08:51:36 -0700 (PDT) MIME-Version: 1.0 References: <202005220917.04M9H7oE028708@repo.freebsd.org> In-Reply-To: <202005220917.04M9H7oE028708@repo.freebsd.org> From: Kyle Evans Date: Fri, 22 May 2020 10:51:22 -0500 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: svn commit: r361360 - head/sys/dev/hyperv/hvsock To: Wei Hu Cc: src-committers , svn-src-all , svn-src-head Content-Type: text/plain; charset="UTF-8" X-BeenThere: svn-src-all@freebsd.org X-Mailman-Version: 2.1.33 Precedence: list List-Id: "SVN commit messages for the entire src tree \(except for " user" and " projects" \)" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 22 May 2020 15:51:36 -0000 On Fri, May 22, 2020 at 4:17 AM Wei Hu 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