Files
tegra-linux-noble/include/linux
Heiko Carstens 96e02d1586 exec: fix use-after-free bug in setup_new_exec()
Setting the task name is done within setup_new_exec() by accessing
bprm->filename. However this happens after flush_old_exec().
This may result in a use after free bug, flush_old_exec() may
"complete" vfork_done, which will wake up the parent which in turn
may free the passed in filename.
To fix this add a new tcomm field in struct linux_binprm which
contains the now early generated task name until it is used.

Fixes this bug on s390:

  Unable to handle kernel pointer dereference at virtual kernel address 0000000039768000
  Process kworker/u:3 (pid: 245, task: 000000003a3dc840, ksp: 0000000039453818)
  Krnl PSW : 0704000180000000 0000000000282e94 (setup_new_exec+0xa0/0x374)
  Call Trace:
  ([<0000000000282e2c>] setup_new_exec+0x38/0x374)
   [<00000000002dd12e>] load_elf_binary+0x402/0x1bf4
   [<0000000000280a42>] search_binary_handler+0x38e/0x5bc
   [<0000000000282b6c>] do_execve_common+0x410/0x514
   [<0000000000282cb6>] do_execve+0x46/0x58
   [<00000000005bce58>] kernel_execve+0x28/0x70
   [<000000000014ba2e>] ____call_usermodehelper+0x102/0x140
   [<00000000005bc8da>] kernel_thread_starter+0x6/0xc
   [<00000000005bc8d4>] kernel_thread_starter+0x0/0xc
  Last Breaking-Event-Address:
   [<00000000002830f0>] setup_new_exec+0x2fc/0x374

  Kernel panic - not syncing: Fatal exception: panic_on_oops

Reported-by: Sebastian Ott <sebott@linux.vnet.ibm.com>
Signed-off-by: Heiko Carstens <heiko.carstens@de.ibm.com>
Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
2012-02-06 15:15:20 -08:00
..
2012-01-22 15:08:43 -05:00
2011-12-13 15:30:49 -05:00
2012-01-24 15:41:51 +02:00
2012-01-10 16:30:42 -08:00
2012-01-03 22:54:57 -05:00
2011-12-13 09:26:45 +00:00
2012-01-04 08:56:31 -06:00
2012-01-12 20:13:04 -08:00
2012-01-03 22:54:58 -05:00
2011-12-13 11:58:49 +01:00
2012-01-12 20:13:08 -08:00
2012-01-03 22:54:56 -05:00
2012-01-03 22:55:17 -05:00
2012-01-09 13:52:09 +01:00
2012-01-12 20:13:11 -08:00
2012-01-17 15:40:51 -08:00
2011-12-27 11:26:41 +02:00
2012-01-12 20:13:10 -08:00
2012-01-06 12:10:26 -08:00
2012-01-12 15:23:04 -08:00
2011-12-13 09:26:45 +00:00
2012-01-03 22:55:07 -05:00
2012-01-03 22:54:56 -05:00
2012-02-02 12:55:17 -08:00
2012-01-03 22:52:40 -05:00
2012-01-09 09:33:57 +09:00
2011-12-13 09:26:45 +00:00
2012-01-03 22:54:56 -05:00
2012-01-24 12:25:14 -08:00