alistair23-linux/fs/kernfs
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
..
dir.c kernfs: initialize security of newly created nodes 2019-03-20 22:10:15 -04:00
file.c fs: kernfs: add poll file operation 2019-03-05 21:07:17 -08:00
inode.c kernfs: fix xattr name handling in LSM helpers 2019-04-04 09:00:27 -04:00
Kconfig
kernfs-internal.h kernfs: use simple_xattrs for security attributes 2019-03-20 21:54:33 -04:00
Makefile
mount.c Merge branch 'work.mount' of git://git.kernel.org/pub/scm/linux/kernel/git/viro/vfs 2019-03-12 14:08:19 -07:00
symlink.c kernfs: clean up struct kernfs_iattrs 2019-03-20 21:42:14 -04:00