SHA256
1
0
forked from pool/mcelog
mcelog/fix_setgroups_missing_call.patch
Dirk Mueller 2ce622fffe Accepting request 867001 from home:trenn:branches:Base:System
- Update to version 175 (jsc#SLE-14450):
  * mcelog: Add a test case to test page error counter replacement.
  * mcelog: Use 'num-errors' to specify the number of mce records to be injected.
  * mcelog: Report how often the replacement of page CE counter happened
  * mcelog: Limit memory consumption for counting CEs per page
  * mcelog: Add support for Sapphirerapids server. (jsc#SLE-14450)
  * mcelog: i10nm: Fix mapping from bank number to functional unit
- Only refreshing patches, due to tarball modifications:
M    Start-consolidating-AMD-specific-stuff.patch
M    add-f10h-support.patch
M    add-f11h-support.patch
M    add-f12h-support.patch
M    add-f14h-support.patch
M    add-f15h-support.patch
M    add-f16h-support.patch
M    email.patch
M    fix_setgroups_missing_call.patch
M    mcelog_invert_prefill_db_warning.patch

OBS-URL: https://build.opensuse.org/request/show/867001
OBS-URL: https://build.opensuse.org/package/show/Base:System/mcelog?expand=0&rev=90
2021-01-27 08:15:07 +00:00

30 lines
838 B
Diff

---
mcelog.c | 9 +++++++++
1 file changed, 9 insertions(+)
--- a/mcelog.c
+++ b/mcelog.c
@@ -37,6 +37,7 @@
#include <assert.h>
#include <signal.h>
#include <pwd.h>
+#include <grp.h>
#include <sys/wait.h>
#include <fnmatch.h>
#include "mcelog.h"
@@ -1284,6 +1285,14 @@
static void drop_cred(void)
{
+ /* When dropping privileges from root, the `setgroups` call will
+ * remove any extraneous groups. If we don't call this, then
+ * even though our uid has dropped, we may still have groups
+ * that enable us to do super-user things. This will fail if we
+ * aren't root, so don't bother checking the return value, this
+ * is just done as an optimistic privilege dropping function.
+ */
+ setgroups(0, NULL);
if (runcred.uid != -1U && runcred.gid == -1U) {
struct passwd *pw = getpwuid(runcred.uid);
if (pw)