arm64: mm: unaligned access by user-land should be received as SIGBUS
authorVictor Kamensky <kamensky@cisco.com>
Tue, 4 Apr 2017 05:51:01 +0000 (22:51 -0700)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 12 Apr 2017 10:41:11 +0000 (12:41 +0200)
commit3715dbf77f3bcbd82f447b50e3310f5139028cde
tree4af41fbf8985cd10cfb54766c81bf8eeeeb041b2
parent71b44ef83d2a74e1be9053f80455f62086fae822
arm64: mm: unaligned access by user-land should be received as SIGBUS

commit 09a6adf53d42ca3088fa3fb41f40b768efc711ed upstream.

After 52d7523 (arm64: mm: allow the kernel to handle alignment faults on
user accesses) commit user-land accesses that produce unaligned exceptions
like in case of aarch32 ldm/stm/ldrd/strd instructions operating on
unaligned memory received by user-land as SIGSEGV. It is wrong, it should
be reported as SIGBUS as it was before 52d7523 commit.

Changed do_bad_area function to take signal and code parameters out of esr
value using fault_info table, so in case of do_alignment_fault fault
user-land will receive SIGBUS. Wrapped access to fault_info table into
esr_to_fault_info function.

Fixes: 52d7523 (arm64: mm: allow the kernel to handle alignment faults on user accesses)
Signed-off-by: Victor Kamensky <kamensky@cisco.com>
Signed-off-by: Will Deacon <will.deacon@arm.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
arch/arm64/mm/fault.c