From nobody Sun Mar 3 20:57:10 2024 X-Original-To: dev-commits-src-main@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id 4TnvK23VrZz5CJGw; Sun, 3 Mar 2024 20:57:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (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 "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4TnvK230DJz434T; Sun, 3 Mar 2024 20:57:10 +0000 (UTC) (envelope-from git@FreeBSD.org) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709499430; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bpmIyFEOL6kBVQLN5AMTXn9QHBvZkdbDwJX0JvINOIk=; b=o0YKNJPOsWNtRi/KnEehqxLXfePblZqqylZQ3fx8AtVHfdZ1dH8rmEe9Bgt1E+G81Yyfoc UeF39zRw7FK6yexxRkOHahcQfgqsLIWg+wrOiWoPNBEkWBMLP1/CD+2B6X5B4hv2nA3lqv lrvx+tZdsooisJSptkkAxEeMkc5CGnDuMGPe0lnJKaH2o7rQXYVFkFIITyHYXcFNHeOYL7 p7jKIEgna4XB7tkXcOpG4b0oY+RG0WOjWSbAMqrdmpJBEGzhlwpL0nhdsGgXe2VG9qwbBt 1zorlrZXivVopQS3+JzDBfUi98qZl3WBRfZ9nIlY5D5osvM/DUmaHTZD/HsQSA== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709499430; a=rsa-sha256; cv=none; b=h0R3SVRZ22u38+E8oWGojoI26JBL8IoyRUq2/PLjdq0Y9FunSbB27KS7+v58Veu3T8EeEk 4uTpo/0d4w026emc5zvD08u7VXIcVRBI6mEBwRq9rwxOgrIYIbBl/cNf8ygdjesdys78Sd L7oWrHlunT4SNhGDYdLR1lAsbfFunNYl2VfNXYHKLm227jOmEHyP6NZk6KRICH4US1Gs1v 9LRt4Eo4rCgC5fqvQx8jl+FH9TKadYOXipOSjih92CR5Eqj6iMs63d90eKB0mVu1gG8UBq m/kRDn3b61lh+Zbk9M9aWugDRJ7Y18MTAuUSUuSqK9G8EytXXONpdeiVQC+Jag== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709499430; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=bpmIyFEOL6kBVQLN5AMTXn9QHBvZkdbDwJX0JvINOIk=; b=o4JVPSW4ngBzBI1saT4Yd0uJ3JbW+SCf3T8NjstzqNjW1sKQa7JJuIElwPnQ/DlHsbdxPO h83v6B9Rieg0snmNhkgCSXWXqrIwih0En7xvOR+ossfTpqS21xMUXyJu00FyYiTedlHyJq i5gkkD91p6Ogc+E+AgbHu9vX1KU3uRKAvGWrfvKO1ujhtzpRHMLTLHDb6lG23DQF58LHNC KDrm2m7emqO3BYP8Xhym4hfLSLqgjXN73ZOV64TaRzOXwYTrVPXMXtKMxC6Do3ZFBHiXnX uPWoEPcwTaxIARGpp2WCm4YQM681RCSOt/FeoeWNpeUHlOL9adroPADVuz7MBw== Received: from gitrepo.freebsd.org (gitrepo.freebsd.org [IPv6:2610:1c1:1:6068::e6a:5]) (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 did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 4TnvK22X15zshZ; Sun, 3 Mar 2024 20:57:10 +0000 (UTC) (envelope-from git@FreeBSD.org) Received: from gitrepo.freebsd.org ([127.0.1.44]) by gitrepo.freebsd.org (8.17.1/8.17.1) with ESMTP id 423KvAUS089012; Sun, 3 Mar 2024 20:57:10 GMT (envelope-from git@gitrepo.freebsd.org) Received: (from git@localhost) by gitrepo.freebsd.org (8.17.1/8.17.1/Submit) id 423KvAAr089009; Sun, 3 Mar 2024 20:57:10 GMT (envelope-from git) Date: Sun, 3 Mar 2024 20:57:10 GMT Message-Id: <202403032057.423KvAAr089009@gitrepo.freebsd.org> To: src-committers@FreeBSD.org, dev-commits-src-all@FreeBSD.org, dev-commits-src-main@FreeBSD.org From: Gleb Smirnoff Subject: git: 2f5a315b3074 - main - linux: require vnet(9) context in ifname_bsd_to_linux_name() List-Id: Commit messages for the main branch of the src repository List-Archive: https://lists.freebsd.org/archives/dev-commits-src-main List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-dev-commits-src-main@freebsd.org X-BeenThere: dev-commits-src-main@freebsd.org MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 8bit X-Git-Committer: glebius X-Git-Repository: src X-Git-Refname: refs/heads/main X-Git-Reftype: branch X-Git-Commit: 2f5a315b307447f91891c96fb23c7333fa406f2f Auto-Submitted: auto-generated The branch main has been updated by glebius: URL: https://cgit.FreeBSD.org/src/commit/?id=2f5a315b307447f91891c96fb23c7333fa406f2f commit 2f5a315b307447f91891c96fb23c7333fa406f2f Author: Gleb Smirnoff AuthorDate: 2024-03-03 20:56:58 +0000 Commit: Gleb Smirnoff CommitDate: 2024-03-03 20:56:58 +0000 linux: require vnet(9) context in ifname_bsd_to_linux_name() This function is used by netlink(9) only. The netlink(9) taskqueue thread runs in the vnet of the socket whose request the thread is processing right now. This is a correct vnet and resetting it to vnet0 is incorrect. If the function is to be used by any other caller in addition to netlink(9), it would be caller's responsiblity to provide correct vnet(9). Reviewed by: melifaro, dchagin Differential Revision: https://reviews.freebsd.org/D44191 PR: 277286 --- sys/compat/linux/linux.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/sys/compat/linux/linux.c b/sys/compat/linux/linux.c index 569f9ffe1617..69849b1d98ad 100644 --- a/sys/compat/linux/linux.c +++ b/sys/compat/linux/linux.c @@ -253,14 +253,14 @@ ifname_bsd_to_linux_name(const char *bsdname, char *lxname, size_t len) struct ifnet *ifp; int ret; + CURVNET_ASSERT_SET(); + ret = 0; - CURVNET_SET(TD_TO_VNET(curthread)); NET_EPOCH_ENTER(et); ifp = ifunit(bsdname); if (ifp != NULL) ret = ifname_bsd_to_linux_ifp(ifp, lxname, len); NET_EPOCH_EXIT(et); - CURVNET_RESTORE(); return (ret); }