getpwuid fails silently when run as root inside of mlockall()
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
ecryptfs-utils (Ubuntu) |
Fix Released
|
Low
|
Unassigned | ||
glibc (Ubuntu) |
Invalid
|
Undecided
|
Unassigned | ||
linux (Ubuntu) |
Fix Released
|
High
|
Tim Gardner |
Bug Description
Use this test program
#include <pwd.h>
#include <stdio.h>
#include <errno.h>
#include <sys/mman.h>
int main() {
struct passwd *pw = NULL;
uid_t id;
if (mlockall(
return 1;
}
id = getuid();
pw = getpwuid(id);
if (pw == NULL) {
return errno;
}
printf(
return 0;
}
Build on Intrepid, and on Jaunty.
Run as root and non-root.
root@jaunty:
getpwuid: Success
kirkland@jaunty:
getpwuid: Resource temporarily unavailable
root@intrepid:
[root]
kirkland@intrepid:
getpwuid: Resource temporarily unavailable
Running this program as root on intrepid used to work. It does not in Jaunty. Additionally, errno is not set.
This regression is breaking mount.ecryptfs, which does a getpwuid() inside of just such an mlock.
:-Dustin
CVE References
Changed in glibc: | |
status: | New → Confirmed |
Changed in ecryptfs-utils: | |
status: | New → Fix Released |
(intrepid) root@gorgon: /tmp# ./bad
getpwuid: Success
Inside an intrepid chroot it fails as under jaunty. this implies some kind of kernel issue? raising mlock limits doesn't seem to affect it.