Mark Rutland
b502c87d2a
arm64: report EL1 UNDEFs better
...
If an UNDEFINED exception is taken from EL1, and do_undefinstr() doesn't
find any suitable undef_hook, it will call:
BUG_ON(!user_mode(regs))
... and the kernel will report a failure witin do_undefinstr() rather
than reporting the original context that the UNDEFINED exception was
taken from. The pt_regs and ESR value reported within the BUG() handler
will be from within do_undefinstr() and the code dump will be for the
BRK in BUG_ON(), which isn't sufficient to debug the cause of the
original exception.
This patch makes the reporting better by having do_undefinstr() call
die() directly in this case to report the original context from which
the UNDEFINED exception was taken.
Prior to this patch, an undefined instruction is reported as:
| kernel BUG at arch/arm64/kernel/traps.c:497!
| Internal error: Oops - BUG: 0 [#1 ] PREEMPT SMP
| Modules linked in:
| CPU: 0 PID: 0 Comm: swapper Not tainted 5.19.0-rc3-00127-geff044f1b04e-dirty #3
| Hardware name: linux,dummy-virt (DT)
| pstate: 000000c5 (nzcv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
| pc : do_undefinstr+0x28c/0x2ac
| lr : do_undefinstr+0x298/0x2ac
| sp : ffff800009f63bc0
| x29: ffff800009f63bc0 x28: ffff800009f73c00 x27: ffff800009644a70
| x26: ffff8000096778a8 x25: 0000000000000040 x24: 0000000000000000
| x23: 00000000800000c5 x22: ffff800009894060 x21: ffff800009f63d90
| x20: 0000000000000000 x19: ffff800009f63c40 x18: 0000000000000006
| x17: 0000000000403000 x16: 00000000bfbfd000 x15: ffff800009f63830
| x14: ffffffffffffffff x13: 0000000000000000 x12: 0000000000000019
| x11: 0101010101010101 x10: 0000000000161b98 x9 : 0000000000000000
| x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000
| x5 : ffff800009f761d0 x4 : 0000000000000000 x3 : ffff80000a2b80f8
| x2 : 0000000000000000 x1 : ffff800009f73c00 x0 : 00000000800000c5
| Call trace:
| do_undefinstr+0x28c/0x2ac
| el1_undef+0x2c/0x4c
| el1h_64_sync_handler+0x84/0xd0
| el1h_64_sync+0x64/0x68
| setup_arch+0x550/0x598
| start_kernel+0x88/0x6ac
| __primary_switched+0xb8/0xc0
| Code: 17ffff95 a9425bf5 17ffffb8 a9025bf5 (d4210000)
With this patch applied, an undefined instruction is reported as:
| Internal error: Oops - Undefined instruction: 0 [#1 ] PREEMPT SMP
| Modules linked in:
| CPU: 0 PID: 0 Comm: swapper Not tainted 5.19.0-rc3-00128-gf27cfcc80e52-dirty #5
| Hardware name: linux,dummy-virt (DT)
| pstate: 800000c5 (Nzcv daIF -PAN -UAO -TCO -DIT -SSBS BTYPE=--)
| pc : setup_arch+0x550/0x598
| lr : setup_arch+0x50c/0x598
| sp : ffff800009f63d90
| x29: ffff800009f63d90 x28: 0000000081000200 x27: ffff800009644a70
| x26: ffff8000096778c8 x25: 0000000000000040 x24: 0000000000000000
| x23: 0000000000000100 x22: ffff800009f69a58 x21: ffff80000a2b80b8
| x20: 0000000000000000 x19: 0000000000000000 x18: 0000000000000006
| x17: 0000000000403000 x16: 00000000bfbfd000 x15: ffff800009f63830
| x14: ffffffffffffffff x13: 0000000000000000 x12: 0000000000000019
| x11: 0101010101010101 x10: 0000000000161b98 x9 : 0000000000000000
| x8 : 0000000000000000 x7 : 0000000000000000 x6 : 0000000000000000
| x5 : 0000000000000008 x4 : 0000000000000010 x3 : 0000000000000000
| x2 : 0000000000000000 x1 : 0000000000000000 x0 : 0000000000000000
| Call trace:
| setup_arch+0x550/0x598
| start_kernel+0x88/0x6ac
| __primary_switched+0xb8/0xc0
| Code: b4000080 90ffed80 912ac000 97db745f (00000000)
Signed-off-by: Mark Rutland <mark.rutland@arm.com>
Reviewed-by: Mark Brown <broonie@kernel.org>
Cc: Alexandru Elisei <alexandru.elisei@arm.com>
Cc: Amit Daniel Kachhap <amit.kachhap@arm.com>
Cc: James Morse <james.morse@arm.com>
Cc: Will Deacon <will@kernel.org>
Reviewed-by: Anshuman Khandual <anshuman.khandual@arm.com>
Link: https://lore.kernel.org/r/20220913101732.3925290-2-mark.rutland@arm.com
Signed-off-by: Catalin Marinas <catalin.marinas@arm.com>
2022-09-16 12:17:03 +01:00
..
2022-08-17 14:52:50 +01:00
2022-04-29 19:26:27 +01:00
2022-06-28 17:41:44 +01:00
2022-07-01 12:07:43 +01:00
2020-03-25 11:50:48 +01:00
2022-07-19 19:10:28 +01:00
2021-04-08 16:04:22 -07:00
2022-06-27 12:22:31 +01:00
2022-07-05 11:45:45 +01:00
2022-07-04 12:18:47 +01:00
2021-12-08 14:54:07 +00:00
2022-08-23 11:10:24 +01:00
2022-08-23 11:06:48 +01:00
2021-10-01 13:31:00 +01:00
2022-08-23 11:06:48 +01:00
2022-06-23 14:19:33 +01:00
2022-07-25 11:02:11 +01:00
2022-03-07 21:25:47 +00:00
2022-04-29 14:37:59 -07:00
2022-04-29 19:26:27 +01:00
2021-05-25 19:27:49 +01:00
2020-11-17 16:14:20 +00:00
2020-05-28 18:03:40 +01:00
2021-08-04 16:54:36 +00:00
2022-04-28 11:37:06 +01:00
2022-07-05 13:32:59 -07:00
2022-04-22 18:51:02 +01:00
2022-06-15 16:14:47 +01:00
2022-08-23 10:53:34 +01:00
2022-08-23 11:29:12 +01:00
2022-06-15 16:14:47 +01:00
2022-07-20 16:08:10 +01:00
2021-10-01 13:31:00 +01:00
2022-07-07 10:48:37 +01:00
2022-04-29 19:26:27 +01:00
2022-07-25 10:59:15 +01:00
2021-06-24 14:01:55 +01:00
2022-07-25 10:59:15 +01:00
2022-06-29 10:21:23 +01:00
2020-09-07 15:00:52 +01:00
2021-03-24 20:19:30 +00:00
2022-06-24 09:48:55 +02:00
2022-07-25 13:26:14 +02:00
2022-07-15 12:21:16 -04:00
2022-04-29 19:26:27 +01:00
2022-06-23 16:01:42 +01:00
2022-05-07 19:54:33 +01:00
2022-05-07 19:54:33 +01:00
2022-07-25 10:59:15 +01:00
2022-04-04 10:32:50 +01:00
2022-03-24 19:06:48 -07:00
2022-07-07 10:48:37 +01:00
2022-05-17 14:23:37 +01:00
2022-04-08 11:43:46 +01:00
2021-08-23 10:59:26 +01:00
2022-01-12 16:26:58 -08:00
2022-03-08 11:40:44 +00:00
2020-11-09 18:12:34 +01:00
2021-07-28 18:33:49 +01:00
2022-06-03 16:03:05 -07:00
2022-04-08 11:46:46 +01:00
2021-04-08 16:04:22 -07:00
2022-08-23 11:29:11 +01:00
2020-05-04 12:46:03 +01:00
2022-05-17 14:25:35 +01:00
2021-12-10 14:06:04 +00:00
2021-10-01 13:30:59 +01:00
2022-07-20 16:08:10 +01:00
2022-04-22 12:14:05 +02:00
2022-08-23 11:29:11 +01:00
2022-07-01 12:05:45 +01:00
2022-07-01 15:22:51 +01:00
2021-07-21 11:23:25 +01:00
2021-05-25 19:27:49 +01:00
2022-07-29 18:12:36 -07:00
2022-07-27 18:18:03 +01:00
2022-06-24 17:18:10 +01:00
2022-04-29 19:26:27 +01:00
2022-05-16 19:50:20 +01:00
2021-12-10 14:06:04 +00:00
2022-08-23 11:06:48 +01:00
2022-09-16 12:17:03 +01:00
2021-01-20 12:18:46 +00:00
2021-01-20 12:18:46 +00:00
2021-04-15 14:00:38 +01:00
2022-07-25 10:59:15 +01:00