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)
Wed, Dec 4, 10:26 PM
Unknown Object (File)
Nov 25 2024, 7:06 AM
Unknown Object (File)
Nov 23 2024, 11:07 PM
Unknown Object (File)
Nov 21 2024, 12:22 PM
Unknown Object (File)
Nov 20 2024, 6:37 PM
Unknown Object (File)
Nov 20 2024, 6:35 PM
Unknown Object (File)
Nov 8 2024, 5:22 PM
Unknown Object (File)
Nov 7 2024, 5:25 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 Not Applicable
Unit
Tests Not Applicable

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.