[PW_SID:1119627] riscv: fix kprobes on minimal kernel configs#2189
[PW_SID:1119627] riscv: fix kprobes on minimal kernel configs#2189linux-riscv-bot wants to merge 3 commits into
Conversation
When CONFIG_ARCH_HAS_EXECMEM_ROX is not set, execmem cannot create temporary writable mappings for read-only executable pages. In this case, the execmem ranges must already have writable permissions. Currently EXECMEM_KPROBES unconditionally uses PAGE_KERNEL_READ_EXEC, which causes kprobe instruction slot writes to trigger page faults on systems where CONFIG_STRICT_MODULE_RWX is not enabled. Fix this by using PAGE_KERNEL_EXEC when CONFIG_ARCH_HAS_EXECMEM_ROX is not available. Signed-off-by: Xiaofeng Yuan <xiaofengmian@163.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
Currently patch_map() always creates a temporary writable mapping via fixmap for kernel text addresses, even when CONFIG_STRICT_KERNEL_RWX is disabled and the kernel text is already mapped with _PAGE_WRITE. This is unnecessary overhead at best, and on minimal configurations it can cause page faults. Skip the fixmap path for kernel text when CONFIG_STRICT_KERNEL_RWX is not enabled, since the text pages are already writable in this case. Signed-off-by: Xiaofeng Yuan <xiaofengmian@163.com> Signed-off-by: Linux RISC-V bot <linux.riscv.bot@gmail.com>
|
Patch 1: "[1/2] riscv: mm: make EXECMEM_KPROBES writable without ARCH_HAS_EXECMEM_ROX" |
|
Patch 1: "[1/2] riscv: mm: make EXECMEM_KPROBES writable without ARCH_HAS_EXECMEM_ROX" |
|
Patch 1: "[1/2] riscv: mm: make EXECMEM_KPROBES writable without ARCH_HAS_EXECMEM_ROX" |
|
Patch 1: "[1/2] riscv: mm: make EXECMEM_KPROBES writable without ARCH_HAS_EXECMEM_ROX" |
|
Patch 1: "[1/2] riscv: mm: make EXECMEM_KPROBES writable without ARCH_HAS_EXECMEM_ROX" |
|
Patch 1: "[1/2] riscv: mm: make EXECMEM_KPROBES writable without ARCH_HAS_EXECMEM_ROX" |
|
Patch 1: "[1/2] riscv: mm: make EXECMEM_KPROBES writable without ARCH_HAS_EXECMEM_ROX" |
|
Patch 1: "[1/2] riscv: mm: make EXECMEM_KPROBES writable without ARCH_HAS_EXECMEM_ROX" |
|
Patch 1: "[1/2] riscv: mm: make EXECMEM_KPROBES writable without ARCH_HAS_EXECMEM_ROX" |
|
Patch 1: "[1/2] riscv: mm: make EXECMEM_KPROBES writable without ARCH_HAS_EXECMEM_ROX" |
|
Patch 1: "[1/2] riscv: mm: make EXECMEM_KPROBES writable without ARCH_HAS_EXECMEM_ROX" |
|
Patch 1: "[1/2] riscv: mm: make EXECMEM_KPROBES writable without ARCH_HAS_EXECMEM_ROX" |
|
Patch 2: "[2/2] riscv: patch: skip fixmap mapping when kernel text is already writable" |
|
Patch 2: "[2/2] riscv: patch: skip fixmap mapping when kernel text is already writable" |
|
Patch 2: "[2/2] riscv: patch: skip fixmap mapping when kernel text is already writable" |
|
Patch 2: "[2/2] riscv: patch: skip fixmap mapping when kernel text is already writable" |
|
Patch 2: "[2/2] riscv: patch: skip fixmap mapping when kernel text is already writable" |
|
Patch 2: "[2/2] riscv: patch: skip fixmap mapping when kernel text is already writable" |
|
Patch 2: "[2/2] riscv: patch: skip fixmap mapping when kernel text is already writable" |
|
Patch 2: "[2/2] riscv: patch: skip fixmap mapping when kernel text is already writable" |
|
Patch 2: "[2/2] riscv: patch: skip fixmap mapping when kernel text is already writable" |
|
Patch 2: "[2/2] riscv: patch: skip fixmap mapping when kernel text is already writable" |
|
Patch 2: "[2/2] riscv: patch: skip fixmap mapping when kernel text is already writable" |
|
Patch 2: "[2/2] riscv: patch: skip fixmap mapping when kernel text is already writable" |
a50938c to
40ba5ca
Compare
PR for series 1119627 applied to workflow__riscv__fixes
Name: riscv: fix kprobes on minimal kernel configs
URL: https://patchwork.kernel.org/project/linux-riscv/list/?series=1119627
Version: 1