[PATCH] powerpc/pseries/mce: Avoid instrumentation in realmode

Sachin Sant sachinp at linux.ibm.com
Mon Aug 29 21:32:23 AEST 2022



> On 29-Aug-2022, at 1:15 PM, Ganesh Goudar <ganeshgr at linux.ibm.com> wrote:
> 
> Part of machine check error handling is done in realmode,
> As of now instrumentation is not possible for any code that
> runs in realmode.
> When MCE is injected on KASAN enabled kernel, crash is
> observed, Hence force inline or mark no instrumentation
> for functions which can run in realmode to avoid KASAN
> instrumentation.
> 
> Signed-off-by: Ganesh Goudar <ganeshgr at linux.ibm.com>
> ---
> arch/powerpc/include/asm/interrupt.h | 2 +-
> arch/powerpc/include/asm/rtas.h      | 4 ++--
> arch/powerpc/kernel/rtas.c           | 4 ++--
> 3 files changed, 5 insertions(+), 5 deletions(-)

Thanks for the patch. I tested it on top of 6.0.0-rc3. It proceeds further but
eventually crashes after arch_local_save_flags


# selftests: powerpc/mce: inject-ra-err
[  111.183705] BUG: Unable to handle kernel data access on read at 0xc00e00027fffe706
[  111.183735] Faulting instruction address: 0xc0000000006b724c
[  111.183744] Oops: Kernel access of bad area, sig: 11 [#1]
[  111.183750] LE PAGE_SIZE=64K MMU=Radix SMP NR_CPUS=2048 NUMA pSeries
[  111.183761] Modules linked in: rpadlpar_io(E) rpaphp(E) dm_mod(E) xsk_diag(E) nft_fib_inet(E) nft_fib_ipv4(E) nft_fib_ipv6(E) nft_fib(E) nft_reject_inet(E) nf_reject_ipv4(E) nf_reject_ipv6(E) nft_reject(E) nft_ct(E) nft_chain_nat(E) nf_nat(E) nf_conntrack(E) nf_defrag_ipv6(E) nf_defrag_ipv4(E) bonding(E) rfkill(E) ip_set(E) tls(E) nf_tables(E) nfnetlink(E) sunrpc(E) binfmt_misc(E) pseries_rng(E) drm(E) drm_panel_orientation_quirks(E) xfs(E) libcrc32c(E) sd_mod(E) t10_pi(E) sr_mod(E) crc64_rocksoft_generic(E) cdrom(E) crc64_rocksoft(E) crc64(E) sg(E) ibmvscsi(E) ibmveth(E) scsi_transport_srp(E) vmx_crypto(E) fuse(E)
[  111.183872] CPU: 16 PID: 6290 Comm: inject-ra-err Tainted: G            E      6.0.0-rc3-dirty #1
[  111.183883] NIP:  c0000000006b724c LR: c00000000004f674 CTR: 0000000000000000
[  111.183890] REGS: c0000000ff7f7880 TRAP: 0300   Tainted: G            E       (6.0.0-rc3-dirty)
[  111.183899] MSR:  8000000000001003 <SF,ME,RI,LE>  CR: 48002828  XER: 00000000
[  111.183916] CFAR: c00000000004f670 DAR: c00e00027fffe706 DSISR: 40000000 IRQMASK: 3 
[  111.183916] GPR00: c00000000004f674 c0000000ff7f7b20 c0000000034ad200 c0000013ffff3832 
[  111.183916] GPR04: 0000000000000031 0000000000000000 c00000000004f674 000000000000000c 
[  111.183916] GPR08: 0000000000000000 a80e000000000000 180000027fffe706 0000000000000000 
[  111.183916] GPR12: c0000013ffff2f00 c0000013ffff2f00 0000000000000000 0000000000000000 
[  111.183916] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 
[  111.183916] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000010000b30 
[  111.183916] GPR24: 00007fffbc8b0000 00007fffbc8af6d8 00007fffc0604158 000000001001fce8 
[  111.183916] GPR28: c00000116aae0868 0000000000000002 00000000ff7f7c20 c0000013ffff2f00 
[  111.184008] NIP [c0000000006b724c] __asan_load1+0x4c/0xa0
[  111.184023] LR [c00000000004f674] arch_local_save_flags+0x24/0x40
[  111.184033] Call Trace:
[  111.184037] [c0000000ff7f7b40] [c00000000004f674] arch_local_save_flags+0x24/0x40
[  111.184048] [c0000000ff7f7b70] [c0000000014d42ac] va_rtas_call_unlocked+0x13c/0x1d0
[  111.184062] [c0000000ff7f7ba0] [c000000000051c54] rtas_call_unlocked+0x34/0x50
[  111.184072] [c0000000ff7f7bc0] [c00000000012edc8] pseries_machine_check_realmode+0x188/0x2c0
[  111.184085] [c0000000ff7f7ca0] [c00000000004b128] machine_check_early+0x68/0xc0
[  111.184095] [c0000000ff7f7cf0] [c000000000008364] machine_check_early_common+0x134/0x1f8
[  111.184107] --- interrupt: 200 at 0x10000e48
[  111.184115] NIP:  0000000010000e48 LR: 0000000010000e40 CTR: 0000000000000000
[  111.184121] REGS: c0000000ff7f7d60 TRAP: 0200   Tainted: G            E       (6.0.0-rc3-dirty)
[  111.184129] MSR:  8000000002a0f033 <SF,VEC,VSX,EE,PR,FP,ME,IR,DR,RI,LE>  CR: 82002822  XER: 00000000
[  111.184152] CFAR: 000000000000021c DAR: 00007fffbc810000 DSISR: 02000008 IRQMASK: 0 
[  111.184152] GPR00: 0000000010000e40 00007fffc0603a70 0000000010027f00 00007fffbc810000 
[  111.184152] GPR04: 0000000000001000 0000000000000003 0000000000000001 0000000000000005 
[  111.184152] GPR08: 0000000000000000 fffffffffffff000 0000000000000000 0000000000000000 
[  111.184152] GPR12: 0000000000000000 00007fffbc8ba5e0 0000000000000000 0000000000000000 
[  111.184152] GPR16: 0000000000000000 0000000000000000 0000000000000000 0000000000000000 
[  111.184152] GPR20: 0000000000000000 0000000000000000 0000000000000000 0000000010000b30 
[  111.184152] GPR24: 00007fffbc8b0000 00007fffbc8af6d8 00007fffc0604158 000000001001fce8 
[  111.184152] GPR28: 00007fffc06042e0 0000000000000001 0000000000000005 0000000000000000 
[  111.184241] NIP [0000000010000e48] 0x10000e48
[  111.184247] LR [0000000010000e40] 0x10000e40
[  111.184252] --- interrupt: 200
[  111.184256] Instruction dump:
[  111.184261] 7cc802a6 4182005c 3d20bfff 6129ffff 792907c6 6529ffff 6129ffff 7c234840 
[  111.184278] 40810040 3d20a80e 786ae8c2 792907c6 <7d2a48ae> 7d290775 4082001c 38210020 
[  111.184297] ---[ end trace 0000000000000000 ]—

- Sachin



More information about the Linuxppc-dev mailing list