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)
Tue, Dec 9, 10:33 AM
Unknown Object (File)
Sat, Dec 6, 10:17 PM
Unknown Object (File)
Fri, Dec 5, 11:37 AM
Unknown Object (File)
Wed, Dec 3, 1:33 PM
Unknown Object (File)
Sun, Nov 30, 5:40 AM
Unknown Object (File)
Sun, Nov 23, 10:33 PM
Unknown Object (File)
Sun, Nov 23, 10:28 PM
Unknown Object (File)
Sun, Nov 23, 10:23 PM
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.