Re: [PATCH 0/5] Make /sys/class/net per net namespace objects belong to container

2 messages, 2 authors, 2016-09-15 · open the first message on its own page

Re: [PATCH 0/5] Make /sys/class/net per net namespace objects belong to container

From: Eric W. Biederman <hidden>
Date: 2016-08-29 12:52:25

David Miller [off-list ref] writes:
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: Tue, 16 Aug 2016 15:33:10 -0700
quoted
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.
I need some domain experts to review this series please.
I just came back from vacation and I will aim to take a look shortly.

The big picture idea seems sensible.  Having a better ownship of sysfs
files that are part of a network namespace.  I will have to look at the
details to see if the implementation is similarly sensible.

Eric

Re: [PATCH 0/5] Make /sys/class/net per net namespace objects belong to container

From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: 2016-09-15 03:24:23

On Mon, Aug 29, 2016 at 5:38 AM, Eric W. Biederman
[off-list ref] wrote:
David Miller [off-list ref] writes:
quoted
From: Dmitry Torokhov <dmitry.torokhov@gmail.com>
Date: Tue, 16 Aug 2016 15:33:10 -0700
quoted
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.
I need some domain experts to review this series please.
I just came back from vacation and I will aim to take a look shortly.

The big picture idea seems sensible.  Having a better ownship of sysfs
files that are part of a network namespace.  I will have to look at the
details to see if the implementation is similarly sensible.
Eric,

Did you find anything objectionable in the series or should I fix up
the !CONFIG_SYSFS error in networking patch and resubmit?

Thanks.

-- 
Dmitry
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help