[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20120309125735.GB13346@moon>
Date: Fri, 9 Mar 2012 16:57:35 +0400
From: Cyrill Gorcunov <gorcunov@...nvz.org>
To: Oleg Nesterov <oleg@...hat.com>
Cc: Matt Helsley <matthltc@...ibm.com>,
KOSAKI Motohiro <kosaki.motohiro@...fujitsu.com>,
Pavel Emelyanov <xemul@...allels.com>,
Kees Cook <keescook@...omium.org>, Tejun Heo <tj@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RFC] c/r: prctl: Add ability to set new mm_struct::exe_file v3
On Fri, Mar 09, 2012 at 01:48:11PM +0100, Oleg Nesterov wrote:
...
> > +
> > + /*
> > + * Setting new mm::exe_file is only allowed
> > + * when no executable VMAs left. This is
> ^^^^^^^^^^
> Perhaps this is just me, but imho "executable" is not clear enough.
> I'd suggest VM_EXECUTABLE to avoid the confusion with VM_EXEC.
OK
>
> > + * special C/R case when a restored program
> > + * need to change own /proc/$pid/exe symlink.
> > + * After this call mm::num_exe_file_vmas become
> > + * meaningless.
> > + */
> > + down_write(&mm->mmap_sem);
> > + if (mm->num_exe_file_vmas == 0) {
>
> You can check this at the very start lockless and simplify the code.
> Once it is zero, it can never grow (or we have a bug anyway).
sure
>
> > + set_mm_exe_file(mm, exe_file);
> > + exe_file = NULL;
> > + } else
> > + err = -EBUSY;
> > + up_write(&mm->mmap_sem);
> > +
> > +exit:
> > + if (exe_file)
> > + fput(exe_file);
>
> This doesn't look correct, you need fput() in any case.
> set_mm_exe_file() does another get_file().
yeah, thanks, will update.
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