diff --git a/src/launcherlib/booster.cpp b/src/launcherlib/booster.cpp index 4e0fc56..34ba255 100644 --- a/src/launcherlib/booster.cpp +++ b/src/launcherlib/booster.cpp @@ -403,12 +403,15 @@ void Booster::setEnvironmentBeforeLaunch() if (getgid() != m_appData->groupId()) setgid(m_appData->groupId()); - // Flip the effective group ID forth and back to a dedicated group + // Flip the real group ID forth and back to a dedicated group // id to generate an event for policy (re-)classification. - gid_t orig = getegid(); + // Using real ID instead of effective for dropping setgid + // from calling process (for example lipstick). + gid_t orig = getgid(); setegid(m_boosted_gid); - setegid(orig); + if (setregid(orig, orig) == -1) + Logger::logError("Failed to set process gid to %d, %s", orig, strerror(errno)); } // Reset out-of-memory killer adjustment