aboutsummaryrefslogtreecommitdiff
path: root/lib/test_fortify/write_overflow-memset.c
diff options
context:
space:
mode:
authorAlexandre Ghiti <[email protected]>2023-09-28 17:18:45 +0200
committerAndrew Morton <[email protected]>2023-10-06 14:11:38 -0700
commit117b1bb0cbc7f5feab4fd251737869958987808c (patch)
tree9d945ace95d8bbfeedc26a7819245bf33a8b69a5 /lib/test_fortify/write_overflow-memset.c
parent824135c46b00df7fb369ec7f1f8607427bbebeb0 (diff)
riscv: handle VM_FAULT_[HWPOISON|HWPOISON_LARGE] faults instead of panicking
Patch series "Fix set_huge_pte_at()". A recent report [1] from Ryan for arm64 revealed that we do not handle swap entries when setting a hugepage backed by a NAPOT region (the contpte riscv equivalent). As explained in [1], the issue was discovered by a new test in kselftest which uses poison entries, but the symptoms are different from arm64 though: - the riscv kernel bugs because we do not handle VM_FAULT_HWPOISON*, this is fixed by patch 1, - after that, the test passes because the first pte_napot() fails (the poison entry does not have the N bit set), and then we only set the first page table entry covering the NAPOT hugepage, which is enough for hugetlb_fault() to correctly raise a VM_FAULT_HWPOISON wherever we write in this mapping since only this first page table entry is checked (see https://elixir.bootlin.com/linux/v6.6-rc3/source/mm/hugetlb.c#L6071). But this seems fragile so patch 2 sets all page table entries of a NAPOT mapping. [1]: https://lore.kernel.org/linux-arm-kernel/[email protected]/ This patch (of 2): We used to panic when such faults were encountered but we should handle those faults gracefully for userspace by sending a SIGBUS to the process, like most architectures do. Link: https://lkml.kernel.org/r/[email protected] Link: https://lkml.kernel.org/r/[email protected] Signed-off-by: Alexandre Ghiti <[email protected]> Acked-by: Palmer Dabbelt <[email protected]> Cc: Albert Ou <[email protected]> Cc: Andrew Jones <[email protected]> Cc: Conor Dooley <[email protected]> Cc: Paul Walmsley <[email protected]> Cc: Qinglin Pan <[email protected]> Signed-off-by: Andrew Morton <[email protected]>
Diffstat (limited to 'lib/test_fortify/write_overflow-memset.c')
0 files changed, 0 insertions, 0 deletions