Skip to contentSkip to conversation

Kernel 2.6.33-rc6, 3 bugs container specific.

DISCUSSION Serge E. Hallyn 4 participants 11 messages Feb 2, 2010 – Feb 4, 2010 13 messages not in the archive

lore
Share & tools
lore
#5 lore raw
In reply to a message not in the archive
Quoted 20 lines · Daniel Lezcano
Quoted 19 lines · Jean-Marc Pigeon

Hello,

Quoted 6 lines · Michael Holzt
Quoted 3 lines
	Tried 2.6.33-rc6 to check container, 3 bugs show up.
	(test done on x86_64, Pentium(R) Dual-Core CPU E5400)

I guess this should better go on the containers mailing list, as this are kernel related problems?

Yes, you are right....I'll do it.

Problem with /proc/kmsg (bug #3) is a very real concern, Daniel Lezcano proposed a solution (using fuse), but I think this solution is just a patch (container sys-admin can override it, putting the whole system in total jeopardy).

Quoted 8 lines
Quoted 4 lines

Seems kernel team is very reluctant to make the K ring buffer virtual but I see no other solution (used already in openVZ).

Maybe I missed something, but AFAIR Serge Hallyn was willing to do this, no ?
Or there was a nack from someone ?

I was wondering out loud about the best design to solve his problem.

If we try to redirect kernel-generated messages to containers, we have several problems, including whether we need to duplicate the messages to the host container. So in one sense it seems more flexible to
1. send everything to host syslog
2. clamp down on syslog use by processes not in the init_user_ns
3. let the userspace on the host copy messages into a socket or file so child container can pretend it has real syslog.

-serge

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com

#7 lore raw
In reply to a message not in the archive

Hello,

Quoted 7 lines

I was wondering out loud about the best design to solve his problem.

If we try to redirect kernel-generated messages to containers, we have several problems, including whether we need to duplicate the messages to the host container. So in one sense it seems more flexible to
1. send everything to host syslog

No, if we do that all CONTs message will reach the same bucket and it will be difficult to sort them out..
CONT sys_admin and HOST sys_admin could be different "entity", so you debug CONT config and critical needed information reach HOST (which you do not have access to).

Quoted 1 line

2. clamp down on syslog use by processes not in the init_user_ns

Could give me more detail??...

Quoted 2 lines

3. let the userspace on the host copy messages into a socket or file so child container can pretend it has real syslog.

So you trap printk message from CONT on the HOST and redirect them on CONT but on a standard syslog channel. Seem OK to me, as long /proc/kmsg is not existing (/dev/null) in the CONT file tree.

Signature · 20 lines
A bientôt
==========================================================================
Jean-Marc Pigeon                                   Internet: [email protected]
SAFE Inc.                                          Phone: (514) 493-4280
                                                   Fax:   (514) 493-1946
        Clement, 'a kiss solution' to get rid of SPAM (at last)
           Clement' Home base <"http://www.clement.safe.ca">
==========================================================================


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Lxc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lxc-users
#9 lore raw
In reply to a message not in the archive
Quoted 10 lines · Jean-Marc Pigeon

Hello,

Quoted 7 lines

I was wondering out loud about the best design to solve his problem.

If we try to redirect kernel-generated messages to containers, we have several problems, including whether we need to duplicate the messages to the host container. So in one sense it seems more flexible to
1. send everything to host syslog

Quoted 7 lines

No, if we do that all CONTs message will reach the same bucket and it will be difficult to sort them out..
CONT sys_admin and HOST sys_admin could be different "entity", so you debug CONT config and critical needed information reach HOST (which you do not have access to).

Yes, so a privileged task on HOST must pass that information back to you on CONT. That is not a valid complaint imo. But how to sort the msgs out is a valid question.

We need some sort of identifier, unique system-wide, attached to.. something. Is ifindex unique system-wide right now? Oh, IIRC it is, but we wnat it to be containerized, so that would be a bad choice :)

