forked from luck/tmp_suning_uos_patched
ad97425d23
[ Upstream commit 3fed9e551417b84038b15117732ea4505eee386b ] If a compat process tries to execute an unknown system call above the __ARM_NR_COMPAT_END number, the kernel sends a SIGILL signal to the offending process. Information about the error is printed to dmesg in compat_arm_syscall() -> arm64_notify_die() -> arm64_force_sig_fault() -> arm64_show_signal(). arm64_show_signal() interprets a non-zero value for current->thread.fault_code as an exception syndrome and displays the message associated with the ESR_ELx.EC field (bits 31:26). current->thread.fault_code is set in compat_arm_syscall() -> arm64_notify_die() with the bad syscall number instead of a valid ESR_ELx value. This means that the ESR_ELx.EC field has the value that the user set for the syscall number and the kernel can end up printing bogus exception messages*. For example, for the syscall number 0x68000000, which evaluates to ESR_ELx.EC value of 0x1A (ESR_ELx_EC_FPAC) the kernel prints this error: [ 18.349161] syscall[300]: unhandled exception: ERET/ERETAA/ERETAB, ESR 0x68000000, Oops - bad compat syscall(2) in syscall[10000+50000] [ 18.350639] CPU: 2 PID: 300 Comm: syscall Not tainted 5.18.0-rc1 #79 [ 18.351249] Hardware name: Pine64 RockPro64 v2.0 (DT) [..] which is misleading, as the bad compat syscall has nothing to do with pointer authentication. Stop arm64_show_signal() from printing exception syndrome information by having compat_arm_syscall() set the ESR_ELx value to 0, as it has no meaning for an invalid system call number. The example above now becomes: [ 19.935275] syscall[301]: unhandled exception: Oops - bad compat syscall(2) in syscall[10000+50000] [ 19.936124] CPU: 1 PID: 301 Comm: syscall Not tainted 5.18.0-rc1-00005-g7e08006d4102 #80 [ 19.936894] Hardware name: Pine64 RockPro64 v2.0 (DT) [..] which although shows less information because the syscall number, wrongfully advertised as the ESR value, is missing, it is better than showing plainly wrong information. The syscall number can be easily obtained with strace. *A 32-bit value above or equal to 0x8000_0000 is interpreted as a negative integer in compat_arm_syscal() and the condition scno < __ARM_NR_COMPAT_END evaluates to true; the syscall will exit to userspace in this case with the ENOSYS error code instead of arm64_notify_die() being called. Signed-off-by: Alexandru Elisei <alexandru.elisei@arm.com> Reviewed-by: Marc Zyngier <maz@kernel.org> Link: https://lore.kernel.org/r/20220425114444.368693-3-alexandru.elisei@arm.com Signed-off-by: Catalin Marinas <catalin.marinas@arm.com> Signed-off-by: Sasha Levin <sashal@kernel.org> |
||
---|---|---|
.. | ||
probes | ||
vdso | ||
vdso32 | ||
.gitignore | ||
acpi_numa.c | ||
acpi_parking_protocol.c | ||
acpi.c | ||
alternative.c | ||
armv8_deprecated.c | ||
asm-offsets.c | ||
cacheinfo.c | ||
cpu_errata.c | ||
cpu_ops.c | ||
cpu-reset.h | ||
cpu-reset.S | ||
cpufeature.c | ||
cpuidle.c | ||
cpuinfo.c | ||
crash_core.c | ||
crash_dump.c | ||
debug-monitors.c | ||
efi-entry.S | ||
efi-header.S | ||
efi-rt-wrapper.S | ||
efi.c | ||
entry-common.c | ||
entry-fpsimd.S | ||
entry-ftrace.S | ||
entry.S | ||
fpsimd.c | ||
ftrace.c | ||
head.S | ||
hibernate-asm.S | ||
hibernate.c | ||
hw_breakpoint.c | ||
hyp-stub.S | ||
image-vars.h | ||
image.h | ||
insn.c | ||
io.c | ||
irq.c | ||
jump_label.c | ||
kaslr.c | ||
kexec_image.c | ||
kgdb.c | ||
kuser32.S | ||
machine_kexec_file.c | ||
machine_kexec.c | ||
Makefile | ||
module-plts.c | ||
module.c | ||
mte.c | ||
paravirt.c | ||
pci.c | ||
perf_callchain.c | ||
perf_event.c | ||
perf_regs.c | ||
pointer_auth.c | ||
process.c | ||
proton-pack.c | ||
psci.c | ||
ptrace.c | ||
reloc_test_core.c | ||
reloc_test_syms.S | ||
relocate_kernel.S | ||
return_address.c | ||
scs.c | ||
sdei.c | ||
setup.c | ||
signal.c | ||
signal32.c | ||
sigreturn32.S | ||
sleep.S | ||
smccc-call.S | ||
smp_spin_table.c | ||
smp.c | ||
stacktrace.c | ||
suspend.c | ||
sys_compat.c | ||
sys.c | ||
sys32.c | ||
syscall.c | ||
time.c | ||
topology.c | ||
trace-events-emulation.h | ||
traps.c | ||
vdso.c | ||
vmlinux.lds.S |