[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20111208070724.GW21678@moon>
Date: Thu, 8 Dec 2011 11:07:24 +0400
From: Cyrill Gorcunov <gorcunov@...il.com>
To: Andrew Morton <akpm@...ux-foundation.org>
Cc: Kees Cook <keescook@...omium.org>, linux-kernel@...r.kernel.org,
Tejun Heo <tj@...nel.org>, Andrew Vagin <avagin@...nvz.org>,
Serge Hallyn <serge.hallyn@...onical.com>,
Pavel Emelyanov <xemul@...allels.com>,
Vasiliy Kulikov <segoon@...nwall.com>,
KAMEZAWA Hiroyuki <kamezawa.hiroyu@...fujitsu.com>,
Michael Kerrisk <mtk.manpages@...il.com>
Subject: Re: [rfc 3/3] prctl: Add PR_SET_MM codes to tune up mm_struct entires
On Wed, Dec 07, 2011 at 02:43:55PM -0800, Andrew Morton wrote:
> On Wed, 7 Dec 2011 16:27:18 +0400
> Cyrill Gorcunov <gorcunov@...il.com> wrote:
>
> > At process of task restoration we need a way to tune up
> > a few members of mm_struct structure such as start_code,
> > end_code, start_data, end_data, start_stack, start_brk, brk.
>
> I don't really know what "tune up" means in this context. Can we
> please be more specific and detailed here? It appears that the patch
> permits userspace to directly modify these fields.
>
ok
>
> The prctl(2) manpage will need to be updated. Please Cc Michael on all
> such changes.
>
you mean -- Michael Kerrisk, mtk AT man7.org, right?
...
> > +
> > + mm = get_task_mm(current);
>
> Is it necessaary to run the expensive get_task_mm() for `current'?
> `current' is known to be running and you have control of it here -
> nobody will be taking our mm away. Simply use current->mm? The
> function actually uses current->mm later on in several places.
hmm, indeed, i'll update, thanks!
>
> > + if (!mm)
> > + return -ENOENT;
> > +
> > + down_read(&mm->mmap_sem);
> > + vma = find_vma(mm, addr);
> > +
> > + if (opt != PR_SET_MM_START_BRK &&
> > + opt != PR_SET_MM_BRK) {
>
> 80 columns, not 40 :)
>
> > + /* It must be existing VMA */
> > + if (!vma || vma->vm_start > addr)
> > + goto out;
> > + }
> > +
> > + error = -EINVAL;
> > + switch (opt) {
> > + case PR_SET_MM_START_CODE:
> > + case PR_SET_MM_END_CODE:
> > +
>
> You're adding unneeded and unconventional newlines after the `case'
> statements.
>
no, I added them by a purpose -- it's a way easier to read these
assignments, but fine -- I'll drop this nits.
>
> This is starting to add a non-trivial amount of code. Perhaps we need
> to introduce a Kconfig variable to control such things as this, to
> prevent bloating up kernels which aren't require to support c/r?
>
Dunno, Andrew. Actually I agreed that these snippets are mostly
needed for c/r only, but the initial idea over all changes was
to add levers into kernel which might be helpful not only
for c/r but for someone else as well.
Cyrill
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists