| 43f5da70 | 07-Oct-2021 |
Mitchell Horne <[email protected]> |
riscv: handle page faults in the unmappable region
When handling a kernel page fault, check explicitly that stval resides in either the user or kernel address spaces, and make the page fault fatal i
riscv: handle page faults in the unmappable region
When handling a kernel page fault, check explicitly that stval resides in either the user or kernel address spaces, and make the page fault fatal if not. Otherwise, a properly crafted address may appear to pmap_fault() as a valid and present page in the kernel map, causing the page fault to be retried continuously. This is mainly due to the fact that the upper bits of virtual addresses are not validated by most of the pmap code.
Faults of this nature should only occur due to some kind of bug in the kernel, but it is best to handle them gracefully when they do.
Handle user page faults in the same way, sending a SIGSEGV immediately when a malformed address is encountered.
Add an assertion to pmap_l1(), which should help catch other bugs of this kind that make it this far.
Reviewed by: jrtc27, markj MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D31208
(cherry picked from commit 4a9f2f8b07c2d1a1c12f4aabdccd36f56b20cfda)
show more ...
|
| 89f34929 | 26-Oct-2020 |
Mitchell Horne <[email protected]> |
riscv: make use of SBI legacy replacement extensions
Version 0.2 of the SBI specification [1] marked the existing SBI functions as "legacy" in order to move to a newer calling convention. It also in
riscv: make use of SBI legacy replacement extensions
Version 0.2 of the SBI specification [1] marked the existing SBI functions as "legacy" in order to move to a newer calling convention. It also introduced a set of replacement extensions for some of the legacy functionality. In particular, the TIME, IPI, and RFENCE extensions implement and extend the semantics of their legacy counterparts, while conforming to the newer version of the spec.
Update our SBI code to use the new replacement extensions when available, and fall back to the legacy ones. These will eventually be dropped, when support for version 0.2 is ubiquitous.
[1] https://github.com/riscv/riscv-sbi-doc/blob/master/riscv-sbi.adoc
Submitted by: Danjel Q. <[email protected]> Reviewed by: kp Differential Revision: https://reviews.freebsd.org/D26953
show more ...
|