Re: [patch] honour MNT_NOEXEC for access()
From: Jeremy Fitzhardinge
Date: Sun Oct 08 2006 - 05:56:57 EST
Stas Sergeev wrote:
Not really. If you want to do something along those lines it would
be better to add a new open flag called something like O_RDEXONLY
which would require r-x effective file permissions, and allow
PROT_READ|PROT_EXEC mmaps (though for that to be really useful, you'd
need to make an O_RDONLY fd not allow PROT_EXEC mmaps, which would
break a few things).
It will break _many_ things - my intention is to find a
solution for ld.so that won't break things at all.
Yeah, sorry about that. I was using ironic understatement, but it's not
something that comes across well in email.
But your idea about playing with the flags is interesting.
What if the currently-unused MAP_EXECUTABLE flag became a
way for the program to express that it needs an exec perm,
and so the mmap should fail if there is none? I think ld.so
will be happy using such a flag...
Yes, but it doesn't solve the fact that there isn't really anything
special about ld.so, so putting special checks into it doesn't really
solve the overall problem.
Also, I guess there's the general question of what the noexec mount flag
really means? Does it mean "make the execve syscall fail", or does it
mean "no bits on this filesystem may be interpreted as instructions".
The former is simple to implement, but probably not very useful; the
latter is not possible to implement in general.
J
-
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/