aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--NEWS4
-rw-r--r--src/coreutils.c5
2 files changed, 7 insertions, 2 deletions
diff --git a/NEWS b/NEWS
index 811e27e3a..72453dc4b 100644
--- a/NEWS
+++ b/NEWS
@@ -46,6 +46,10 @@ GNU coreutils NEWS -*- outline -*-
sort --debug now diagnoses issues with --field-separator characters
that conflict with characters possibly used in numbers.
+ root invoked coreutils, that are built and run in single binary mode,
+ now adjust /proc/$pid/cmdline to be more specific to the utility
+ being run, rather than using the general "coreutils" binary name.
+
* Noteworthy changes in release 9.0 (2021-09-24) [stable]
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));