Note: This bug is displayed in read-only format because the product is no longer active in Red Hat Bugzilla.
RHEL Engineering is moving the tracking of its product development work on RHEL 6 through RHEL 9 to Red Hat Jira (issues.redhat.com). If you're a Red Hat customer, please continue to file support cases via the Red Hat customer portal. If you're not, please head to the "RHEL project" in Red Hat Jira and file new tickets here. Individual Bugzilla bugs in the statuses "NEW", "ASSIGNED", and "POST" are being migrated throughout September 2023. Bugs of Red Hat partners with an assigned Engineering Partner Manager (EPM) are migrated in late September as per pre-agreed dates. Bugs against components "kernel", "kernel-rt", and "kpatch" are only migrated if still in "NEW" or "ASSIGNED". If you cannot log in to RH Jira, please consult article #7032570. That failing, please send an e-mail to the RH Jira admins at rh-issues@redhat.com to troubleshoot your issue as a user management inquiry. The email creates a ServiceNow ticket with Red Hat. Individual Bugzilla bugs that are migrated will be moved to status "CLOSED", resolution "MIGRATED", and set with "MigratedToJIRA" in "Keywords". The link to the successor Jira issue will be found under "Links", have a little "two-footprint" icon next to it, and direct you to the "RHEL project" in Red Hat Jira (issue links are of type "https://issues.redhat.com/browse/RHEL-XXXX", where "X" is a digit). This same link will be available in a blue banner at the top of the page informing you that that bug has been migrated.

Bug 989468

Summary: vhostmd doesn't set supplemental groups correctly.
Product: Red Hat Enterprise Linux 7 Reporter: Richard W.M. Jones <rjones>
Component: vhostmdAssignee: Richard W.M. Jones <rjones>
Status: CLOSED CURRENTRELEASE QA Contact: Virtualization Bugs <virt-bugs>
Severity: unspecified Docs Contact:
Priority: unspecified    
Version: 7.0CC: bfan, fdanapfe, jfehlig, leiwang, lkong, lmiccini, moli, qwan, sgrubb, ycui
Target Milestone: rc   
Target Release: ---   
Hardware: Unspecified   
OS: Unspecified   
Whiteboard:
Fixed In Version: vhostmd-0.5-6.el7 Doc Type: Bug Fix
Doc Text:
Story Points: ---
Clone Of: 741289 Environment:
Last Closed: 2014-06-13 12:04:38 UTC Type: ---
Regression: --- Mount Type: ---
Documentation: --- CRM:
Verified Versions: Category: ---
oVirt Team: --- RHEL 7.3 requirements from Atomic Host:
Cloudforms Team: --- Target Upstream Version:
Embargoed:
Bug Depends On: 741289    
Bug Blocks: 1018952    

Description Richard W.M. Jones 2013-07-29 10:24:31 UTC
+++ This bug was initially created as a clone of Bug #741289 +++

Description of problem:

(reported by Steve Grubb)

vhostmd does not set supplemental groups correctly when it
changes (drops) privs.  Between setgid and setuid, there
should be a call to either initgroups or setgroups as appropriate.

---

Util-linux's login program does something like this:

    if (initgroups(user, pwd->pw_gid) < 0) {
            syslog(LOG_ERR, "initgroups: %m");
            fprintf(stderr, _("\nSession setup problem, abort.\n"));
            exit(1);
    }

This can be adapted to vhostmd.c. The problem is that supplemental groups from the root account can be leaked into daemons unless they specifically clear the supplemental groups.

To test this, go into a system as root. Use the id program to verify root has some supplemental groups. Restart vhostmd. Get its pid. Look in /proc/<pid>/status for the "Groups" line. You should see some leaked groups. 

When patched, you should not.

---

The test is simple.  After starting vhostmd, run the
following command:

$ grep ^Groups: /proc/`pidof vhostmd`/status

If the bug is fixed, you should see one group, which is the
group of vhostmd (112 on Fedora, not sure about RHEL, but you
can check in /etc/group for the right number).  eg:

$ grep ^Groups: /proc/`pidof vhostmd`/status
Groups:	112 

However if you see a list of groups here, then there is an error.
For example, on Fedora with the unfixed vhostmd you see:

$ grep ^Groups: /proc/`pidof vhostmd`/status
Groups:	0 1 2 3 4 6 10 

This is very bad because (eg) '0' is the group of the root
account.

---

Upstream fix:
https://gitorious.org/vhostmd/vhostmd/commit/8684995d87e08fadd44e1814e810c770a1f60273

Comment 2 bfan 2013-07-30 06:46:43 UTC
Can reproduce with libguestfs-1.22.5-2.el7

[root@]# cat /etc/group | grep vhostmd
vhostmd:x:112:
[root@]# grep ^Groups: /proc/`pidof vhostmd`/status
Groups:

Comment 3 Lingfei Kong 2013-12-06 07:44:09 UTC
Verified with vhostmd-0.5-6.el7.x86_64

#cat /etc/group | grep vhostmd
vhostmd:x:112:
[host-b]#grep ^Groups: /proc/`pidof vhostmd`/status
Groups:	112 


Only see one group, which is the group of vhostmd ,so this bug is fixed.

Comment 4 Ludek Smid 2014-06-13 12:04:38 UTC
This request was resolved in Red Hat Enterprise Linux 7.0.

Contact your manager or support representative in case you have further questions about the request.