From: Stephen Smalley <stephen.smalley.work@gmail.com>
To: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Cc: paul@paul-moore.com, omosnace@redhat.com,
linux-security-module@vger.kernel.org, selinux@vger.kernel.org,
Tejun Heo <tj@kernel.org>,
Alexander Viro <viro@zeniv.linux.org.uk>,
Christian Brauner <brauner@kernel.org>, Jan Kara <jack@suse.cz>,
Hugh Dickins <hughd@google.com>,
Baolin Wang <baolin.wang@linux.alibaba.com>,
Andrew Morton <akpm@linux-foundation.org>,
linux-kernel@vger.kernel.org, linux-fsdevel@vger.kernel.org,
linux-mm@kvack.org
Subject: Re: [PATCH] vfs,shmem,kernfs: fix listxattr to include security.* xattrs
Date: Thu, 24 Apr 2025 11:43:57 -0400 [thread overview]
Message-ID: <CAEjxPJ4i3fN8qtuY2TRiWRqy+sY3-nV_FYc4uzD-h2ZxAF-M2A@mail.gmail.com> (raw)
In-Reply-To: <CAEjxPJ4C7ritSqF0mE+2rczKJHdUTNGs5_RDx3PHKcg_rQQV4w@mail.gmail.com>
On Thu, Apr 24, 2025 at 10:55 AM Stephen Smalley
<stephen.smalley.work@gmail.com> wrote:
>
> On Thu, Apr 24, 2025 at 9:53 AM Stephen Smalley
> <stephen.smalley.work@gmail.com> wrote:
> >
> > On Thu, Apr 24, 2025 at 9:12 AM Greg Kroah-Hartman
> > <gregkh@linuxfoundation.org> wrote:
> > >
> > > On Thu, Apr 24, 2025 at 08:46:43AM -0400, Stephen Smalley wrote:
> > > > The vfs has long had a fallback to obtain the security.* xattrs from the
> > > > LSM when the filesystem does not implement its own listxattr, but
> > > > shmem/tmpfs and kernfs later gained their own xattr handlers to support
> > > > other xattrs. Unfortunately, as a side effect, tmpfs and kernfs-based
> > > > filesystems like sysfs no longer return the synthetic security.* xattr
> > > > names via listxattr unless they are explicitly set by userspace or
> > > > initially set upon inode creation after policy load. coreutils has
> > > > recently switched from unconditionally invoking getxattr for security.*
> > > > for ls -Z via libselinux to only doing so if listxattr returns the xattr
> > > > name, breaking ls -Z of such inodes.
> > > >
> > > > Before:
> > > > $ getfattr -m.* /run/initramfs
> > > > <no output>
> > > > $ getfattr -m.* /sys/kernel/fscaps
> > > > <no output>
> > > >
> > > > After:
> > > > $ getfattr -m.* /run/initramfs
> > > > security.selinux
> > > > $ getfattr -m.* /sys/kernel/fscaps
> > > > security.selinux
> > > >
> > > > Link: https://lore.kernel.org/selinux/CAFqZXNtF8wDyQajPCdGn=iOawX4y77ph0EcfcqcUUj+T87FKyA@mail.gmail.com/
> > > > Link: https://lore.kernel.org/selinux/20250423175728.3185-2-stephen.smalley.work@gmail.com/
> > > > Signed-off-by: Stephen Smalley <stephen.smalley.work@gmail.com>
> > >
> > > As this "changed" in the past, shouldn't it have a "Fixes:" tag?
> >
> > Yes, I'll add that on v2. Also appears that it doesn't quite correctly
> > handle the case where listxattr() is called with size == 0 to probe
> > for the required size.
>
> And doesn't correctly handle the case where the list size exceeds the
> original buffer size. On second look, this can be done more simply and
> safely in simple_xattr_list() itself, avoiding the need to modify
> shmem/tmpfs and kernfs. I'll submit an updated patch.
Submitted here,
https://lore.kernel.org/selinux/20250424152822.2719-1-stephen.smalley.work@gmail.com/
Sorry I forgot the Fixes tag again but added it in a reply.
prev parent reply other threads:[~2025-04-24 15:44 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2025-04-24 12:46 Stephen Smalley
2025-04-24 13:12 ` Greg Kroah-Hartman
2025-04-24 13:53 ` Stephen Smalley
2025-04-24 14:55 ` Stephen Smalley
2025-04-24 15:43 ` Stephen Smalley [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=CAEjxPJ4i3fN8qtuY2TRiWRqy+sY3-nV_FYc4uzD-h2ZxAF-M2A@mail.gmail.com \
--to=stephen.smalley.work@gmail.com \
--cc=akpm@linux-foundation.org \
--cc=baolin.wang@linux.alibaba.com \
--cc=brauner@kernel.org \
--cc=gregkh@linuxfoundation.org \
--cc=hughd@google.com \
--cc=jack@suse.cz \
--cc=linux-fsdevel@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=linux-security-module@vger.kernel.org \
--cc=omosnace@redhat.com \
--cc=paul@paul-moore.com \
--cc=selinux@vger.kernel.org \
--cc=tj@kernel.org \
--cc=viro@zeniv.linux.org.uk \
/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