• L
    Replace setuid/setgid/initgroups with virSetUIDGID() · f42cf7cb
    Laine Stump 提交于
    This patch fixes https://bugzilla.redhat.com/show_bug.cgi?id=664406
    
    If qemu is run as a different uid, it has been unable to access mode
    0660 files that are owned by a different user, but with a group that
    the qemu is a member of (aside from the one group listed in the passwd
    file), because initgroups() is not being called prior to the
    exec. initgroups will change the group membership of the process (and
    its children) to match the new uid.
    
    To make this happen, the setregid()/setreuid() code in
    qemuSecurityDACSetProcessLabel has been replaced with a call to
    virSetUIDGID(), which does both of those, plus calls initgroups.
    
    Similar, but not identical, code in qemudOpenAsUID() has been replaced
    with virSetUIDGID(). This not only consolidates the functionality to a
    single location, but also potentially fixes some as-yet unreported
    bugs.
    f42cf7cb
qemu_security_dac.c 16.5 KB