[PW_SID:967715] riscv: misaligned: fix misaligned accesses handling in put/get_user()#456
[PW_SID:967715] riscv: misaligned: fix misaligned accesses handling in put/get_user()#456linux-riscv-bot wants to merge 2 commits into
Conversation
The specification of prctl() for GET_UNALIGN_CTL states that the value is returned in an unsigned int * address passed as an unsigned long. Change the type to match that and avoid an unaligned access as well. Signed-off-by: Clément Léger <cleger@rivosinc.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Doing misaligned access to userspace memory would make a trap on platform where it is emulated. Latest fixes removed the kernel capability to do unaligned accesses to userspace memory safely since interrupts are kept disabled at all time during that. Thus doing so would crash the kernel. Such behavior was detected with GET_UNALIGN_CTL() that was doing a put_user() with an unsigned long* address that should have been an unsigned int*. Reenabling kernel misaligned access emulation is a bit risky and it would also degrade performances. Rather than doing that, we will try to avoid any misaligned accessed by using copy_from/to_user() which does not do any misaligned accesses. This can be done only for !CONFIG_HAVE_EFFICIENT_UNALIGNED_ACCESS and thus allows to only generate a bit more code for this config. Signed-off-by: Clément Léger <cleger@rivosinc.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[1/2] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 1: "[1/2] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 1: "[1/2] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 1: "[1/2] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 1: "[1/2] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 1: "[1/2] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 1: "[1/2] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 1: "[1/2] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 1: "[1/2] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 1: "[1/2] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 1: "[1/2] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 2: "[2/2] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 2: "[2/2] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 2: "[2/2] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 2: "[2/2] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 2: "[2/2] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 2: "[2/2] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 2: "[2/2] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 2: "[2/2] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 2: "[2/2] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 2: "[2/2] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 2: "[2/2] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
PR for series 967715 applied to workflow__riscv__for-next
Name: riscv: misaligned: fix misaligned accesses handling in put/get_user()
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=967715
Version: 1