← Back to team overview

ecryptfs team mailing list archive

[Bug 329264] Re: getpwuid fails silently when run as root inside of mlockall()

 

** Changed in: glibc (Ubuntu)
       Status: New => Confirmed

-- 
getpwuid fails silently when run as root inside of mlockall()
https://bugs.launchpad.net/bugs/329264
You received this bug notification because you are a member of eCryptfs,
which is subscribed to ecryptfs-utils in ubuntu.

Status in “ecryptfs-utils” source package in Ubuntu: New
Status in “glibc” source package in Ubuntu: Confirmed
Status in “linux” source package in Ubuntu: New

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(MCL_FUTURE)<0) {
        perror("mlockall");
        return 1;
    }
    id = getuid();
    pw = getpwuid(id);
    if (pw == NULL) {
        perror("getpwuid");
        return errno;
    }
    printf("[%s]\n", pw->pw_name);
    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