Page MenuHomeFreeBSD

riscv: handle misaligned address exceptions
ClosedPublic

Authored by mhorne on Oct 4 2022, 4:04 PM.
Tags
None
Referenced Files
Unknown Object (File)
Feb 9 2024, 4:44 AM
Unknown Object (File)
Dec 12 2023, 4:36 PM
Unknown Object (File)
Sep 19 2023, 12:09 PM
Unknown Object (File)
Aug 6 2023, 3:17 PM
Unknown Object (File)
Aug 5 2023, 11:05 PM
Unknown Object (File)
Aug 5 2023, 11:04 PM
Unknown Object (File)
Aug 5 2023, 11:03 PM
Unknown Object (File)
Aug 5 2023, 10:55 PM
Subscribers

Details

Summary

If this exception is coming from userspace, send the appropriate SIGBUS
to the process. If it's coming from the kernel this is still fatal, but
we can give a better panic message.

With this, we now handle all defined exception types.

PR: 266109
Found by: syzkaller
Reported by: P1umer <p1umer1337@gmail.com>

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

mhorne requested review of this revision.Oct 4 2022, 4:04 PM

In theory these should be impossible[1] because firmware is meant to emulate them when not supported. There's nothing wrong with being prepared to handle cases where they aren't emulated but I'm curious in what situations they occur. Maybe misaligned atomics, which can't be safely emulated?

[1] Except on CHERI, as CHERI capabilities have to be stored at aligned locations, so we have this kind of diff downstream for load/store misaligned from userspace, guarded by whether it's a CHERI kernel

In theory these should be impossible[1] because firmware is meant to emulate them when not supported. There's nothing wrong with being prepared to handle cases where they aren't emulated but I'm curious in what situations they occur. Maybe misaligned atomics, which can't be safely emulated?

[1] Except on CHERI, as CHERI capabilities have to be stored at aligned locations, so we have this kind of diff downstream for load/store misaligned from userspace, guarded by whether it's a CHERI kernel

Indeed, misaligned atomics can trigger the panic seen in the report, while normal loads/stores are emulated properly.

This revision was not accepted when it landed; it landed in state Needs Review.Oct 11 2022, 1:40 PM
This revision was automatically updated to reflect the committed changes.