diff options
| author | Max Filippov <jcmvbkbc@gmail.com> | 2021-12-27 11:58:28 +0000 |
|---|---|---|
| committer | Pádraig Brady <P@draigBrady.com> | 2021-12-27 12:09:39 +0000 |
| commit | 5bc9d928683932c24f516bd797171e69d6976e7c (patch) | |
| tree | a758fb1bb0473327bc3b55115b916d7e3eee2733 /src/coreutils.c | |
| parent | ls: improve doc for =WHEN (diff) | |
| download | coreutils-5bc9d928683932c24f516bd797171e69d6976e7c.tar.gz coreutils-5bc9d928683932c24f516bd797171e69d6976e7c.zip | |
all: fix adjustment of /proc/$pid/cmdline by single binary
When configured with --enable-single-binary tools issue incorrect prctl:
prctl(PR_SET_KEEPCAPS, ...) = -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.
* NEWS: Mention the improvement.
Fixes https://bugs.gnu.org/52800
Diffstat (limited to 'src/coreutils.c')
| -rw-r--r-- | src/coreutils.c | 5 |
1 files changed, 3 insertions, 2 deletions
diff --git a/src/coreutils.c b/src/coreutils.c index 6db5a8f05..63dfa228c 100644 --- a/src/coreutils.c +++ b/src/coreutils.c @@ -120,8 +120,9 @@ launch_program (char const *prog_name, int prog_argc, char **prog_argv) #endif #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]); + /proc/$pid/cmdline reflects a more specific value. Note one needs + CAP_SYS_RESOURCE or root privileges for this to succeed. */ + prctl (PR_SET_MM, PR_SET_MM_ARG_START, prog_argv[0], 0, 0); #endif exit (prog_main (prog_argc, prog_argv)); |
