setuid and RLIMIT_NPROC and 3.1+
From: Maciej Åenczykowski
Date: Mon May 07 2012 - 06:06:34 EST
Commit 72fa59970f8698023045ab0713d66f3f4f96945c
Author: Vasiliy Kulikov <segoon@xxxxxxxxxxxx>
Date: Mon Aug 8 19:02:04 2011 +0400
move RLIMIT_NPROC check from set_user() to do_execve_common()
intentionally 'breaks' error return codes from setuid and friends in
the presence of RLIMIT_NPROC.
3.0.30:
setresuid(0, 0, 0) = 0
setrlimit(RLIMIT_NPROC, {rlim_cur=1, rlim_max=1}) = 0
clone(Process 20070 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0x1344b30) = 20070 [fork() succeeds only because we're
root]
[pid 20069] setuid(65534) = 0
[pid 20070] setuid(65534) = -1 EAGAIN (Resource temporarily unavailable)
3.1:
setresuid(0, 0, 0) = 0
setrlimit(RLIMIT_NPROC, {rlim_cur=1, rlim_max=1}) = 0
clone(Process 13507 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD,
child_tidptr=0x135cb30) = 13507 [fork() succeeds only because we're
root]
[pid 13506] setuid(65534) = 0
[pid 13507] setuid(65534) = 0
Having read the commit in question I get what it is trying to prevent,
but perhaps the setuid call should still be returning an error code
[E2BIG? EBUSY? EOVERFLOW? ENAVAIL?] for those programs that do bother
to check, even though it would 'succeed' in changing uid?
(In my case there is no exec following the setuid...)
- Maciej
--
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/