Quoted 2 lines
Quoted 1 line

2. clamp down on syslog use by processes not in the init_user_ns

Could give me more detail??...

Simplest choices would be to just refuse sys_syslog() and open(/proc/kmsg) altogether from a container, or to only allow reading/writing messages to own syslog. (I had hoped to find time to try out the second option but simply haven't had the time, and it doesn't look like I will very soon. So if anyone else wants to, pls jump at it...)

Then /proc/kmsg can provide what I described above through a FUSE file, and if, as you mentioned, the container unmounts the FUSE fs and gets to real procfs, they just get nothing.

Quoted 17 lines
Quoted 2 lines

3. let the userspace on the host copy messages into a socket or file so child container can pretend it has real syslog.

So you trap printk message from CONT on the HOST and redirect them on CONT but on a standard syslog channel. Seem OK to me, as long /proc/kmsg is not existing (/dev/null) in the CONT file tree.

Signature · 8 lines
A bientôt
==========================================================================
Jean-Marc Pigeon                                   Internet: [email protected]
SAFE Inc.                                          Phone: (514) 493-4280
                                                   Fax:   (514) 493-1946
        Clement, 'a kiss solution' to get rid of SPAM (at last)
           Clement' Home base <"http://www.clement.safe.ca">
==========================================================================

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com

#11 lore raw
In reply to a message not in the archive
Quoted 35 lines · Serge E. Hallyn
Quoted 9 lines · Jean-Marc Pigeon

Hello,

Quoted 6 lines

I was wondering out loud about the best design to solve his problem.

If we try to redirect kernel-generated messages to containers, we have several problems, including whether we need to duplicate the messages to the host container. So in one sense it seems more flexible to
1. send everything to host syslog

Quoted 7 lines

No, if we do that all CONTs message will reach the same bucket and it will be difficult to sort them out..
CONT sys_admin and HOST sys_admin could be different "entity", so you debug CONT config and critical needed information reach HOST (which you do not have access to).

Yes, so a privileged task on HOST must pass that information back to you on CONT. That is not a valid complaint imo. But how to sort the msgs out is a valid question.

We need some sort of identifier, unique system-wide, attached to.. something. Is ifindex unique system-wide right now? Oh, IIRC it is, but we wnat it to be containerized, so that would be a bad choice :)

Quoted 2 lines
Quoted 1 line

2. clamp down on syslog use by processes not in the init_user_ns

Could give me more detail??...

Simplest choices would be to just refuse sys_syslog() and open(/proc/kmsg) altogether from a container, or to only allow reading/writing messages to own syslog. (I had hoped to find time to try out the second option but simply haven't had the time, and it doesn't look like I will very soon. So if anyone else wants to, pls jump at it...)

Quoted 10 lines

Then /proc/kmsg can provide what I described above through a FUSE file, and if, as you mentioned, the container unmounts the FUSE fs and gets to real procfs, they just get nothing.

Quoted 6 lines
Quoted 2 lines

3. let the userspace on the host copy messages into a socket or file so child container can pretend it has real syslog.

So you trap printk message from CONT on the HOST and redirect them on CONT but on a standard syslog channel. Seem OK to me, as long /proc/kmsg is not existing (/dev/null) in the CONT file tree.

We have:
* Commands to sys_syslog:
*
* 0 -- Close the log. Currently a NOP.
* 1 -- Open the log. Currently a NOP.
* 2 -- Read from the log.
* 3 -- Read all messages remaining in the ring buffer.
* 4 -- Read and clear all messages remaining in the ring buffer
* 5 -- Clear ring buffer.
* 6 -- Disable printk to console
* 7 -- Enable printk to console
* 8 -- Set level of messages printed to console
* 9 -- Return number of unread characters in the log buffer
* 10 -- Return size of the log buffer

And add:
* 11 -- create a new ring buffer for the current process and
its childs

