Received: by 2002:ab2:b82:0:b0:1f3:401:3cfb with SMTP id 2csp725091lqh; Thu, 28 Mar 2024 14:33:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCUJiDA8w+zT7SBCv8X5J/pYcv75Ixu/uJ0/FGD9wt1o5wRyJn/cXsM0LvZ9Islp8L2S//nB8oNqHDNtzOzY4eMCYAFDYsvappi5rDCLng== X-Google-Smtp-Source: AGHT+IHr57sW3By/49C0NVw1q7O278lc8tS587NpFPr3QuTtcsZp/0+XcbKYhNV2cKq/qzUchIQT X-Received: by 2002:a05:6a20:8094:b0:1a3:6a74:2e6b with SMTP id c20-20020a056a20809400b001a36a742e6bmr317480pza.55.1711661632070; Thu, 28 Mar 2024 14:33:52 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711661632; cv=pass; d=google.com; s=arc-20160816; b=GQIgbXTRAm1k3sjkbLoUwlx51nABi3fvsixpg3EjvOPUT5PIE7rRvRAAoMVHH9TTb9 GKbAlkbqAUwxpE/mcuJECW8wWIt8qWY/9sHG2dhJBgrh3vajLIZsoXBOtY/BaiXNA601 L+sJgu53jzp7pOQONtjSm4T8IfB4ZclKO3AQTHCi2EQmSSs2l7fNzD+uWnctN6Q5U2KK bXD+8sQ18fduw5oYRe9H6NAet7p7dzNVxmwVaeHN2VEFlYGssGsR95ocLBPnya804HOj rSMx87NWluI04saHNyOnrMF8e958mRRQ6uy6uOjw2Pp320SDLk1v7fD+TiJ9lyabLTip qw8w== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:cms-type:in-reply-to:content-disposition:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:message-id :subject:cc:to:from:date:dkim-signature:dkim-filter; bh=JgXGkpnWdKDz6hCWir0P3L7GaIVHsxjZP+k30qYYK9o=; fh=5n3t05W1BhqgWj5gT8Q6rLnEFwpgQYdWS5UlDDbk7bQ=; b=VpSxuiRBwqnEvtp55eRe9xN30Ws+FOK8rE7xSslmIGmUQWl0MdE5od3gVG5X6TaPNv svwYmYLxrfsOKPnmRGdi+hgVkr+yGuf5fjBpV0CeFC0axKxf7mSMYoJv4t1E6RpA6Ea0 0EgpjxHKHTAvVi6VLAaDA3KbJE4O4wjBM5Gk8I79HtHwqjYIsZwty2pm0aWcD6/4WUSO 1VY1oglqL2c2iS1XU89f1sveAtSHilHwaoq4dinSo4d3m0taHROyzGjDbuuKMwOyqVG6 y8oXU4Btz7WeEgfPtp8e4p/+0XrqjKEEAJlxykRrjstNjFAZ4VkXKprkUkos8b8VJeZI 40EQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="R8RrE/WV"; arc=pass (i=1 spf=pass spfdomain=samsung.com dkim=pass dkdomain=samsung.com dmarc=pass fromdomain=samsung.com); spf=pass (google.com: domain of linux-kernel+bounces-123614-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123614-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [139.178.88.99]) by mx.google.com with ESMTPS id u16-20020a1709026e1000b001e223b9eb27si1029553plk.389.2024.03.28.14.33.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 28 Mar 2024 14:33:52 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-123614-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) client-ip=139.178.88.99; Authentication-Results: mx.google.com; dkim=pass header.i=@samsung.com header.s=mail20170921 header.b="R8RrE/WV"; arc=pass (i=1 spf=pass spfdomain=samsung.com dkim=pass dkdomain=samsung.com dmarc=pass fromdomain=samsung.com); spf=pass (google.com: domain of linux-kernel+bounces-123614-linux.lists.archive=gmail.com@vger.kernel.org designates 139.178.88.99 as permitted sender) smtp.mailfrom="linux-kernel+bounces-123614-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=samsung.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sv.mirrors.kernel.org (Postfix) with ESMTPS id 029722A2B0B for ; Thu, 28 Mar 2024 20:44:11 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B576913AD28; Thu, 28 Mar 2024 20:43:06 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b="R8RrE/WV" Received: from mailout2.w1.samsung.com (mailout2.w1.samsung.com [210.118.77.12]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 694F412FB2D; Thu, 28 Mar 2024 20:43:02 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=210.118.77.12 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711658585; cv=none; b=HPxKbDytaFsQEXdsei3evVfFLmIHWl8/dhFrnIegJS/VkVAywIiHHRJakYb15n7hn+TbOeZwPH9VfvmKMPDea5iRwN4Lks1XKoAjeLJMVn3rg8r7s0kv4zA86ydIJrBJDW8YVU6BKEzLjYRoeCV9Bjd91C6oR6qNbYN5PckN5+k= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711658585; c=relaxed/simple; bh=wwVK0az7Vz5xXRiFxnwtFZ/et4fSgewUTyUqQBVFi00=; h=Date:From:To:CC:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition:In-Reply-To:References; b=K4+siR1GXluR/zmv6Hh+jPaqd4s6v0+uMWAgffDEBJz9WjjoBdye63mnS9usn77Xmcp6YJLxuvdIaUGsZS1L9UQHvUuTn5d/R6LSPI1OitLoEsbyzlfGEb5B1hxvtrIt0YzM4mI5V/nFZBPM1ZWGbziOqNq0u/gRzf+RSWSp+gU= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com; spf=pass smtp.mailfrom=samsung.com; dkim=pass (1024-bit key) header.d=samsung.com header.i=@samsung.com header.b=R8RrE/WV; arc=none smtp.client-ip=210.118.77.12 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=samsung.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=samsung.com Received: from eucas1p1.samsung.com (unknown [182.198.249.206]) by mailout2.w1.samsung.com (KnoxPortal) with ESMTP id 20240328204300euoutp02d7eee9320ddd3e5fbea5c4dd40b8d298~BCGj0MZrs0678306783euoutp02F; Thu, 28 Mar 2024 20:43:00 +0000 (GMT) DKIM-Filter: OpenDKIM Filter v2.11.0 mailout2.w1.samsung.com 20240328204300euoutp02d7eee9320ddd3e5fbea5c4dd40b8d298~BCGj0MZrs0678306783euoutp02F DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=samsung.com; s=mail20170921; t=1711658580; bh=JgXGkpnWdKDz6hCWir0P3L7GaIVHsxjZP+k30qYYK9o=; h=Date:From:To:CC:Subject:In-Reply-To:References:From; b=R8RrE/WVYvsfo/+F1I+G1HP08tKh68dItklAChZndlw7MSE+NRY/fpEa+e/7bBlH3 ALx7wOj5tR8PVsxgMMcmDt4y+nz6iORl1mFu7tLSTZNTQ64xWb2Wcg4OinjbfU7iWK kJZT1W5tI6lkjuT13iYGogHZYJ+31UZ7vKnWke7o= Received: from eusmges1new.samsung.com (unknown [203.254.199.242]) by eucas1p2.samsung.com (KnoxPortal) with ESMTP id 20240328204259eucas1p20353930a844142684290833c8a248743~BCGjGtE4x0936509365eucas1p2S; Thu, 28 Mar 2024 20:42:59 +0000 (GMT) Received: from eucas1p1.samsung.com ( [182.198.249.206]) by eusmges1new.samsung.com (EUCPMTA) with SMTP id 89.3E.09539.356D5066; Thu, 28 Mar 2024 20:42:59 +0000 (GMT) Received: from eusmtrp1.samsung.com (unknown [182.198.249.138]) by eucas1p1.samsung.com (KnoxPortal) with ESMTPA id 20240328204258eucas1p142f0672d9a34ff6875723786803eedc4~BCGiRq_-e2618326183eucas1p1L; Thu, 28 Mar 2024 20:42:58 +0000 (GMT) Received: from eusmgms1.samsung.com (unknown [182.198.249.179]) by eusmtrp1.samsung.com (KnoxPortal) with ESMTP id 20240328204258eusmtrp1607b57569a48b7beef0399d895ad77c0~BCGiRGI9P1887718877eusmtrp1P; Thu, 28 Mar 2024 20:42:58 +0000 (GMT) X-AuditID: cbfec7f2-52bff70000002543-f1-6605d6531485 Received: from eusmtip2.samsung.com ( [203.254.199.222]) by eusmgms1.samsung.com (EUCPMTA) with SMTP id 0A.01.09146.256D5066; Thu, 28 Mar 2024 20:42:58 +0000 (GMT) Received: from CAMSVWEXC02.scsc.local (unknown [106.1.227.72]) by eusmtip2.samsung.com (KnoxPortal) with ESMTPA id 20240328204258eusmtip2323bbd8f254703cd7bb523bbb451d975~BCGiELmxl0755407554eusmtip20; Thu, 28 Mar 2024 20:42:58 +0000 (GMT) Received: from localhost (106.210.248.208) by CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) with Microsoft SMTP Server (TLS) id 15.0.1497.2; Thu, 28 Mar 2024 20:42:38 +0000 Date: Thu, 28 Mar 2024 21:42:32 +0100 From: Joel Granados To: Thomas =?utf-8?Q?Wei=C3=9Fschuh?= CC: "David S. Miller" , Eric Dumazet , Jakub Kicinski , Paolo Abeni , Dmitry Torokhov , "Eric W. Biederman" , , , Luis Chamberlain , Kuniyuki Iwashima , Subject: Re: [PATCH v2] fs/proc/proc_sysctl.c: always initialize i_uid/i_gid Message-ID: <20240328204232.jh2ymioigvptjooa@joelS2.panther.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: multipart/signed; micalg="pgp-sha512"; protocol="application/pgp-signature"; boundary="f5njphdhtcms5gyn" Content-Disposition: inline In-Reply-To: <20240322-sysctl-net-ownership-v2-1-a8b4a3306542@weissschuh.net> X-ClientProxiedBy: CAMSVWEXC01.scsc.local (2002:6a01:e347::6a01:e347) To CAMSVWEXC02.scsc.local (2002:6a01:e348::6a01:e348) X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrOKsWRmVeSWpSXmKPExsWy7djPc7rB11jTDN5eE7WYc76FxeLwoheM Fv+3tbBbPD32iN3iwrY+VotlPWvZLC7vmsNm8fvHMyaLGxOeMlocWyBm8e30G0aLBRsfMTrw eKy40MXqsWXlTSaPnbPusnss2FTqsWlVJ5vH+31X2Tw+b5Lz6O8+xu4x5VA7SwBnFJdNSmpO Zllqkb5dAlfGydklBfelKqavOs7awPhdrIuRg0NCwESib0ltFyMXh5DACkaJdbs2skI4Xxgl Vpw6CuV8ZpT413qXsYuRE6zj9vu1TBCJ5YwSLWcnM8NVbfw9AaplK6PEpaN3mEBaWARUJZ68 28cCYrMJ6Eicf3OHGcQWEbCRWPntMzuIzSwwnVniy0QtEFtYwEfiwuG3rCAH8go4SFw46gkS 5hUQlDg58wkLRHmFxKmGd4wgJcwC0hLL/3GAhDkFfCVOXOhjhThUWeJux2k2CLtW4tSWW2BH Swjc4pS4/PgPC0TCReL63f/MELawxKvjW9ghbBmJ05N7WCAaJjNK7P/3gR3CWc0osazxKxNE lbVEy5UnUB2OEhNm/2WBhCqfxI23ghCH8klM2jadGSLMK9HRJgRRrSax+t4blgmMyrOQvDYL yWuzEF6DCOtJ3Jg6hQ1DWFti2cLXzBC2rcS6de9ZFjCyr2IUTy0tzk1PLTbMSy3XK07MLS7N S9dLzs/dxAhMj6f/Hf+0g3Huq496hxiZOBgPMaoANT/asPoCoxRLXn5eqpII786jL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sTc4tK8dL3k/NxNjMAkse3Yz807GOe9+qh3 iJGJg/EQowpQ56MNqy8wSrHk5eelKonw7jzKkibEm5JYWZValB9fVJqTWnyI0RQYiBOZpUST 84HpK68k3tDMwNTQxMzSwNTSzFhJnNezoCNRSCA9sSQ1OzW1ILUIpo+Jg1Oqgcl2qfjkBydz cp7/aAoIuHTsx7vpdlcVbHlM+efOnvdVYUr8xaDeuPbwy9vOJH5cdeHbZt+2asWjPNmTD1TI GL7+5Lw55mp6TrD9rLuMp3V9fUq4r93yfOYW/pTLrSqiz+rLn3hHSRO3v0rLvn3SZDnfFGHq vTUwo3X+v6MnN8tHC34Sm6mi1f3gf+yjJ6dEe/bqxTXZnMj4rXhjzQnL7tKki44hace5GM8U vjswf6lfkUiJzO2as9q3X57K9Dv6dZGVVpBu2MMTCqLRt9Ztfs7Bc9l184WjM9YrG+2daOOQ dc7TOtz8QfGDtzN7TjIun7alcN/k2+Z5n32nhmkwBefVGwQYO3iFvtp18licQIMSS3FGoqEW c1FxIgCxy8BhpwMAAA== X-CMS-MailID: 20240328204258eucas1p142f0672d9a34ff6875723786803eedc4 X-Msg-Generator: CA X-RootMTR: 20240322195138eucas1p14ff532294e26ed63a400321066f03d98 X-EPHeader: CA CMS-TYPE: 201P X-CMS-RootMailID: 20240322195138eucas1p14ff532294e26ed63a400321066f03d98 References: <20240322-sysctl-net-ownership-v2-1-a8b4a3306542@weissschuh.net> --f5njphdhtcms5gyn Content-Type: text/plain; charset="iso-8859-1" Content-Disposition: inline Content-Transfer-Encoding: quoted-printable On Fri, Mar 22, 2024 at 08:51:11PM +0100, Thomas Wei=DFschuh wrote: > Commit e79c6a4fc923 ("net: make net namespace sysctls belong to container= 's owner") > added default values for i_uid/i_gid. > These however are only used when ctl_table_root->set_ownership is not > implemented. > But the callbacks themselves could fail to compute i_uid/i_gid and they > all need to have the same fallback logic for this case. All this text is related to commit e79c6a4fc923; which is not the one at fault. I think mentioning e79c6a4fc923 here is incorrect. Please mention 5ec27ec735ba0 ("fs/proc/proc_sysctl.c: fix the default values of i_uid/i_gid on /proc/sys inodes") and how it missed adjusting net_ctl_set_ownership when it was committed. >=20 > This is unnecessary code duplication and prone to errors. > For example net_ctl_set_ownership() missed the fallback. This paragraph can be dropped >=20 > Instead always initialize i_uid/i_gid inside the sysfs core so > set_ownership() can safely skip setting them. >=20 > Fixes: e79c6a4fc923 ("net: make net namespace sysctls belong to container= 's owner") Why did you leave this? Do you disagree with my comment in https://lore.kernel.org/all/20240319130716.vne4nhb3mbwtabfb@joelS2.panther.= com/? > Cc: stable@vger.kernel.org > Signed-off-by: Thomas Wei=DFschuh > --- > Changes in v2: > - Move the fallback logic to the sysctl core > - Link to v1: https://lore.kernel.org/r/20240315-sysctl-net-ownership-v1-= 1-2b465555a292@weissschuh.net > --- > fs/proc/proc_sysctl.c | 6 ++---- > 1 file changed, 2 insertions(+), 4 deletions(-) >=20 > diff --git a/fs/proc/proc_sysctl.c b/fs/proc/proc_sysctl.c > index 37cde0efee57..9e34ab9c21e4 100644 > --- a/fs/proc/proc_sysctl.c > +++ b/fs/proc/proc_sysctl.c > @@ -479,12 +479,10 @@ static struct inode *proc_sys_make_inode(struct sup= er_block *sb, > make_empty_dir_inode(inode); > } > =20 > + inode->i_uid =3D GLOBAL_ROOT_UID; > + inode->i_gid =3D GLOBAL_ROOT_GID; > if (root->set_ownership) > root->set_ownership(head, table, &inode->i_uid, &inode->i_gid); > - else { > - inode->i_uid =3D GLOBAL_ROOT_UID; > - inode->i_gid =3D GLOBAL_ROOT_GID; > - } > =20 > return inode; > } >=20 > --- > base-commit: ff9c18e435b042596c9d48badac7488e3fa76a55 Now that v6.9-rc1 is out, I would rebase your next version there. The change looks good, but the commit message still needs work. --=20 Joel Granados --f5njphdhtcms5gyn Content-Type: application/pgp-signature; name="signature.asc" -----BEGIN PGP SIGNATURE----- iQGzBAABCgAdFiEErkcJVyXmMSXOyyeQupfNUreWQU8FAmYF1jcACgkQupfNUreW QU8Y4Av/apOhPma8wv0im4TrTo3uhkhiSmUil+CyJBYvKIDNanwIE+NtlSRluYs4 b0RTC96XXRfQJe57wd+Sm+pDTKL8rlbtEILfegr+IMMigtZcqIRQZz77GzVQCIhe AavNY/BlRGpsZiGxCJT4YHJjZsDBuJdy0W57eIZoXNFOqtEAmv5hmRcMKEi2IN2l faKxpbppNHN3YyOH1cHkA1ObdizsL01VJIIwdh5EjJDHae6a4RJZd0kWpSw/uBkR DKb+Bej/Hf2uBDHdThJKEJVB9V5+ByzABF8fTaXmsy80WFAKJLkuw5nKi+rNZoAd YFJsejAO5lpy8ZSTR6BzDWYosfJJndGXp2uuKEPibxquSk+N1NVptujPdsurIczT 3kTSrWh9sInYjpi5wQ78Z9sFqDZyn7t7mLa1OHg/izqI2qcA/+zrnYm9IDbke/PT FZ9DtiFtJIYYOoqyUKfeJMoaOGd+QhHtGGIAJNQn2ceYuOMPBz5G+SlmWNJ0qFsX EsOvDGKO =z7bl -----END PGP SIGNATURE----- --f5njphdhtcms5gyn--