Thread (10 messages) 10 messages, 3 authors, 2021-04-23

Re: [PATCH 1/3] arm64: armv8_deprecated: Fix swp_handler() signal generation

From: Will Deacon <will@kernel.org>
Date: 2021-04-22 12:59:14
Also in: bpf, linux-arm-kernel, lkml

On Tue, Apr 20, 2021 at 04:50:12PM +0000, Liam Howlett wrote:
arm64_notify_segfault() was written to decide on the si_code from the
assembly emulation of the swp_handler(), but was also used for the
signal generation from failed access_ok() and unaligned instructions.

When access_ok() fails, there is no need to search for the offending
address in the VMA space.  Instead, simply set the error to SIGSEGV with
si_code SEGV_ACCERR.

Change the return code from emulate_swpX() when there is an unaligned
pointer so the caller can differentiate from the EFAULT.  It is
unnecessary to search the VMAs in the case of an unaligned pointer.
This change uses SIGSEGV and SEGV_ACCERR instead of SIGBUS to keep with
what was returned before.

Fixes: bd35a4adc413 (arm64: Port SWP/SWPB emulation support from arm)
Signed-off-by: Liam R. Howlett <redacted>
---
 arch/arm64/kernel/armv8_deprecated.c | 20 +++++++++++++-------
Can you give an example of something that is fixed by this, please? At first
glance, it doesn't look like it changes the user-visible behaviour.

We should also be compatible with arch/arm/ here (see set_segfault()).

Will
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help