We have, let's say a global ring buffer keep untouched, used by syslog(2) and printk. When we create a new ring buffer, we allocate it and assign to the nsproxy (global ring buffer is the default in the nsproxy).

The prink keeps writing in the global ring buffer and the syslog(2) writes to the "namespaced" ring buffer.

Does it makes sense ?

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com

#13 lore raw
In reply to a message not in the archive

Hello
[..]

Quoted 27 lines

We have:
* Commands to sys_syslog:
*
* 0 -- Close the log. Currently a NOP.
* 1 -- Open the log. Currently a NOP.
* 2 -- Read from the log.
* 3 -- Read all messages remaining in the ring buffer.
* 4 -- Read and clear all messages remaining in the ring buffer
* 5 -- Clear ring buffer.
* 6 -- Disable printk to console
* 7 -- Enable printk to console
* 8 -- Set level of messages printed to console
* 9 -- Return number of unread characters in the log buffer
* 10 -- Return size of the log buffer

And add:
* 11 -- create a new ring buffer for the current process and
its childs

We have, let's say a global ring buffer keep untouched, used by syslog(2) and printk. When we create a new ring buffer, we allocate it and assign to the nsproxy (global ring buffer is the default in the nsproxy).

Quoted 4 lines

The prink keeps writing in the global ring buffer and the syslog(2) writes to the "namespaced" ring buffer.

Does it makes sense ?

I like this idea, as it give us flexibility.

Caution: iptable packet log is using printk (AFIK) to do tracing. iptable can be used within CONT:
above the iptable within HOST: (ip filtering superset). So CONT:printk must be writing too in the "namespaced" ring buffer.

Signature · 20 lines
A bientôt
==========================================================================
Jean-Marc Pigeon                                   Internet: [email protected]
SAFE Inc.                                          Phone: (514) 493-4280
                                                   Fax:   (514) 493-1946
        Clement, 'a kiss solution' to get rid of SPAM (at last)
           Clement' Home base <"http://www.clement.safe.ca">
==========================================================================


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Lxc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lxc-users
#14 lore raw
In reply to a message not in the archive
Quoted 73 lines · Daniel Lezcano
Quoted 35 lines · Serge E. Hallyn
Quoted 9 lines · Jean-Marc Pigeon

Hello,

Quoted 6 lines

I was wondering out loud about the best design to solve his problem.

If we try to redirect kernel-generated messages to containers, we have several problems, including whether we need to duplicate the messages to the host container. So in one sense it seems more flexible to
1. send everything to host syslog

Quoted 7 lines

No, if we do that all CONTs message will reach the same bucket and it will be difficult to sort them out..
CONT sys_admin and HOST sys_admin could be different "entity", so you debug CONT config and critical
needed information reach HOST (which you do not have access
to).

Yes, so a privileged task on HOST must pass that information back to you on CONT. That is not a valid complaint imo. But how to sort the msgs out is a valid question.

We need some sort of identifier, unique system-wide, attached to.. something. Is ifindex unique system-wide right now? Oh, IIRC it is, but we wnat it to be containerized, so that would be a bad choice :)

Quoted 2 lines
Quoted 1 line

2. clamp down on syslog use by processes not in the init_user_ns

Could give me more detail??...

Simplest choices would be to just refuse sys_syslog() and open(/proc/kmsg) altogether from a container, or to only allow reading/writing messages to own syslog. (I had hoped to find time to try out the second option but simply haven't had the time, and it doesn't look like I will very soon. So if anyone else wants to, pls jump at it...)

Quoted 10 lines

Then /proc/kmsg can provide what I described above through a FUSE file, and if, as you mentioned, the container unmounts the FUSE fs and gets to real procfs, they just get nothing.

Quoted 6 lines
Quoted 2 lines

3. let the userspace on the host copy messages into a socket or file so child container can pretend it has real syslog.

