kernfs: allow creating kernfs objects with arbitrary uid/gid
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Fri, 20 Jul 2018 21:56:47 +0000 (21:56 +0000)
committerDavid S. Miller <davem@davemloft.net>
Sat, 21 Jul 2018 06:44:35 +0000 (23:44 -0700)
commit488dee96bb62f0b3d9e678cf42574034d5b033a5
tree2969d47ffb0ffeaf15d20ffb0eda78a2bb694a40
parent7c4ec749a3bd89237d7195ccd621bf5d4124d6b5
kernfs: allow creating kernfs objects with arbitrary uid/gid

This change allows creating kernfs files and directories with arbitrary
uid/gid instead of always using GLOBAL_ROOT_UID/GID by extending
kernfs_create_dir_ns() and kernfs_create_file_ns() with uid/gid arguments.
The "simple" kernfs_create_file() and kernfs_create_dir() are left alone
and always create objects belonging to the global root.

When creating symlinks ownership (uid/gid) is taken from the target kernfs
object.

Co-Developed-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
arch/x86/kernel/cpu/intel_rdt_rdtgroup.c
fs/kernfs/dir.c
fs/kernfs/file.c
fs/kernfs/inode.c
fs/kernfs/kernfs-internal.h
fs/kernfs/symlink.c
fs/sysfs/dir.c
fs/sysfs/file.c
include/linux/kernfs.h
kernel/cgroup/cgroup.c