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
Unknown Object (File)
Sat, Nov 9, 10:21 AM
Unknown Object (File)
Thu, Nov 7, 11:16 AM
Unknown Object (File)
Mon, Oct 21, 10:38 PM
Unknown Object (File)
Sat, Oct 19, 5:21 PM
Unknown Object (File)
Sat, Oct 19, 5:21 PM
Unknown Object (File)
Sat, Oct 19, 5:10 PM
Unknown Object (File)
Fri, Oct 18, 5:15 AM
Unknown Object (File)
Thu, Oct 17, 5:55 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 Skipped
Unit
Tests Skipped
Build Status
Buildable 57122
Build 54010: arc lint + arc unit

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.