Re: [RFC] c/r: prctl: Add ability to set new mm_struct::exe_file v3

From: Cyrill Gorcunov
Date: Fri Mar 09 2012 - 16:52:20 EST


On Fri, Mar 09, 2012 at 01:46:37PM -0800, Matt Helsley wrote:
> > >
> > > I simply do not understand what mm->num_exe_file_vmas means after
> > > PR_SET_MM_EXE_FILE.
>
> I think it should fail if the num_exe_file_vmas is not 0 when
> PR_SET_MM_EXE_FILE is used. It's simple, keeps things clear, might
> catch userspace bugs (harder to accidentally leave a mapping of the original
> executable), and could avoid kernel bugs too.

Yes, and in last version (whuch I just sent out) we have at the very beginning
of the function

+ if (mm->num_exe_file_vmas)
+ return -EBUSY;

> >
> > Wait, Oleg, I'm confused, in case if there *is* exitsting VM_EXECUTABLEs
> > then we jump into first banch and simply replace old exe_file.
>
> What happens if multiple prctl calls are made? We'll have a mix of N
> executable files that've been mapped n_i times. I think we're better off
> just returning an error in that case -- -EBUSY or something.
>
> > If there is no VM_EXECUTABLEs, then we simply setup new exe_file
> > and num_exe_file_vmas remains zero.
>
> Which is fine.
>

Matt, please check the last version, and tell me if it's fine for you.

Cyrill
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/