← Back to team overview

ecryptfs team mailing list archive

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

 

This out to be fixed in 2.6.28-8.21: 'mm: fix error case in mlock
downgrade reversion'

** Changed in: linux (Ubuntu)
   Importance: Undecided => High
     Assignee: (unassigned) => Tim Gardner (timg-tpi)
       Status: Confirmed => Fix Released
       Target: None => jaunty-alpha-5

-- 
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: Fix Released

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