Linux Container Development
 help / color / mirror / Atom feed
From: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
To: Serge Hallyn <serge.hallyn-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
Cc: containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org,
	dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org,
	ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org
Subject: Re: problem with /proc/sysrq-trigger
Date: Tue, 17 Apr 2012 08:39:47 +0800	[thread overview]
Message-ID: <4F8CBBD3.5050009@cn.fujitsu.com> (raw)
In-Reply-To: <20120413132733.GA3411@sergelap>

于 2012年04月13日 21:27, Serge Hallyn 写道:
> Quoting Gao feng (gaofeng@cn.fujitsu.com):
>> Hi all
>>
>> when I using the container, I found the /proc/sysrq-trigger is not isolated with the host.
>> when exec echo c > /proc/sysrq-trigger in the container,
>> the host will crash too.
>>
>> I don't know if it's correct.
>> And if it's incorrect,can I fix this by just like this?
> 
> Certainly the fix wouldn't be right - the nsproxy is not the right thing
> to validate.  It might make more sense to tie it to the pid namespace or,
> when it pops into existence, the device namespace.  Device ns makes sense
> as you can see the host as a device, and pidns makes sense since if you're
> in a child pidns, you can't safely make assumptions about killing all
> tasks.
> 
> In Ubuntu 12.04+, the apparmor profile simply refuses this write from
> containers.  I'll soon need to generalize the support for that in lxc
> so you can do the same with selinux and smack.

Hi Serge

I get it,thank you very much!

> 
>> diff --git a/drivers/tty/sysrq.c b/drivers/tty/sysrq.c
>> index 05728894..da4d812 100644
>> --- a/drivers/tty/sysrq.c
>> +++ b/drivers/tty/sysrq.c
>> @@ -865,6 +865,10 @@ EXPORT_SYMBOL(unregister_sysrq_key);
>>  static ssize_t write_sysrq_trigger(struct file *file, const char __user *buf,
>>                                    size_t count, loff_t *ppos)
>>  {
>> +       if (current->nsproxy != &init_nsproxy)
>> +               return -EFAULT;
>>
>>         if (count) {
>>                 char c;
>> _______________________________________________
>> Containers mailing list
>> Containers@lists.linux-foundation.org
>> https://lists.linuxfoundation.org/mailman/listinfo/containers
> 

_______________________________________________
Containers mailing list
Containers@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/containers

      reply	other threads:[~2012-04-17  0:39 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-04-13  6:40 problem with /proc/sysrq-trigger Gao feng
     [not found] ` <4F87CA46.708-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
2012-04-13 13:27   ` Serge Hallyn
2012-04-17  0:39     ` Gao feng [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=4F8CBBD3.5050009@cn.fujitsu.com \
    --to=gaofeng-bthxqxjhjhxqfuhtdcdx3a@public.gmane.org \
    --cc=containers-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org \
    --cc=dlezcano-NmTC/0ZBporQT0dZR+AlfA@public.gmane.org \
    --cc=ebiederm-aS9lmoZGLiVWk0Htik3J/w@public.gmane.org \
    --cc=serge.hallyn-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox