]> git.baikalelectronics.ru Git - kernel.git/commit
ARM: 9179/1: uaccess: avoid alignment faults in copy_[from|to]_kernel_nofault
authorArd Biesheuvel <ardb@kernel.org>
Tue, 18 Jan 2022 12:45:09 +0000 (13:45 +0100)
committerRussell King (Oracle) <rmk+kernel@armlinux.org.uk>
Wed, 19 Jan 2022 11:10:53 +0000 (11:10 +0000)
commit8c3170a17feb9151abe9fa3a08e3be0a9a649808
tree6ed3fdf9fa2d8d9f51121996ecec99ad180a48a3
parent6e2c99ee92d0f3aaa3855efae87016662e7792ca
ARM: 9179/1: uaccess: avoid alignment faults in copy_[from|to]_kernel_nofault

The helpers that are used to implement copy_from_kernel_nofault() and
copy_to_kernel_nofault() cast a void* to a pointer to a wider type,
which may result in alignment faults on ARM if the compiler decides to
use double-word or multiple-word load/store instructions.

Only configurations that define CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS=y
are affected, given that commit 6438939126ea ("ARM: 9115/1: mm/maccess:
fix unaligned copy_{from,to}_kernel_nofault") ensures that dst and src
are sufficiently aligned otherwise.

So use the unaligned accessors for accessing dst and src in cases where
they may be misaligned.

Cc: <stable@vger.kernel.org> # depends on 6438939126ea
Fixes: 18f09f8c447b ("ARM: 9112/1: uaccess: add __{get,put}_kernel_nofault")
Reviewed-by: Arnd Bergmann <arnd@arndb.de>
Signed-off-by: Ard Biesheuvel <ardb@kernel.org>
Signed-off-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>
arch/arm/include/asm/uaccess.h