[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250521003211.8847-1-kuniyu@amazon.com>
Date: Tue, 20 May 2025 17:31:49 -0700
From: Kuniyuki Iwashima <kuniyu@...zon.com>
To: <stephen.smalley.work@...il.com>
CC: <anna@...nel.org>, <brauner@...nel.org>, <casey@...aufler-ca.com>,
<davem@...emloft.net>, <edumazet@...gle.com>, <horms@...nel.org>,
<jack@...e.cz>, <jmorris@...ei.org>, <kuba@...nel.org>, <kuniyu@...zon.com>,
<linux-fsdevel@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
<linux-nfs@...r.kernel.org>, <linux-security-module@...r.kernel.org>,
<netdev@...r.kernel.org>, <omosnace@...hat.com>, <pabeni@...hat.com>,
<paul@...l-moore.com>, <selinux@...r.kernel.org>, <serge@...lyn.com>,
<trondmy@...nel.org>, <viro@...iv.linux.org.uk>, <willemb@...gle.com>
Subject: Re: [PATCH v2] security,fs,nfs,net: update security_inode_listsecurity() interface
From: Stephen Smalley <stephen.smalley.work@...il.com>
Date: Mon, 28 Apr 2025 15:50:19 -0400
> Update the security_inode_listsecurity() interface to allow
> use of the xattr_list_one() helper and update the hook
> implementations.
>
> Link: https://lore.kernel.org/selinux/20250424152822.2719-1-stephen.smalley.work@gmail.com/
>
> Signed-off-by: Stephen Smalley <stephen.smalley.work@...il.com>
[...]
> diff --git a/net/socket.c b/net/socket.c
> index 9a0e720f0859..bbcaa3371fcd 100644
> --- a/net/socket.c
> +++ b/net/socket.c
> @@ -560,17 +560,14 @@ static ssize_t sockfs_listxattr(struct dentry *dentry, char *buffer,
> size_t size)
> {
> ssize_t len;
> - ssize_t used = 0;
> + ssize_t used, remaining;
> + int err;
Paul: Could you sort this in the reverse xmas tree order before merging ?
https://docs.kernel.org/process/maintainer-netdev.html#local-variable-ordering-reverse-xmas-tree-rcs
otherwise the socket part looks good to me:
Reviewed-by: Kuniyuki Iwashima <kuniyu@...zon.com>
>
> - len = security_inode_listsecurity(d_inode(dentry), buffer, size);
> - if (len < 0)
> - return len;
> - used += len;
> - if (buffer) {
> - if (size < used)
> - return -ERANGE;
> - buffer += len;
> - }
> + err = security_inode_listsecurity(d_inode(dentry), &buffer,
> + &remaining);
> + if (err)
> + return err;
> + used = size - remaining;
>
> len = (XATTR_NAME_SOCKPROTONAME_LEN + 1);
> used += len;
Powered by blists - more mailing lists