Bugzilla will be upgraded to version 5.0 on a still to be determined date in the near future. The original upgrade date has been delayed.
Bug 91567 - setegid sets saved gid
setegid sets saved gid
Product: Red Hat Linux
Classification: Retired
Component: glibc (Show other bugs)
i586 Linux
medium Severity medium
: ---
: ---
Assigned To: Jakub Jelinek
Brian Brock
Depends On:
  Show dependency treegraph
Reported: 2003-05-24 11:22 EDT by Steve Grubb
Modified: 2016-11-24 10:06 EST (History)
2 users (show)

See Also:
Fixed In Version: 2.3.2-49
Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of:
Last Closed: 2003-06-17 17:35:14 EDT
Type: ---
Regression: ---
Mount Type: ---
Documentation: ---
Verified Versions:
Category: ---
oVirt Team: ---
RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: ---

Attachments (Terms of Use)

External Trackers
Tracker ID Priority Status Summary Last Updated
Red Hat Product Errata RHSA-2003:325 normal SHIPPED_LIVE : Updated glibc packages provide security and bug fixes 2003-11-12 00:00:00 EST

  None (edit)
Description Steve Grubb 2003-05-24 11:22:37 EDT
From Bugzilla Helper:
User-Agent: Mozilla/5.0 (X11; U; Linux i586; en-US; rv:1.2.1) Gecko/20030225

Description of problem:
The setegid call sets the saved gid even though it should not. SUS says only
effective gid should be set. I looked at glibc source and it is calling
__setresgid(-1, euid,-1);

Version-Release number of selected component (if applicable):

How reproducible:

Steps to Reproduce:
1. Compile and run the following program:

#include <stdio.h>
#include <unistd.h>
#include <sys/types.h>
#include <pwd.h>
int main(void)
    struct passwd nobody;
    gid_t cur_rgid, cur_egid, cur_sgid;
    gid_t orig_rgid, orig_egid, orig_sgid;
    if (geteuid() != 0) {
        puts("Must be super/root for this test!");
        return 1;
    nobody = *getpwnam("nobody");
    getresgid(&orig_rgid, &orig_egid, &orig_sgid);
    printf("getresgid reports rgid %d, egid %d, sgid %d\n", orig_rgid,
           orig_egid, orig_sgid);
    getresgid(&cur_rgid, &cur_egid, &cur_sgid);
    printf("getresgid reports rgid %d, egid %d, sgid %d\n", cur_rgid,
           cur_egid, cur_sgid);
    if (orig_sgid != cur_sgid) {
        puts("setegid() changed the saved set-gid");
        return 1;
    return 0;

Actual Results:  getresgid reports rgid 0, egid 0, sgid 0
getresgid reports rgid 0, egid 99, sgid 99
setegid() changed the saved set-gid

Expected Results:  getresgid reports rgid 0, egid 0, sgid 0
getresgid reports rgid 0, egid 99, sgid 0

Additional info:
Comment 1 Ulrich Drepper 2003-11-04 16:47:06 EST
Try the RHL9 errata.  Test code at


Note You need to log in before you can comment on or make changes to this bug.