Re: [patch 0/4] MAP_NOZERO v2 - VM_NOZERO/MAP_NOZERO early summer madness

Andy Isaacson
2007-07-02T18:38:45Z

On Sat, Jun 30, 2007 at 12:03:07PM -0700, Davide Libenzi wrote:
> I think the focus should be to find a case where under the currently
> implemented policy for MAP_NOZERO, MAP_NOZERO represent a loss of security
> WRT no MAP_NOZERO. I have not been able to find one yet, although Andy
> found a potential one in the setuid+exec/ptrace race (fixed by a patch
> that should IMO go in in any case).

BTW, the ptrace variant of this issue is not a problem -- PTRACE_ATTACH
running as newuid gets EPERM when trying to attach at /* here */ below.

setuid(newuid);
/* here */
exec(...);
exit(1);

sys_setuid sets current->mm->dumpable = suid_dumpable, so unless the
admin asked for it, there is no risk WRT PTRACE_ATTACH. However, this
risk vector does need to be considered when implementing MAP_NOZERO.

-andy