[PW_SID:968107] riscv: misaligned: fix misaligned accesses handling in put/get_user()#466
[PW_SID:968107] riscv: misaligned: fix misaligned accesses handling in put/get_user()#466linux-riscv-bot wants to merge 4 commits into
Conversation
The current implementation is underperforming and in addition, it triggers misaligned access traps on platforms which do not handle misaligned accesses in hardware. Use the existing assembly routines to solve both problems at once. Signed-off-by: Alexandre Ghiti <alexghiti@rivosinc.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
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: "[v2,1/3] riscv: make unsafe user copy routines use existing assembly routines" |
|
Patch 1: "[v2,1/3] riscv: make unsafe user copy routines use existing assembly routines" |
|
Patch 1: "[v2,1/3] riscv: make unsafe user copy routines use existing assembly routines" |
|
Patch 1: "[v2,1/3] riscv: make unsafe user copy routines use existing assembly routines" |
|
Patch 1: "[v2,1/3] riscv: make unsafe user copy routines use existing assembly routines" |
|
Patch 1: "[v2,1/3] riscv: make unsafe user copy routines use existing assembly routines" |
|
Patch 1: "[v2,1/3] riscv: make unsafe user copy routines use existing assembly routines" |
|
Patch 1: "[v2,1/3] riscv: make unsafe user copy routines use existing assembly routines" |
|
Patch 1: "[v2,1/3] riscv: make unsafe user copy routines use existing assembly routines" |
|
Patch 1: "[v2,1/3] riscv: make unsafe user copy routines use existing assembly routines" |
|
Patch 1: "[v2,1/3] riscv: make unsafe user copy routines use existing assembly routines" |
|
Patch 2: "[v2,2/3] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 2: "[v2,2/3] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 2: "[v2,2/3] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 2: "[v2,2/3] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 2: "[v2,2/3] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 2: "[v2,2/3] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 2: "[v2,2/3] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 2: "[v2,2/3] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 2: "[v2,2/3] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 2: "[v2,2/3] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 2: "[v2,2/3] riscv: process: use unsigned int instead of unsigned long for put_user()" |
|
Patch 3: "[v2,3/3] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
cf09983 to
5864252
Compare
|
Patch 3: "[v2,3/3] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 3: "[v2,3/3] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 3: "[v2,3/3] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 3: "[v2,3/3] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 3: "[v2,3/3] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 3: "[v2,3/3] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 3: "[v2,3/3] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 3: "[v2,3/3] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 3: "[v2,3/3] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
|
Patch 3: "[v2,3/3] riscv: uaccess: do not do misaligned accesses in get/put_user()" |
6481b11 to
6cce6cb
Compare
PR for series 968107 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=968107
Version: 2