So you trap printk message from CONT on the HOST and redirect them on CONT but on a standard syslog channel. Seem OK to me, as long /proc/kmsg is not existing (/dev/null) in the CONT file tree.

We have:
* Commands to sys_syslog:
*
* 0 -- Close the log. Currently a NOP.
* 1 -- Open the log. Currently a NOP.
* 2 -- Read from the log.
* 3 -- Read all messages remaining in the ring buffer.
* 4 -- Read and clear all messages remaining in the ring buffer
* 5 -- Clear ring buffer.
* 6 -- Disable printk to console
* 7 -- Enable printk to console
* 8 -- Set level of messages printed to console
* 9 -- Return number of unread characters in the log buffer
* 10 -- Return size of the log buffer

And add:
* 11 -- create a new ring buffer for the current process
and its childs

We have, let's say a global ring buffer keep untouched, used by syslog(2) and printk. When we create a new ring buffer, we allocate it and assign to the nsproxy (global ring buffer is the default in the nsproxy).

Quoted 4 lines

The prink keeps writing in the global ring buffer and the syslog(2) writes to the "namespaced" ring buffer.

Does it makes sense ?

Yeah, it's a nice alternative. Though (1) there is something to be said for forcing a new ring buffer upon clone(CLONE_NEWUSER), and (2) assuming the new ring buffer is pointed to from nsproxy, it might be frowned upon to do an unshare/clone action in yet another way.

I still think our first concern should be safety, and that we should consider just adding 'struct syslog_struct' to nsproxy, and making that NULL on a clone(CLONE_NEWUSER). any sys_syslog() or /proc/kmsg access returns -EINVAL after that. Then we can discuss whether and how to target printks to namespaces, and whether duplicates should be sent to parent namespaces.

After we start getting flexible with syslog, the next request will be for audit flexibility. I don't even know how our netlink support suffices for that right now.

(So, this all does turn into a big deal...)

-serge

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com

#16 lore raw
In reply to a message not in the archive

Hello,

[...]

Quoted 11 lines
Quoted 5 lines

The prink keeps writing in the global ring buffer and the syslog(2) writes to the "namespaced" ring buffer.

Does it makes sense ?

Yeah, it's a nice alternative. Though (1) there is something to be said for forcing a new ring buffer upon clone(CLONE_NEWUSER), and (2) assuming the new ring buffer is pointed to from nsproxy, it might be frowned upon to do an unshare/clone action in yet another way.

Quoted 5 lines

I still think our first concern should be safety, and that we should consider just adding 'struct syslog_struct' to nsproxy, and making that NULL on a clone(CLONE_NEWUSER). any sys_syslog() or /proc/kmsg access returns -EINVAL after that. Then we can discuss whether and how to target printks to namespaces, and whether duplicates should be sent to parent namespaces.

/proc/kmsg=-EINVAL will resolve the own HOST: ring buffer corruption not sure what sys_syslog()=-EINVAL mean???, rsyslog MUST be able to run within CONT: right?

printk namespaces duplicate and sent to parent namespace
is not a good idea (duplicating&forwarding is done by tools as rsyslogd).

Quoted 8 lines

After we start getting flexible with syslog, the next request will be for audit flexibility. I don't even know how our netlink support suffices for that right now.

(So, this all does turn into a big deal...)

-serge

Signature · 20 lines
A bientôt
==========================================================================
Jean-Marc Pigeon                                   Internet: [email protected]
SAFE Inc.                                          Phone: (514) 493-4280
                                                   Fax:   (514) 493-1946
        Clement, 'a kiss solution' to get rid of SPAM (at last)
           Clement' Home base <"http://www.clement.safe.ca">
==========================================================================


------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation
Stay online with enterprise data centers and the best network in the business
Choose flexible plans and management services without long-term contracts
Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com
_______________________________________________
Lxc-users mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/lxc-users
#18 lore raw
In reply to a message not in the archive
Quoted 19 lines · Jean-Marc Pigeon

