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)
committerWill Deacon <will.deacon@arm.com>
Tue, 4 Apr 2017 11:13:36 +0000 (12:13 +0100)
commit09a6adf53d42ca3088fa3fb41f40b768efc711ed
treeb453a6b17322576ddad32ef6dfdeb26e7b880e16
parenta71c9a1c779f2499fb2afc0553e543f18aff6edf
arm64: mm: unaligned access by user-land should be received as SIGBUS

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.

Cc: <stable@vger.kernel.org>
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>
arch/arm64/mm/fault.c