Linux-RISC-V Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v5 0/2] riscv: fix text patching on minimal kernel configs
@ 2026-08-14  8:27 Xiaofeng Yuan
  2026-08-14  8:27 ` [PATCH v5 1/2] riscv: mm: make EXECMEM_KPROBES writable without CONFIG_STRICT_MODULE_RWX Xiaofeng Yuan
                   ` (2 more replies)
  0 siblings, 3 replies; 7+ messages in thread
From: Xiaofeng Yuan @ 2026-08-14  8:27 UTC (permalink / raw)
  To: Paul Walmsley, Palmer Dabbelt, Albert Ou
  Cc: Alexandre Ghiti, Nam Cao, Klara Modin, prabhakar.csengg,
	linux-riscv, linux-kernel, xiaofengmian

This series fixes two related issues that break kprobes and kernel text
patching on RISC-V configurations where CONFIG_STRICT_MODULE_RWX is not
available (e.g. CONFIG_MODULES=n).

Patch 1 makes the EXECMEM_KPROBES range writable when
CONFIG_STRICT_MODULE_RWX is disabled, so kprobe instruction slot writes
do not fault on read-only executable pages.

Patch 2 makes patch_map() skip the temporary fixmap mapping when the
kernel text is already writable, i.e. when CONFIG_STRICT_KERNEL_RWX is
disabled. The module text path is still gated on CONFIG_STRICT_MODULE_RWX.

Changes since v4:
- 2/2: gate the kernel text fixmap on CONFIG_STRICT_KERNEL_RWX instead of
  returning early on !CONFIG_STRICT_MODULE_RWX. The v4 early return broke
  configs with CONFIG_MODULES=n, where CONFIG_STRICT_MODULE_RWX is
  unavailable but CONFIG_STRICT_KERNEL_RWX is still enabled and the kernel
  text is read-only, causing a boot-time kernel panic on BPI-F3 and RZ/Five
  (reported by Klara Modin and Lad Prabhakar).

Xiaofeng Yuan (2):
  riscv: mm: make EXECMEM_KPROBES writable without
    CONFIG_STRICT_MODULE_RWX
  riscv: patch: skip fixmap mapping when kernel text is already writable

 arch/riscv/kernel/patch.c | 2 ++
 arch/riscv/mm/init.c      | 4 +++-
 2 files changed, 5 insertions(+), 1 deletion(-)

-- 
2.43.0


_______________________________________________
linux-riscv mailing list
linux-riscv@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-riscv

^ permalink raw reply	[flat|nested] 7+ messages in thread

end of thread, other threads:[~2026-08-14 20:18 UTC | newest]

Thread overview: 7+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-14  8:27 [PATCH v5 0/2] riscv: fix text patching on minimal kernel configs Xiaofeng Yuan
2026-08-14  8:27 ` [PATCH v5 1/2] riscv: mm: make EXECMEM_KPROBES writable without CONFIG_STRICT_MODULE_RWX Xiaofeng Yuan
2026-08-14 13:19   ` Lad, Prabhakar
2026-08-14  8:27 ` [PATCH v5 2/2] riscv: patch: skip fixmap mapping when kernel text is already writable Xiaofeng Yuan
2026-08-14 12:04   ` Klara Modin
2026-08-14 13:19   ` Lad, Prabhakar
2026-08-14 20:18 ` [PATCH v5 0/2] riscv: fix text patching on minimal kernel configs Paul Walmsley

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox