linux/security/selinux
Ondrej Mosnacek 1537ad15c9 kernfs: fix xattr name handling in LSM helpers
The implementation of kernfs_security_xattr_*() helpers reuses the
kernfs_node_xattr_*() functions, which take the suffix of the xattr name
and extract full xattr name from it using xattr_full_name(). However,
this function relies on the fact that the suffix passed to xattr
handlers from VFS is always constructed from the full name by just
incerementing the pointer. This doesn't necessarily hold for the callers
of kernfs_security_xattr_*(), so their usage will easily lead to
out-of-bounds access.

Fix this by moving the xattr name reconstruction to the VFS xattr
handlers and replacing the kernfs_security_xattr_*() helpers with more
general kernfs_xattr_*() helpers that take full xattr name and allow
accessing all kernfs node's xattrs.

Reported-by: kernel test robot <rong.a.chen@intel.com>
Fixes: b230d5aba2 ("LSM: add new hook for kernfs node initialization")
Fixes: ec882da5cd ("selinux: implement the kernfs_init_security hook")
Signed-off-by: Ondrej Mosnacek <omosnace@redhat.com>
Signed-off-by: Paul Moore <paul@paul-moore.com>
2019-04-04 09:00:27 -04:00
..
include selinux: try security xattr after genfs for kernfs filesystems 2019-03-20 21:53:04 -04:00
ss selinux: remove useless assignments 2019-03-25 10:25:06 -04:00
.gitignore SELinux: add .gitignore files for dynamic classes 2009-10-24 09:42:27 +08:00
avc.c selinux: fix avc audit messages 2019-02-05 12:34:33 -05:00
hooks.c kernfs: fix xattr name handling in LSM helpers 2019-04-04 09:00:27 -04:00
ibpkey.c selinux: wrap global selinux state 2018-03-01 18:48:02 -05:00
Kconfig selinux: Remove SECURITY_SELINUX_BOOTPARAM_VALUE 2019-01-08 13:18:43 -08:00
Makefile SELinux: Remove unused selinux_is_enabled 2019-01-08 13:18:44 -08:00
netif.c selinux: Cleanup printk logging in netif 2018-06-19 13:45:31 -04:00
netlabel.c selinux: avoid uninitialized variable warning 2019-03-25 10:34:35 -04:00
netlink.c selinux: Cleanup printk logging in netlink 2018-06-19 13:33:05 -04:00
netnode.c selinux: Cleanup printk logging in netnode 2018-06-19 13:49:10 -04:00
netport.c selinux: Cleanup printk logging in netport 2018-06-19 13:43:01 -04:00
nlmsgtab.c selinux: add support for RTM_NEWCHAIN, RTM_DELCHAIN, and RTM_GETCHAIN 2018-11-29 11:32:02 -05:00
selinuxfs.c SELinux: Abstract use of inode security blob 2019-01-08 13:18:44 -08:00
xfrm.c SELinux: Abstract use of cred security blob 2019-01-08 13:18:44 -08:00