]> git.proxmox.com Git - mirror_ubuntu-bionic-kernel.git/commit
sysfs, kobject: allow creating kobject belonging to arbitrary users
authorDmitry Torokhov <dmitry.torokhov@gmail.com>
Wed, 31 Oct 2018 00:55:18 +0000 (00:55 +0000)
committerThadeu Lima de Souza Cascardo <cascardo@canonical.com>
Fri, 9 Nov 2018 18:59:50 +0000 (16:59 -0200)
commit4e5feafc1c5463b7f295a02b3c7fd76aad8cda19
tree5c50b711d4fefad9baf0f95b5f04865a81a2dd2e
parent630d0eb685ef2f19584171b4021ac0e9da11aa54
sysfs, kobject: allow creating kobject belonging to arbitrary users

BugLink: https://launchpad.net/bugs/1784501
Normally kobjects and their sysfs representation belong to global root,
however it is not necessarily the case for objects in separate namespaces.
For example, objects in separate network namespace logically belong to the
container's root and not global root.

This change lays groundwork for allowing network namespace objects
ownership to be transferred to container's root user by defining
get_ownership() callback in ktype structure and using it in sysfs code to
retrieve desired uid/gid when creating sysfs objects for given kobject.

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>
(cherry picked from commit 5f81880d5204ee2388fd9a75bb850ccd526885b7)
Signed-off-by: Tyler Hicks <tyhicks@canonical.com>
Acked-by: Kleber Souza <kleber.souza@canonical.com>
Acked-by: Stefan Bader <stefan.bader@canonical.com>
Signed-off-by: Khalid Elmously <khalid.elmously@canonical.com>
fs/sysfs/dir.c
fs/sysfs/file.c
fs/sysfs/group.c
fs/sysfs/sysfs.h
include/linux/kobject.h
lib/kobject.c