Hello,

[...]

Quoted 11 lines
Quoted 5 lines

The prink keeps writing in the global ring buffer and the syslog(2) writes to the "namespaced" ring buffer.

Does it makes sense ?

Yeah, it's a nice alternative. Though (1) there is something to be said for forcing a new ring buffer upon clone(CLONE_NEWUSER), and (2) assuming the new ring buffer is pointed to from nsproxy, it might be frowned upon to do an unshare/clone action in yet another way.

Quoted 5 lines

I still think our first concern should be safety, and that we should consider just adding 'struct syslog_struct' to nsproxy, and making that NULL on a clone(CLONE_NEWUSER). any sys_syslog() or /proc/kmsg access returns -EINVAL after that. Then we can discuss whether and how to target printks to namespaces, and whether duplicates should be sent to parent namespaces.

Quoted 6 lines

/proc/kmsg=-EINVAL will resolve the own HOST: ring buffer corruption not sure what sys_syslog()=-EINVAL mean???, rsyslog MUST be able to run within CONT: right?

printk namespaces duplicate and sent to parent namespace
is not a good idea (duplicating&forwarding is done by tools as rsyslogd).

Heh, agreed, I just disagree that we should trust CONT to fwd stuff to HOST, rather we should have HOST fwd stuff to CONT.

It comes down to whether HOST might need the info to determine what CONT or someone attacking CONT is up to. To the extend that HOST will never be fully safe from CONT (and if you think it is, even using kvm/vmware, then you you're deluding yourself) I think it's misguided to keep information from HOST.

Quoted 4 lines
Quoted 4 lines

After we start getting flexible with syslog, the next request will be for audit flexibility. I don't even know how our netlink support suffices for that right now.

Quoted 12 lines
Quoted 3 lines

(So, this all does turn into a big deal...)

-serge

Signature · 8 lines
A bientôt
==========================================================================
Jean-Marc Pigeon                                   Internet: [email protected]
SAFE Inc.                                          Phone: (514) 493-4280
                                                   Fax:   (514) 493-1946
        Clement, 'a kiss solution' to get rid of SPAM (at last)
           Clement' Home base <"http://www.clement.safe.ca">
==========================================================================

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com

#19 lore raw
In reply to a message not in the archive
Quoted 85 lines · Serge E. Hallyn
Quoted 83 lines · Daniel Lezcano
Quoted 40 lines · Serge E. Hallyn
Quoted 11 lines · Jean-Marc Pigeon

Hello,

Quoted 7 lines

I was wondering out loud about the best design to solve his problem.

If we try to redirect kernel-generated messages to containers, we have several problems, including whether we need to duplicate the messages to the host container. So in one sense it seems more flexible to
1. send everything to host syslog

Quoted 8 lines

No, if we do that all CONTs message will reach the same bucket and it will be difficult to sort them out..
CONT sys_admin and HOST sys_admin could be different "entity", so you debug CONT config and critical
needed information reach HOST (which you do not have access
to).

Yes, so a privileged task on HOST must pass that information back to you on CONT. That is not a valid complaint imo. But how to sort the msgs out is a valid question.

We need some sort of identifier, unique system-wide, attached to.. something. Is ifindex unique system-wide right now? Oh, IIRC it is, but we wnat it to be containerized, so that would be a bad choice :)

Quoted 4 lines
Quoted 2 lines

2. clamp down on syslog use by processes not in the init_user_ns

Could give me more detail??...

Simplest choices would be to just refuse sys_syslog() and open(/proc/kmsg) altogether from a container, or to only allow reading/writing messages to own syslog. (I had hoped to find time to try out the second option but simply haven't had the time, and it doesn't look like I will very soon. So if anyone else wants to, pls jump at it...)

Quoted 13 lines

Then /proc/kmsg can provide what I described above through a FUSE file, and if, as you mentioned, the container unmounts the FUSE fs and gets to real procfs, they just get nothing.

