From: Andrew Morton <akpm@linux-foundation.org>
To: Cyrill Gorcunov <gorcunov@openvz.org>
Cc: linux-kernel@vger.kernel.org,
Pavel Emelyanov <xemul@parallels.com>,
Serge Hallyn <serge.hallyn@canonical.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@jp.fujitsu.com>,
Kees Cook <keescook@chromium.org>, Tejun Heo <tj@kernel.org>,
Andrew Vagin <avagin@openvz.org>,
"Eric W. Biederman" <ebiederm@xmission.com>,
Alexey Dobriyan <adobriyan@gmail.com>,
Andi Kleen <andi@firstfloor.org>,
Michael Kerrisk <mtk.manpages@gmail.com>,
Vasiliy Kulikov <segoon@openwall.com>
Subject: Re: [patch cr 4/4] c/r: prctl: Extend PR_SET_MM to set up more mm_struct entries
Date: Thu, 2 Feb 2012 15:27:05 -0800 [thread overview]
Message-ID: <20120202152705.831b00c7.akpm@linux-foundation.org> (raw)
In-Reply-To: <20120130141852.466613862@openvz.org>
On Mon, 30 Jan 2012 18:09:09 +0400
Cyrill Gorcunov <gorcunov@openvz.org> wrote:
> After restore we would like the 'ps' command show the command
> line and evironment exactly the same it was at checkpoint time.
>
> So this additional PR_SET_MM_ allow us to do so. Note that
> these members of mm_struct is rather used for output in
> procfs, except auxv vector which is used by ld.so mostly.
This changelog is pretty darned hard to understand. Can we have a
version 2 please?
>
> ...
>
> @@ -1753,19 +1755,6 @@ static int prctl_set_mm(int opt, unsigne
> mm->end_data = addr;
> break;
>
> - case PR_SET_MM_START_STACK:
> -
> -#ifdef CONFIG_STACK_GROWSUP
> - vm_req_flags = VM_READ | VM_WRITE | VM_GROWSUP;
> -#else
> - vm_req_flags = VM_READ | VM_WRITE | VM_GROWSDOWN;
> -#endif
> - if ((vma->vm_flags & vm_req_flags) != vm_req_flags)
> - goto out;
> -
> - mm->start_stack = addr;
> - break;
> -
> case PR_SET_MM_START_BRK:
> if (addr <= mm->end_data)
> goto out;
> @@ -1790,16 +1779,53 @@ static int prctl_set_mm(int opt, unsigne
> mm->brk = addr;
> break;
Here would be a good place to add some nice comments explaining what
these do. Although I guess that isn't needed if one can get that info
by typing "man prctl".
> + case PR_SET_MM_START_STACK:
> + case PR_SET_MM_ARG_START:
> + case PR_SET_MM_ARG_END:
> + case PR_SET_MM_ENV_START:
> + case PR_SET_MM_ENV_END:
> +#ifdef CONFIG_STACK_GROWSUP
> + if (vma_flags_mismatch(vma, VM_READ | VM_WRITE | VM_GROWSUP, 0))
> +#else
> + if (vma_flags_mismatch(vma, VM_READ | VM_WRITE | VM_GROWSDOWN, 0))
> +#endif
> + goto out;
> + if (opt == PR_SET_MM_START_STACK)
> + mm->start_stack = addr;
> + else if (opt == PR_SET_MM_ARG_START)
> + mm->arg_start = addr;
> + else if (opt == PR_SET_MM_ARG_END)
> + mm->arg_end = addr;
> + else if (opt == PR_SET_MM_ENV_START)
> + mm->env_start = addr;
> + else if (opt == PR_SET_MM_ENV_END)
> + mm->env_end = addr;
> + break;
> +
> + case PR_SET_MM_AUXV: {
> + unsigned long user_auxv[AT_VECTOR_SIZE];
> +
> + if (arg4 > sizeof(mm->saved_auxv))
> + goto out;
> + up_read(&mm->mmap_sem);
> +
> + if (copy_from_user(user_auxv, (const void __user *)addr, arg4))
> + return EFAULT;
> +
> + task_lock(current);
> + memcpy(mm->saved_auxv, user_auxv, arg4);
> + task_unlock(current);
> +
> + return 0;
> + }
I worry a bit about this. We're giving userspace the ability to modify
various mm_struct fields. Userspace can already do this via
exec(elf-file), but perhaps this opens up a way in which userspace can
newly trigger kernel bugs.
next prev parent reply other threads:[~2012-02-02 23:27 UTC|newest]
Thread overview: 65+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-01-30 14:09 [patch cr 0/4] [patch cr 0/@total@] Cyrill Gorcunov
2012-01-30 14:09 ` [patch cr 1/4] fs, proc: Introduce /proc/<pid>/task/<tid>/children entry v9 Cyrill Gorcunov
2012-01-30 14:09 ` [patch cr 2/4] [RFC] syscalls, x86: Add __NR_kcmp syscall v7 Cyrill Gorcunov
2012-01-30 19:58 ` Jonathan Corbet
2012-01-30 21:07 ` Cyrill Gorcunov
2012-01-30 21:11 ` H. Peter Anvin
2012-02-02 23:26 ` Andrew Morton
2012-02-03 2:27 ` H. Peter Anvin
2012-02-03 7:09 ` Cyrill Gorcunov
2012-02-03 7:46 ` Ingo Molnar
2012-02-03 8:35 ` Cyrill Gorcunov
2012-02-03 9:09 ` Ingo Molnar
2012-02-03 9:22 ` Andrew Morton
2012-02-03 9:28 ` Cyrill Gorcunov
2012-02-03 17:32 ` H. Peter Anvin
2012-02-03 17:35 ` H. Peter Anvin
2012-02-03 17:42 ` Cyrill Gorcunov
2012-02-03 9:52 ` Ingo Molnar
2012-02-03 10:07 ` [PATCH] SubmittingPatches: Increase the line length limit from 80 to 100 colums Ingo Molnar
2012-02-03 10:17 ` Pekka Enberg
2012-02-03 10:23 ` Cyrill Gorcunov
2012-02-03 10:40 ` Alexey Dobriyan
2012-02-03 16:13 ` Tejun Heo
2012-02-03 16:39 ` hpanvin@gmail.com
2012-02-03 17:56 ` Andi Kleen
2012-02-03 20:57 ` Andrew Morton
2012-02-03 21:00 ` H. Peter Anvin
2012-02-03 21:06 ` H. Peter Anvin
2012-02-04 13:08 ` Ingo Molnar
2012-02-03 21:27 ` Linus Torvalds
2012-02-03 23:20 ` [PATCH] checkpatch: Warn on code with 6+ tab indentation Joe Perches
2012-02-04 1:27 ` Linus Torvalds
2012-02-04 1:33 ` Joe Perches
2012-02-04 3:09 ` Linus Torvalds
2012-02-04 3:21 ` Joe Perches
2012-02-04 3:35 ` Linus Torvalds
2012-02-04 3:58 ` Joe Perches
2012-02-04 1:37 ` Andrew Morton
2012-02-04 2:40 ` Eric W. Biederman
2012-02-04 2:46 ` Joe Perches
2012-02-04 4:45 ` Tony Luck
2012-02-04 4:53 ` Joe Perches
2012-02-04 13:03 ` [PATCH, v2] checkpatch: Warn on code with 6+ tab indentation, remove 80col warning Ingo Molnar
2012-02-04 16:22 ` Joe Perches
2012-02-04 18:02 ` Ingo Molnar
2012-02-04 18:48 ` Joe Perches
2012-02-04 18:54 ` Pekka Enberg
2012-02-04 19:27 ` Joe Perches
2012-02-04 19:32 ` Pekka Enberg
2012-02-05 11:38 ` Ingo Molnar
2012-02-05 16:21 ` Joe Perches
2012-02-05 18:13 ` Ingo Molnar
2012-02-05 19:01 ` [PATCH] checkpatch: Add line-length options, set default to 100 Joe Perches
2012-02-06 12:36 ` Dan Carpenter
2012-02-04 1:24 ` [PATCH] SubmittingPatches: Increase the line length limit from 80 to 100 colums Randy Dunlap
2012-02-09 21:55 ` Jan Engelhardt
2012-02-09 22:09 ` Joe Perches
2012-02-09 22:30 ` Mark Brown
2012-01-30 14:09 ` [patch cr 3/4] c/r: procfs: add arg_start/end, env_start/end and exit_code members to /proc/$pid/stat Cyrill Gorcunov
2012-02-02 23:26 ` Andrew Morton
2012-02-03 7:11 ` Cyrill Gorcunov
2012-01-30 14:09 ` [patch cr 4/4] c/r: prctl: Extend PR_SET_MM to set up more mm_struct entries Cyrill Gorcunov
2012-02-02 23:27 ` Andrew Morton [this message]
2012-02-03 7:18 ` Cyrill Gorcunov
2012-02-02 23:26 ` [patch cr 0/4] [patch cr 0/@total@] Andrew Morton
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=20120202152705.831b00c7.akpm@linux-foundation.org \
--to=akpm@linux-foundation.org \
--cc=adobriyan@gmail.com \
--cc=andi@firstfloor.org \
--cc=avagin@openvz.org \
--cc=ebiederm@xmission.com \
--cc=gorcunov@openvz.org \
--cc=kamezawa.hiroyu@jp.fujitsu.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mtk.manpages@gmail.com \
--cc=segoon@openwall.com \
--cc=serge.hallyn@canonical.com \
--cc=tj@kernel.org \
--cc=xemul@parallels.com \
/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
Powered by JetHome