[PATCH v2 0/2] riscv: mm: fix set_memory_x() and kernel_page_present()

From: Mike Rapoport (Microsoft)

Date: Tue Nov 17 2026 - 09:00:29 EST


These are two riscv fixes I found while working on a generic
implementation of the set_memory APIs.

The first one stops set_memory_x() from making the linear map alias of
module and BPF text executable.

The second one makes kernel_page_present() report the pages removed from
the linear map as not present. Today it says they are mapped, and
hibernation could copy them without mapping them first.

---
Changes in v2:
- read the PMD entry once in kernel_page_present() (Jisheng)
- Link to v1: https://patch.msgid.link/20261112-fixes-riscv-v1-0-1caac19897b5@xxxxxxxxxx

---
Mike Rapoport (Microsoft) (2):
riscv: mm: do not make the linear map alias executable in set_memory_*()
riscv: mm: check the valid bit in kernel_page_present()

arch/riscv/mm/pageattr.c | 21 ++++++++++++++-------
1 file changed, 14 insertions(+), 7 deletions(-)
---
base-commit: 6628e7d4c6b25c8d18f1345e3a20d21829aae7e4
change-id: 20261112-fixes-riscv-3e48788f58fe

--
Sincerely yours,
Mike.