Quoted 8 lines
Quoted 3 lines

3. let the userspace on the host copy messages into a socket or file so child container can pretend it has real syslog.

So you trap printk message from CONT on the HOST and redirect them on CONT but on a standard syslog channel. Seem OK to me, as long /proc/kmsg is not existing (/dev/null) in the CONT file tree.

We have:
* Commands to sys_syslog:
*
* 0 -- Close the log. Currently a NOP.
* 1 -- Open the log. Currently a NOP.
* 2 -- Read from the log.
* 3 -- Read all messages remaining in the ring buffer.
* 4 -- Read and clear all messages remaining in the ring buffer
* 5 -- Clear ring buffer.
* 6 -- Disable printk to console
* 7 -- Enable printk to console
* 8 -- Set level of messages printed to console
* 9 -- Return number of unread characters in the log buffer
* 10 -- Return size of the log buffer

And add:
* 11 -- create a new ring buffer for the current process
and its childs

We have, let's say a global ring buffer keep untouched, used by syslog(2) and printk. When we create a new ring buffer, we allocate it and assign to the nsproxy (global ring buffer is the default in the nsproxy).

The prink keeps writing in the global ring buffer and the syslog(2) writes to the "namespaced" ring buffer.

Quoted 8 lines
Quoted 2 lines

Does it makes sense ?

Yeah, it's a nice alternative. Though (1) there is something to be said for forcing a new ring buffer upon clone(CLONE_NEWUSER), and (2) assuming the new ring buffer is pointed to from nsproxy, it might be frowned upon to do an unshare/clone action in yet another way.

Why do you want to tie clone(CLONE_NEWUSER) with a new ring buffer ? I mean one may want to use CLONE_NEWUSER but keep the ring buffer, no ?

Quoted 6 lines

I still think our first concern should be safety, and that we should consider just adding 'struct syslog_struct' to nsproxy, and making that NULL on a clone(CLONE_NEWUSER). any sys_syslog() or /proc/kmsg access returns -EINVAL after that. Then we can discuss whether and how to target printks to namespaces, and whether duplicates should be sent to parent namespaces.

That makes sense to do it step by step. Targeting the printk is the more difficult, no ? I mean you should have always the destination namespace available which is not obvious when the printk is called from an interrupt context.

Quoted 6 lines

After we start getting flexible with syslog, the next request will be for audit flexibility. I don't even know how our netlink support suffices for that right now.

(So, this all does turn into a big deal...)

Mmh ... right.

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com

#21 lore raw
In reply to a message not in the archive
Quoted 76 lines · Daniel Lezcano
Quoted 75 lines · Serge E. Hallyn
Quoted 73 lines · Daniel Lezcano
Quoted 33 lines · Serge E. Hallyn
Quoted 9 lines · Jean-Marc Pigeon

Hello,

Quoted 6 lines

I was wondering out loud about the best design to solve his problem.

If we try to redirect kernel-generated messages to containers, we have several problems, including whether we need to duplicate the messages to the host container. So in one sense it seems more flexible to
1. send everything to host syslog

Quoted 7 lines

No, if we do that all CONTs message will reach the same bucket and it will be difficult to sort them out..
CONT sys_admin and HOST sys_admin could be different "entity", so you debug CONT config and critical
needed information reach HOST (which you do not have access
to).

Yes, so a privileged task on HOST must pass that information back to you on CONT. That is not a valid complaint imo. But how to sort the msgs out is a valid question.

We need some sort of identifier, unique system-wide, attached to.. something. Is ifindex unique system-wide right now? Oh, IIRC it is, but we wnat it to be containerized, so that would be a bad choice :)

Quoted 2 lines
Quoted 1 line

2. clamp down on syslog use by processes not in the init_user_ns

Could give me more detail??...

