If a user somehow managed to run hugeadm without an entry being present for the user in the passwd file, hugeadm was segfaulting because it did not check for failure of getpwuid().
Fix: check for getpwuid() failure and issue an appropriate error message. Based on a patch originally authored by Dean Luick <[email protected]>. Signed-off-by: Andrew Hastings <[email protected]> on behalf of Cray Inc. --- -Andrew Hastings Cray Inc. diff -ruNp libhugetlbfs-2.11/hugeadm.c libhugetlbfs-2.11-hugeadm/hugeadm.c --- libhugetlbfs-2.11/hugeadm.c 2010-12-16 11:38:22.000000000 -0600 +++ libhugetlbfs-2.11-hugeadm/hugeadm.c 2011-01-27 11:34:10.630314000 -0600 @@ -860,6 +860,13 @@ void check_user(void) uid = getuid(); pwd = getpwuid(uid); + /* Don't segfault if user does not have a passwd entry. */ + if (!pwd) { + printf("\n"); + WARNING("User uid %d is not in the password file!\n", uid); + return; + } + if (gid != pwd->pw_gid && !user_in_group(grp->gr_mem, pwd->pw_name) && uid != 0) { printf("\n"); WARNING("User %s (uid: %d) is not a member of the hugetlb_shm_group %s (gid: %d)!\n", pwd->pw_name, uid, grp->gr_name, gid); ------------------------------------------------------------------------------ Special Offer-- Download ArcSight Logger for FREE (a $49 USD value)! Finally, a world-class log management solution at an even better price-free! Download using promo code Free_Logger_4_Dev2Dev. Offer expires February 28th, so secure your free ArcSight Logger TODAY! http://p.sf.net/sfu/arcsight-sfd2d _______________________________________________ Libhugetlbfs-devel mailing list [email protected] https://lists.sourceforge.net/lists/listinfo/libhugetlbfs-devel
