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)
Sep 25 2024, 4:37 PM
Unknown Object (File)
Sep 25 2024, 4:36 PM
Unknown Object (File)
Sep 25 2024, 4:36 PM
Unknown Object (File)
Sep 25 2024, 4:24 PM
Unknown Object (File)
Sep 24 2024, 6:33 PM
Unknown Object (File)
Sep 24 2024, 5:22 AM
Unknown Object (File)
Sep 23 2024, 9:55 AM
Unknown Object (File)
Sep 19 2024, 5:26 AM
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.