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

From: Cyrill Gorcunov
Date: Mon Mar 05 2012 - 09:46:52 EST


On Mon, Mar 05, 2012 at 03:26:55PM +0100, Oleg Nesterov wrote:
> > OK, I won't argue, probably this makes sense to make sure that
> > admin can't get a heart attack looking at /proc/pid/exe.
> >
> > But the O_RDONLY check looks strange. We are not going to write
> > to this file, we only set the name (and that is why I think it
> > should be mm->exe_path). What is the point to check that the file
> > was opened without FMODE_WRITE? Even if there were any security
> > risk the apllication can open this file again with the different
> > flags.
>

Hi Oleg!

Replying to both your email -- I wanted to be as close to open_exec
as possible. This prctl does cheat the kernel but with this tests
the cheating should be minimized (it's almost the same as open_exec
does).

> Seriously, I think we should cleanup this before c/r adds more
> ugliness. I'll try to make the patch today.
>

Cleanup what? If you mean this patch -- just point me what
should I do.

> And with all these checks I am no longer sure that fd is better
> than filename ;)

This security tests was a reason why I've used open_exec in
first version of the patch (and I still would prefer to
have open_exec here instead of fd).

As to allow-write-access -- it should be cleaned once process
finished, no?

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/