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
F95549251: D44807.diff
Sat, Sep 21, 11:48 AM
Unknown Object (File)
Sun, Sep 8, 7:45 PM
Unknown Object (File)
Thu, Sep 5, 5:56 PM
Unknown Object (File)
Mon, Sep 2, 11:18 PM
Unknown Object (File)
Mon, Sep 2, 11:57 AM
Unknown Object (File)
Sat, Aug 31, 1:45 PM
Unknown Object (File)
Sat, Aug 31, 1:45 PM
Unknown Object (File)
Sat, Aug 31, 1:45 PM
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.