Page MenuHomeFreeBSD

hwpmc: simplify arm64 kernel stack unwinding
ClosedPublic

Authored by mhorne on May 2 2023, 3:03 PM.
Tags
None
Referenced Files
Unknown Object (File)
Fri, Nov 8, 5:22 PM
Unknown Object (File)
Thu, Nov 7, 5:25 AM
Unknown Object (File)
Wed, Nov 6, 10:23 PM
Unknown Object (File)
Oct 17 2024, 1:25 AM
Unknown Object (File)
Oct 15 2024, 4:14 AM
Unknown Object (File)
Oct 13 2024, 10:30 AM
Unknown Object (File)
Oct 11 2024, 2:38 PM
Unknown Object (File)
Oct 10 2024, 11:04 AM
Subscribers

Details

Summary

Use the unwind_frame() function, which properly validates the frame
pointer and uses ADDR_MAKE_CANONICAL() for the pc, required when PAC is
enabled.

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 51319
Build 48210: arc lint + arc unit

Event Timeline

mhorne requested review of this revision.May 2 2023, 3:03 PM

FYI, locally I have a STACK_FOREACH() addition to the stack(9) KPI which would give us an MI way to loop through the list of PC addresses after a call to stack_save(). Possibly this can be used to simplify this or other cases further, at a small cost.

It is still half-baked, and not something I plan to tackle immediately.

This revision is now accepted and ready to land.May 2 2023, 5:48 PM
sys/dev/hwpmc/hwpmc_arm64_md.c
91

unwind_frame() doesn't check whether the returned PC is in the kernel, so this represents a behaviour change.

Add back the check for PMC_IN_KERNEL(pc).

This revision now requires review to proceed.May 3 2023, 3:03 PM
mhorne added inline comments.
sys/dev/hwpmc/hwpmc_arm64_md.c
91

Thank you, great catch.

This revision is now accepted and ready to land.May 3 2023, 5:30 PM
This revision was automatically updated to reflect the committed changes.
mhorne marked an inline comment as done.