Re: [kernel-hardening] [PATCH] move RLIMIT_NPROC check fromset_user() to do_execve_common()

From: NeilBrown
Date: Tue Jul 26 2011 - 00:11:56 EST


On Tue, 26 Jul 2011 05:16:29 +0400 Solar Designer <solar@xxxxxxxxxxxx> wrote:


> > Let me try another suggestion. Instead of catching the error in
> > do_execve_common, how about we catch it in do_mmap_pgoff.
> > i.e. if the flag is set and an attempt it made to create an executable
> > mapping, we check the user->processes against the limit then - either failing
> > or clearing the flag and succeeding.
> >
> > This will stop an execve, and an attempt to load a shared library and call it.
>
> This sounds too hackish to me, although if others are (unexpectedly) OK
> with it, I don't mind.

Thanks ... I think :-)

I don't really see that failing mmap is any more hackish than failing execve.

Both are certainly hacks. It is setuid that should fail, but that is
problematic.

We seem to agree that it is acceptable to delay the failure until the process
actually tries to run some code for the user. I just think that
mapping-a-file-for-exec is a more direct measure of "trying to run some code
for the user" than "execve" is.

So they are both hacks, but one it more thorough than the other. In the
world of security I would hope that "thorough" would win.

NeilBrown

--
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/