Page MenuHomeFreeBSD

arm64: Clear td_frame when returning to userspace
AcceptedPublic

Authored by andrew on Apr 16 2024, 3:43 PM.
Tags
None
Referenced Files
F85545691: D44807.diff
Fri, Jun 7, 9:31 AM
Unknown Object (File)
Wed, Jun 5, 10:10 AM
Unknown Object (File)
Thu, May 23, 9:33 PM
Unknown Object (File)
Tue, May 21, 11:43 AM
Unknown Object (File)
Apr 27 2024, 12:44 AM
Unknown Object (File)
Apr 26 2024, 5:13 AM
Unknown Object (File)
Apr 18 2024, 5:21 PM
Subscribers

Details

Reviewers
kib
markj
imp
manu
Group Reviewers
arm64
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.Thu, May 23, 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.