Page MenuHomeFreeBSD

hwpmc: simplify arm64 kernel stack unwinding
ClosedPublic

Authored by mhorne on May 2 2023, 3:03 PM.
Tags
None
Referenced Files
F167772654: D39934.id.diff
Mon, Aug 24, 10:38 AM
Unknown Object (File)
Sun, Aug 23, 8:26 AM
Unknown Object (File)
Sat, Aug 22, 10:24 AM
Unknown Object (File)
Sat, Aug 22, 5:58 AM
Unknown Object (File)
Fri, Aug 21, 4:29 PM
Unknown Object (File)
Thu, Aug 20, 5:19 AM
Unknown Object (File)
Tue, Aug 18, 7:11 PM
Unknown Object (File)
Sun, Aug 16, 4:25 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 51311
Build 48202: 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
89

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
89

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.