From: Serge Hallyn <serge.hallyn-Z7WLFzj8eWMS+FvcfC7Uqw@public.gmane.org>
To: Gao feng <gaofeng-BthXqXjhjHXQFUHtdCDX3A@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: Fri, 13 Apr 2012 08:27:33 -0500 [thread overview]
Message-ID: <20120413132733.GA3411@sergelap> (raw)
In-Reply-To: <4F87CA46.708-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org>
Quoting Gao feng (gaofeng-BthXqXjhjHXQFUHtdCDX3A@public.gmane.org):
> 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.
> 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-cunTk1MwBs9QetFLy7KEm3xJsTq8ys+cHZ5vskTnxNA@public.gmane.org
> https://lists.linuxfoundation.org/mailman/listinfo/containers
next prev parent reply other threads:[~2012-04-13 13:27 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 [this message]
2012-04-17 0:39 ` Gao feng
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=20120413132733.GA3411@sergelap \
--to=serge.hallyn-z7wlfzj8ewms+fvcfc7uqw@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=gaofeng-BthXqXjhjHXQFUHtdCDX3A@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