Simplest choices would be to just refuse sys_syslog() and open(/proc/kmsg) altogether from a container, or to only allow reading/writing messages to own syslog. (I had hoped to find time to try out the second option but simply haven't had the time, and it doesn't look like I will very soon. So if anyone else wants to, pls jump at it...)

Quoted 10 lines

Then /proc/kmsg can provide what I described above through a FUSE file, and if, as you mentioned, the container unmounts the FUSE fs and gets to real procfs, they just get nothing.

Quoted 6 lines
Quoted 2 lines

3. let the userspace on the host copy messages into a socket or file so child container can pretend it has real syslog.

So you trap printk message from CONT on the HOST and redirect them on CONT but on a standard syslog channel. Seem OK to me, as long /proc/kmsg is not existing (/dev/null) in the CONT file tree.

We have:
* Commands to sys_syslog:
*
* 0 -- Close the log. Currently a NOP.
* 1 -- Open the log. Currently a NOP.
* 2 -- Read from the log.
* 3 -- Read all messages remaining in the ring buffer.
* 4 -- Read and clear all messages remaining in the ring buffer
* 5 -- Clear ring buffer.
* 6 -- Disable printk to console
* 7 -- Enable printk to console
* 8 -- Set level of messages printed to console
* 9 -- Return number of unread characters in the log buffer
* 10 -- Return size of the log buffer

And add:
* 11 -- create a new ring buffer for the current process
and its childs

We have, let's say a global ring buffer keep untouched, used by syslog(2) and printk. When we create a new ring buffer, we allocate it and assign to the nsproxy (global ring buffer is the default in the nsproxy).

The prink keeps writing in the global ring buffer and the syslog(2) writes to the "namespaced" ring buffer.

Does it makes sense ?

Quoted 7 lines
Quoted 4 lines

Yeah, it's a nice alternative. Though (1) there is something to be said for forcing a new ring buffer upon clone(CLONE_NEWUSER), and (2) assuming the new ring buffer is pointed to from nsproxy, it might be frowned upon to do an unshare/clone action in yet another way.

Why do you want to tie clone(CLONE_NEWUSER) with a new ring buffer ? I mean one may want to use CLONE_NEWUSER but keep the ring buffer, no ?

Hmm, well yesterday I was thinking no, but I guess you're right. I may be wanting to remap userids and not contain root.

I still like your syslog command 11, but assuming we want to keep the syslog_ns on nsproxy, I think we really need to stick to clone/unshare. So if we want to add a CLONE_SYSLOG flag, we have to wait until eclone gets us more clone flags :) Or, pull out the eclone patchset from linux-cr and make it prereq for this.

Quoted 16 lines
Quoted 5 lines

I still think our first concern should be safety, and that we should consider just adding 'struct syslog_struct' to nsproxy, and making that NULL on a clone(CLONE_NEWUSER). any sys_syslog() or /proc/kmsg access returns -EINVAL after that. Then we can discuss whether and how to target printks to namespaces, and whether duplicates should be sent to parent namespaces.

That makes sense to do it step by step. Targeting the printk is the more difficult, no ? I mean you should have always the destination namespace available which is not obvious when the printk is called from an interrupt context.

Quoted 5 lines

After we start getting flexible with syslog, the next request will be for audit flexibility. I don't even know how our netlink support suffices for that right now.

(So, this all does turn into a big deal...)

Mmh ... right.

#23 lore raw
In reply to a message not in the archive
Quoted 2 lines · Serge E. Hallyn

I still like your syslog command 11, but assuming we want to keep the syslog_ns on nsproxy, I think we really need to stick to clone/unshare.

Yes. let's keep the namespace creation API consistent. this is complex enough.

C.

------------------------------------------------------------------------------
The Planet: dedicated and managed hosting, cloud storage, colocation Stay online with enterprise data centers and the best network in the business Choose flexible plans and management services without long-term contracts Personal 24x7 support from experience hosting pros just a phone call away.
http://p.sf.net/sfu/theplanet-com