GNU bug report logs - #52800
[PATCH] maint: fix prctl arguments

Previous Next

Package: coreutils;

Reported by: Max Filippov <jcmvbkbc <at> gmail.com>

Date: Sun, 26 Dec 2021 09:03:01 UTC

Severity: normal

Tags: patch

Done: Pádraig Brady <P <at> draigBrady.com>

Bug is archived. No further changes may be made.

Full log


View this message in rfc822 format

From: Max Filippov <jcmvbkbc <at> gmail.com>
To: 52800 <at> debbugs.gnu.org
Cc: Max Filippov <jcmvbkbc <at> gmail.com>
Subject: bug#52800: [PATCH] maint: fix prctl arguments
Date: Sat, 25 Dec 2021 21:17:44 -0800
When configured with --enable-single-binary tools issue incorrect prctl:

  prctl(PR_SET_KEEPCAPS, 1071091381)      = -1 EINVAL (Invalid argument)

PR_SET_MM_ARG_START is not a prctl 'option' parameter, it's 'arg2'
parameter for the option PR_SET_MM. It also has to have 'arg4' and
'arg5' set to 0 explicitly, otherwise the kernel also returns -EINVAL.

* src/coreutils.c (launch_program): Fix prctl arguments.
---
 src/coreutils.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/src/coreutils.c b/src/coreutils.c
index 6db5a8f05ce3..d8f6e97a6d2f 100644
--- a/src/coreutils.c
+++ b/src/coreutils.c
@@ -121,7 +121,7 @@ launch_program (char const *prog_name, int prog_argc, char **prog_argv)
 #if HAVE_PRCTL && defined PR_SET_MM_ARG_START
   /* Shift the beginning of the command line to prog_argv[0] (if set) so
      /proc/pid/cmdline reflects the right value.  */
-  prctl (PR_SET_MM_ARG_START, prog_argv[0]);
+  prctl (PR_SET_MM, PR_SET_MM_ARG_START, prog_argv[0], 0, 0);
 #endif
 
   exit (prog_main (prog_argc, prog_argv));
-- 
2.20.1





This bug report was last modified 3 years and 143 days ago.

Previous Next


GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997,2003 nCipher Corporation Ltd, 1994-97 Ian Jackson.