BACKPORT: 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>
(cherry picked from commit 09a6adf53d42ca3088fa3fb41f40b768efc711ed)

Conflicts:
	arch/arm64/mm/fault.c

Upstream has multiple changes to the debug print rate-limiting in
__do_user_fault().

BUG=b:169583246
TEST=Build and deploy to elm

Change-Id: I5778bcf63bad91cab93dcb2cf0edbc387a6650ce
Signed-off-by: Anand K Mistry <amistry@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2474078
Reviewed-by: Nicolas Boichat <drinkcat@chromium.org>
(cherry picked from commit dc0e9fe48e0dc47f27343179472412b4c6c528eb)
Reviewed-on: https://chromium-review.googlesource.com/c/chromiumos/third_party/kernel/+/2569316
1 file changed