android_kernel_sony_msm8994.../init
Linus Torvalds b261064c6c execve: use 'struct filename *' for executable name passing
This changes 'do_execve()' to get the executable name as a 'struct
filename', and to free it when it is done.  This is what the normal
users want, and it simplifies and streamlines their error handling.

The controlled lifetime of the executable name also fixes a
use-after-free problem with the trace_sched_process_exec tracepoint: the
lifetime of the passed-in string for kernel users was not at all
obvious, and the user-mode helper code used UMH_WAIT_EXEC to serialize
the pathname allocation lifetime with the execve() having finished,
which in turn meant that the trace point that happened after
mm_release() of the old process VM ended up using already free'd memory.

To solve the kernel string lifetime issue, this simply introduces
"getname_kernel()" that works like the normal user-space getname()
function, except with the source coming from kernel memory.

As Oleg points out, this also means that we could drop the tcomm[] array
from 'struct linux_binprm', since the pathname lifetime now covers
setup_new_exec().  That would be a separate cleanup.

Reported-by: Igor Zhbanov <i.zhbanov@samsung.com>
Tested-by: Steven Rostedt <rostedt@goodmis.org>
Cc: Oleg Nesterov <oleg@redhat.com>
Cc: Al Viro <viro@zeniv.linux.org.uk>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2020-07-21 19:38:41 +01:00
..
calibrate.c init: check printed flag to skip printing message 2012-03-23 16:58:38 -07:00
do_mounts_dm.c CHROMIUM: dm: boot time specification of dm= 2016-05-10 13:15:52 +05:30
do_mounts_initrd.c usermodehelper: split remaining calls to call_usermodehelper_fns() 2013-04-30 17:04:06 -07:00
do_mounts_md.c init: disable sparse checking of the mount.o source files 2012-05-31 17:49:27 -07:00
do_mounts_rd.c init: disable sparse checking of the mount.o source files 2012-05-31 17:49:27 -07:00
do_mounts.c CHROMIUM: dm: boot time specification of dm= 2016-05-10 13:15:52 +05:30
do_mounts.h CHROMIUM: dm: boot time specification of dm= 2016-05-10 13:15:52 +05:30
init_task.c sched/rt: Move rt specific bits into new header file 2013-02-07 20:51:08 +01:00
initramfs.c 32.1.A.1.185 2016-04-09 16:46:03 +02:00
Kconfig Merge remote-tracking branch 'caf/LA.BF64.1.2.3_rb1.6' into HEAD 2017-01-31 13:27:32 +01:00
main.c execve: use 'struct filename *' for executable name passing 2020-07-21 19:38:41 +01:00
Makefile CHROMIUM: dm: boot time specification of dm= 2016-05-10 13:15:52 +05:30
noinitramfs.c initramfs: Add skip_initramfs command line option 2015-08-12 18:31:39 -07:00
version.c proc: Split the namespace stuff out into linux/proc_ns.h 2013-05-01 17:29:39 -04:00