linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 0/5] Make /sys/class/net per net namespace objects belong to container
@ 2016-08-16 22:33 Dmitry Torokhov
  2016-08-16 22:33 ` [PATCH 1/5] kernfs: allow creating kernfs objects with arbitrary uid/gid Dmitry Torokhov
                   ` (6 more replies)
  0 siblings, 7 replies; 14+ messages in thread
From: Dmitry Torokhov @ 2016-08-16 22:33 UTC (permalink / raw)
  To: Tejun Heo, Eric W. Biederman, David S. Miller; +Cc: linux-kernel, netdev

There are objects in /sys hierarchy (/sys/class/net/) that logically belong
to a namespace/container. Unfortunately all sysfs objects start their life
belonging to global root, and while we could change ownership manually,
keeping tracks of all objects that come and go is cumbersome. It would
be better if kernel created them using correct uid/gid from the beginning.

This series changes kernfs to allow creating object's with arbitrary
uid/gid, adds get_ownership() callback to ktype structure so subsystems
could supply their own logic (likely tied to namespace support) for
determining ownership of kobjects, and adjusts sysfs code to make use of
this information. Lastly net-sysfs is adjusted to make sure that objects in
net namespace are owned by the root user from the owning user namespace.

Note that we do not adjust ownership of objects moved into a new namespace
(as when moving a network device into a container) as userspace can easily
do it.

Thanks!

Dmitry Torokhov (5):
  kernfs: allow creating kernfs objects with arbitrary uid/gid
  sysfs, kobject: allow creating kobject belonging to arbitrary users
  kobject: kset_create_and_add() - fetch ownership info from parent
  driver core: set up ownership of class devices in sysfs
  net-sysfs: make sure objects belong to contrainer's owner

 drivers/base/core.c         |  9 +++++++++
 fs/kernfs/dir.c             | 29 ++++++++++++++++++++++++++---
 fs/kernfs/file.c            |  8 ++++++--
 fs/kernfs/inode.c           |  2 +-
 fs/kernfs/kernfs-internal.h |  2 ++
 fs/kernfs/symlink.c         | 11 ++++++++++-
 fs/sysfs/dir.c              |  7 ++++++-
 fs/sysfs/file.c             | 33 +++++++++++++++++++++------------
 fs/sysfs/group.c            | 23 +++++++++++++++++------
 fs/sysfs/sysfs.h            |  3 ++-
 include/linux/device.h      |  5 +++++
 include/linux/kernfs.h      | 28 +++++++++++++++++++---------
 include/linux/kobject.h     |  4 ++++
 kernel/cgroup.c             |  4 +++-
 lib/kobject.c               | 28 +++++++++++++++++++++++++++-
 net/core/net-sysfs.c        | 44 +++++++++++++++++++++++++++++++++++++++++++-
 16 files changed, 201 insertions(+), 39 deletions(-)

-- 
2.8.0.rc3.226.g39d4020

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

end of thread, other threads:[~2016-09-15 23:39 UTC | newest]

Thread overview: 14+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-08-16 22:33 [PATCH 0/5] Make /sys/class/net per net namespace objects belong to container Dmitry Torokhov
2016-08-16 22:33 ` [PATCH 1/5] kernfs: allow creating kernfs objects with arbitrary uid/gid Dmitry Torokhov
2016-08-16 22:33 ` [PATCH 2/5] sysfs, kobject: allow creating kobject belonging to arbitrary users Dmitry Torokhov
2016-08-16 22:33 ` [PATCH 3/5] kobject: kset_create_and_add() - fetch ownership info from parent Dmitry Torokhov
2016-08-16 22:33 ` [PATCH 4/5] driver core: set up ownership of class devices in sysfs Dmitry Torokhov
2016-08-20  2:26   ` Stephen Hemminger
2016-08-16 22:33 ` [PATCH 5/5] net-sysfs: make sure objects belong to contrainer's owner Dmitry Torokhov
2016-08-22  6:03   ` kbuild test robot
2016-08-19 23:59 ` [PATCH 0/5] Make /sys/class/net per net namespace objects belong to container David Miller
2016-08-29 12:38   ` Eric W. Biederman
2016-09-15  3:24     ` Dmitry Torokhov
2016-09-15 23:26       ` Eric W. Biederman
2016-08-22  6:41 ` David Miller
2016-08-22 16:24   ` Dmitry Torokhov

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).