From: Joel Granados <j.granados@samsung.com>
To: "Thomas Weißschuh" <linux@weissschuh.net>
Cc: "David S. Miller" <davem@davemloft.net>,
Eric Dumazet <edumazet@google.com>,
Jakub Kicinski <kuba@kernel.org>, Paolo Abeni <pabeni@redhat.com>,
Dmitry Torokhov <dmitry.torokhov@gmail.com>,
"Eric W. Biederman" <ebiederm@xmission.com>,
<netdev@vger.kernel.org>, <linux-kernel@vger.kernel.org>,
Luis Chamberlain <mcgrof@kernel.org>,
Kuniyuki Iwashima <kuniyu@amazon.com>, <stable@vger.kernel.org>
Subject: Re: [PATCH v3] fs/proc/proc_sysctl.c: always initialize i_uid/i_gid
Date: Fri, 3 May 2024 15:17:29 +0200 [thread overview]
Message-ID: <20240503131729.zrh3owxk5tldv4xe@joelS2.panther.com> (raw)
In-Reply-To: <20240402-sysctl-net-ownership-v3-1-366b1a76d48a@weissschuh.net>
[-- Attachment #1: Type: text/plain, Size: 2111 bytes --]
On Tue, Apr 02, 2024 at 11:10:34PM +0200, Thomas Weißschuh wrote:
> Commit 5ec27ec735ba ("fs/proc/proc_sysctl.c: fix the default values of i_uid/i_gid on /proc/sys inodes.")
> added defaults for i_uid/i_gid when set_ownership() is not implemented.
> It missed to also adjust net_ctl_set_ownership() to use the same default
> values in case the computation of a better value fails.
>
> Instead always initialize i_uid/i_gid inside the sysfs core so
> set_ownership() can safely skip setting them.
>
> Fixes: 5ec27ec735ba ("fs/proc/proc_sysctl.c: fix the default values of i_uid/i_gid on /proc/sys inodes.")
> Cc: stable@vger.kernel.org
> Signed-off-by: Thomas Weißschuh <linux@weissschuh.net>
> ---
> Changes in v3:
> - Rebase onto v6.9-rc1
> - Reword commit message and mention correct fixed commit
> - Link to v2: https://lore.kernel.org/r/20240322-sysctl-net-ownership-v2-1-a8b4a3306542@weissschuh.net
>
> 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(-)
>
> 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 super_block *sb,
> make_empty_dir_inode(inode);
> }
>
> + inode->i_uid = GLOBAL_ROOT_UID;
> + inode->i_gid = GLOBAL_ROOT_GID;
> if (root->set_ownership)
> root->set_ownership(head, table, &inode->i_uid, &inode->i_gid);
> - else {
> - inode->i_uid = GLOBAL_ROOT_UID;
> - inode->i_gid = GLOBAL_ROOT_GID;
> - }
>
> return inode;
> }
>
> ---
> base-commit: 4cece764965020c22cff7665b18a012006359095
> change-id: 20240315-sysctl-net-ownership-bc4e17eaeea6
>
> Best regards,
> --
> Thomas Weißschuh <linux@weissschuh.net>
>
Queueing this up for 6.11....
Reviewed-by: Joel Granados <j.granados@samsung.com>
--
Joel Granados
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 659 bytes --]
prev parent reply other threads:[~2024-05-03 13:17 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <CGME20240402211043eucas1p173a936d187ae9bcf5be3729e69739e38@eucas1p1.samsung.com>
2024-04-02 21:10 ` [PATCH v3] fs/proc/proc_sysctl.c: always initialize i_uid/i_gid Thomas Weißschuh
2024-04-17 9:44 ` Joel Granados
2024-05-03 13:17 ` Joel Granados [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240503131729.zrh3owxk5tldv4xe@joelS2.panther.com \
--to=j.granados@samsung.com \
--cc=davem@davemloft.net \
--cc=dmitry.torokhov@gmail.com \
--cc=ebiederm@xmission.com \
--cc=edumazet@google.com \
--cc=kuba@kernel.org \
--cc=kuniyu@amazon.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux@weissschuh.net \
--cc=mcgrof@kernel.org \
--cc=netdev@vger.kernel.org \
--cc=pabeni@redhat.com \
--cc=stable@vger.kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).