All of lore.kernel.org
 help / color / mirror / Atom feed
* ls from coreutils 9.6 doesn't show labels of some files
@ 2025-01-28 15:11 Ondrej Mosnacek
  2025-01-28 15:26 ` Stephen Smalley
  0 siblings, 1 reply; 8+ messages in thread
From: Ondrej Mosnacek @ 2025-01-28 15:11 UTC (permalink / raw)
  To: SElinux list

Hello everyone,

In a recent commit [1] that has already made it into the coreutils
package in Fedora Rawhide, ls changed the way it retrieves security
labels from files, which causes the SELinux label not to be displayed
with -Z for some files. It seems that the key difference is that it
now relies on the result of llistxattr(2) to determine if the label
should be retrieved and if security.selinux is not listed, it just
prints ? as if the file had no label. On some inodes on some
filesystems (e.g. the root inode on tmpfs or most sysfs inodes),
however, security.selinux is not currently returned in *listxattr(2),
so the labels are not shown even though they are there (and would be
returned in a *getxattr(2) call).

We can of course ask coreutils to go back to fetching the label
unconditionally, but perhaps we should also/instead fix the
*listxattr(2) output to be correct? IIUC, in some cases it's a matter
of adding a security_inode_init_security() call, while other ones may
need a hook for listxattr that would inject the security.selinux entry
when it's not returned by the filesystem already.

[1] https://git.savannah.gnu.org/cgit/coreutils.git/commit/?id=4ce432ad8738387f1b2e80e883dc7080df3afabe

-- 
Ondrej Mosnacek
Senior Software Engineer, Linux Security - SELinux kernel
Red Hat, Inc.


^ permalink raw reply	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2025-04-22 18:57 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-01-28 15:11 ls from coreutils 9.6 doesn't show labels of some files Ondrej Mosnacek
2025-01-28 15:26 ` Stephen Smalley
2025-01-28 16:08   ` Paul Moore
2025-04-22 16:31     ` Rahul Sandhu
2025-04-22 17:28       ` Stephen Smalley
2025-04-22 17:35         ` Dominick Grift
2025-04-22 18:06       ` Casey Schaufler
2025-04-22 18:57         ` Stephen Smalley

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.