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
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]
#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));