Luis Chamberlain
3740d93e37
coredump: fix crash when umh is disabled
...
Commit 64e90a8acb859 ("Introduce STATIC_USERMODEHELPER to mediate
call_usermodehelper()") added the optiont to disable all
call_usermodehelper() calls by setting STATIC_USERMODEHELPER_PATH to
an empty string. When this is done, and crashdump is triggered, it
will crash on null pointer dereference, since we make assumptions
over what call_usermodehelper_exec() did.
This has been reported by Sergey when one triggers a a coredump
with the following configuration:
```
CONFIG_STATIC_USERMODEHELPER=y
CONFIG_STATIC_USERMODEHELPER_PATH=""
kernel.core_pattern = |/usr/lib/systemd/systemd-coredump %P %u %g %s %t %c %h %e
```
The way disabling the umh was designed was that call_usermodehelper_exec()
would just return early, without an error. But coredump assumes
certain variables are set up for us when this happens, and calls
ile_start_write(cprm.file) with a NULL file.
[ 2.819676] BUG: kernel NULL pointer dereference, address: 0000000000000020
[ 2.819859] #PF: supervisor read access in kernel mode
[ 2.820035] #PF: error_code(0x0000) - not-present page
[ 2.820188] PGD 0 P4D 0
[ 2.820305] Oops: 0000 [#1 ] SMP PTI
[ 2.820436] CPU: 2 PID: 89 Comm: a Not tainted 5.7.0-rc1+ #7
[ 2.820680] Hardware name: QEMU Standard PC (i440FX + PIIX, 1996), BIOS ?-20190711_202441-buildvm-armv7-10.arm.fedoraproject.org-2.fc31 04/01/2014
[ 2.821150] RIP: 0010:do_coredump+0xd80/0x1060
[ 2.821385] Code: e8 95 11 ed ff 48 c7 c6 cc a7 b4 81 48 8d bd 28 ff
ff ff 89 c2 e8 70 f1 ff ff 41 89 c2 85 c0 0f 84 72 f7 ff ff e9 b4 fe ff
ff <48> 8b 57 20 0f b7 02 66 25 00 f0 66 3d 00 8
0 0f 84 9c 01 00 00 44
[ 2.822014] RSP: 0000:ffffc9000029bcb8 EFLAGS: 00010246
[ 2.822339] RAX: 0000000000000000 RBX: ffff88803f860000 RCX: 000000000000000a
[ 2.822746] RDX: 0000000000000009 RSI: 0000000000000282 RDI: 0000000000000000
[ 2.823141] RBP: ffffc9000029bde8 R08: 0000000000000000 R09: ffffc9000029bc00
[ 2.823508] R10: 0000000000000001 R11: ffff88803dec90be R12: ffffffff81c39da0
[ 2.823902] R13: ffff88803de84400 R14: 0000000000000000 R15: 0000000000000000
[ 2.824285] FS: 00007fee08183540(0000) GS:ffff88803e480000(0000) knlGS:0000000000000000
[ 2.824767] CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
[ 2.825111] CR2: 0000000000000020 CR3: 000000003f856005 CR4: 0000000000060ea0
[ 2.825479] Call Trace:
[ 2.825790] get_signal+0x11e/0x720
[ 2.826087] do_signal+0x1d/0x670
[ 2.826361] ? force_sig_info_to_task+0xc1/0xf0
[ 2.826691] ? force_sig_fault+0x3c/0x40
[ 2.826996] ? do_trap+0xc9/0x100
[ 2.827179] exit_to_usermode_loop+0x49/0x90
[ 2.827359] prepare_exit_to_usermode+0x77/0xb0
[ 2.827559] ? invalid_op+0xa/0x30
[ 2.827747] ret_from_intr+0x20/0x20
[ 2.827921] RIP: 0033:0x55e2c76d2129
[ 2.828107] Code: 2d ff ff ff e8 68 ff ff ff 5d c6 05 18 2f 00 00 01
c3 0f 1f 80 00 00 00 00 c3 0f 1f 80 00 00 00 00 e9 7b ff ff ff 55 48 89
e5 <0f> 0b b8 00 00 00 00 5d c3 66 2e 0f 1f 84 0
0 00 00 00 00 0f 1f 40
[ 2.828603] RSP: 002b:00007fffeba5e080 EFLAGS: 00010246
[ 2.828801] RAX: 000055e2c76d2125 RBX: 0000000000000000 RCX: 00007fee0817c718
[ 2.829034] RDX: 00007fffeba5e188 RSI: 00007fffeba5e178 RDI: 0000000000000001
[ 2.829257] RBP: 00007fffeba5e080 R08: 0000000000000000 R09: 00007fee08193c00
[ 2.829482] R10: 0000000000000009 R11: 0000000000000000 R12: 000055e2c76d2040
[ 2.829727] R13: 0000000000000000 R14: 0000000000000000 R15: 0000000000000000
[ 2.829964] CR2: 0000000000000020
[ 2.830149] ---[ end trace ceed83d8c68a1bf1 ]---
```
Cc: <stable@vger.kernel.org> # v4.11+
Fixes: 64e90a8acb85 ("Introduce STATIC_USERMODEHELPER to mediate call_usermodehelper()")
BugLink: https://bugzilla.kernel.org/show_bug.cgi?id=199795
Reported-by: Tony Vroon <chainsaw@gentoo.org>
Reported-by: Sergey Kvachonok <ravenexp@gmail.com>
Tested-by: Sergei Trofimovich <slyfox@gentoo.org>
Signed-off-by: Luis Chamberlain <mcgrof@kernel.org>
Link: https://lore.kernel.org/r/20200416162859.26518-1-mcgrof@kernel.org
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
2020-04-28 17:54:13 +02:00
..
2020-03-27 09:29:56 +00:00
2020-01-25 11:31:59 -05:00
2019-11-18 14:26:43 +01:00
2020-04-24 16:33:32 +01:00
2020-03-13 21:08:17 -04:00
2019-08-30 07:27:17 -07:00
2019-08-30 07:27:17 -07:00
2020-04-17 15:20:08 +02:00
2020-02-03 08:05:56 -05:00
2020-04-13 19:33:47 +02:00
2020-04-22 20:29:11 -05:00
2019-09-19 09:42:37 -07:00
2019-12-08 19:10:50 -05:00
2020-02-07 14:48:41 -05:00
2020-03-31 12:58:36 -07:00
2020-04-17 17:08:50 +02:00
2019-09-03 09:30:56 -04:00
2019-12-18 18:07:31 +01:00
2020-02-17 21:08:37 -08:00
2020-02-23 21:59:42 +01:00
2019-08-30 07:27:17 -07:00
2020-03-03 23:40:52 +08:00
2020-04-22 20:14:06 +09:00
2019-11-11 09:21:59 -05:00
2020-03-23 13:01:37 +01:00
2020-04-15 23:58:49 -04:00
2020-04-07 13:48:26 -07:00
2020-03-06 07:06:09 -06:00
2019-08-30 07:27:17 -07:00
2020-02-04 03:05:26 +00:00
2020-02-13 09:16:07 +01:00
2020-03-31 14:16:03 -07:00
2019-12-18 18:07:32 +01:00
2020-04-10 15:36:20 -07:00
2020-03-29 23:23:00 +02:00
2019-10-23 17:23:46 +02:00
2020-04-02 09:35:32 -07:00
2020-04-08 21:37:18 -07:00
2019-09-19 09:42:37 -07:00
2020-03-05 20:25:05 -05:00
2020-02-07 14:48:37 -05:00
2020-02-05 05:28:20 +00:00
2020-03-16 15:53:47 -04:00
2020-02-04 03:05:26 +00:00
2019-08-30 07:27:17 -07:00
2020-04-13 15:55:21 -04:00
2019-05-21 10:50:46 +02:00
2020-04-17 12:40:31 -04:00
2019-10-23 17:23:46 +02:00
2019-05-21 10:50:46 +02:00
2020-03-30 12:40:53 +02:00
2020-03-28 13:21:08 +01:00
2020-04-10 15:36:21 -07:00
2019-08-30 08:11:25 -07:00
2019-07-19 10:42:02 -07:00
2020-04-08 09:39:11 -04:00
2020-03-27 16:51:02 +01:00
2020-04-25 12:25:32 -07:00
2020-03-09 14:45:40 -07:00
2019-08-30 07:27:17 -07:00
2019-08-30 07:27:17 -07:00
2020-01-30 15:37:41 -08:00
2020-02-07 14:48:37 -05:00
2020-04-07 10:43:44 -07:00
2019-09-19 10:06:57 -07:00
2019-09-19 10:06:57 -07:00
2020-04-05 11:34:35 -07:00
2019-08-30 07:27:18 -07:00
2019-12-10 22:29:58 -05:00
2020-04-07 12:40:56 -07:00
2020-04-10 15:36:22 -07:00
2019-09-19 09:42:37 -07:00
2020-03-25 11:50:48 +01:00
2020-02-08 17:34:58 -05:00
2020-01-14 13:28:28 -08:00
2020-04-16 09:07:42 -07:00
2020-03-25 11:28:26 +09:00
2020-02-03 17:27:47 -07:00
2019-07-19 10:42:02 -07:00
2019-12-08 19:10:50 -05:00
2019-05-21 10:50:45 +02:00
2019-11-15 14:38:29 +01:00
2020-04-07 10:43:44 -07:00
2019-05-21 10:50:45 +02:00
2019-07-16 19:23:22 -07:00
2019-07-19 10:42:02 -07:00
2019-05-21 10:50:45 +02:00
2020-04-21 09:51:10 -06:00
2020-04-24 12:44:19 -07:00
2020-01-06 20:10:26 +01:00
2019-11-15 14:38:29 +01:00
2019-06-19 17:09:55 +02:00
2020-04-28 17:54:13 +02:00
2019-08-30 19:31:09 -04:00
2020-04-02 19:15:03 -07:00
2019-12-08 11:08:28 -08:00
2019-05-21 10:50:45 +02:00
2020-01-04 13:55:09 -08:00
2019-12-18 00:03:01 -05:00
2020-02-03 17:27:38 -07:00
2020-04-07 10:43:44 -07:00
2020-04-02 11:22:17 -07:00
2020-03-03 10:55:06 -05:00
2019-08-07 21:51:47 -04:00
2019-08-19 11:00:39 -04:00
2020-03-20 08:47:27 -06:00
2020-04-10 15:36:22 -07:00
2020-02-07 14:48:35 -05:00
2020-04-02 09:35:26 -07:00
2019-07-16 22:52:37 -04:00
2019-05-21 10:50:45 +02:00
2020-01-31 10:30:36 -08:00
2020-02-07 14:48:35 -05:00
2020-03-06 11:06:15 +01:00
2020-04-02 12:30:08 -07:00
2020-04-19 13:55:27 -06:00
2020-04-03 11:35:57 -06:00
2020-04-03 11:35:57 -06:00
2020-02-08 13:44:41 -08:00
2020-03-05 21:00:40 -05:00
2019-06-24 09:16:47 +10:00
2020-03-24 13:27:16 +01:00
2020-03-18 13:03:38 -07:00
2020-03-05 21:00:40 -05:00
2019-05-21 10:50:45 +02:00
2019-07-16 22:52:37 -04:00
2020-01-09 08:16:12 -07:00
2020-04-06 10:38:59 -04:00
2020-03-13 21:08:17 -04:00
2019-05-30 11:26:32 -07:00
2020-03-12 17:33:11 -07:00
2020-04-02 12:30:08 -07:00
2020-04-02 09:35:28 -07:00
2019-06-17 17:36:09 -04:00
2019-05-30 11:29:53 -07:00
2020-01-04 13:55:09 -08:00
2019-09-06 21:28:49 +02:00
2020-04-03 00:09:59 +11:00
2020-01-23 10:15:28 -08:00
2019-11-15 14:38:29 +01:00
2020-04-10 15:36:22 -07:00
2020-03-02 14:04:31 -07:00
2019-12-08 14:37:36 +01:00
2020-01-20 17:03:54 -07:00
2019-10-03 14:21:35 -07:00
2019-12-18 00:03:01 -05:00
2019-05-14 09:47:50 -07:00
2020-01-14 12:20:53 +01:00
2020-04-07 10:43:40 -07:00
2019-12-08 19:10:50 -05:00
2020-03-16 15:53:47 -04:00