Page MenuHomeFreeBSD

arm64: Clear td_frame when returning to userspace
ClosedPublic

Authored by andrew on Apr 16 2024, 3:43 PM.
Tags
None
Referenced Files
F89081959: D44807.id137102.diff
Tue, Jul 23, 7:48 AM
Unknown Object (File)
Fri, Jul 5, 10:45 AM
Unknown Object (File)
Thu, Jul 4, 1:04 AM
Unknown Object (File)
Sun, Jun 30, 11:03 PM
Unknown Object (File)
Thu, Jun 27, 6:40 PM
Unknown Object (File)
Jun 22 2024, 12:05 AM
Unknown Object (File)
Jun 12 2024, 4:01 PM
Unknown Object (File)
Jun 7 2024, 9:31 AM
Subscribers

Details

Summary

When returning from an exception to userspace clear the saved td_frame.
On the next exception this should point to the frame, however this is
not guaranteed.

To ensure the trap frame pointer is either valid or NULL clear it
before returning to userspace in the EL0 synchronous exception handler.

Sponsored by: Arm Ltd

Diff Detail

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

Event Timeline

Do you mean that td_frame is not constant on arm64?

There are some special registers that an irq may not update, e.g. esr_el1 is not touched so it will be an unknown value based on the most recent synchronous exception.

This revision is now accepted and ready to land.May 23 2024, 7:20 PM

There are some special registers that an irq may not update, e.g. esr_el1 is not touched so it will be an unknown value based on the most recent synchronous exception.

There is no esr_el1 field, and as far as I can see tf_esr is always set. Is there some related patch which adds fields to the trapframe?

esr_el1 is stored in tf_esr, however the CPU will only set the register on some exceptions. This means we store it in an interrupt, but its value is based on the last synchronous exception.