Skip to content

Commit

Permalink
fixup: provide arm64 tracer blob
Browse files Browse the repository at this point in the history
Signed-off-by: Florian Lehner <[email protected]>
  • Loading branch information
florianl committed Oct 20, 2024
1 parent bd87429 commit 70e92b3
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 24 deletions.
24 changes: 0 additions & 24 deletions support/ebpf/native_stack_trace.ebpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -84,30 +84,6 @@ ErrorCode push_native(Trace *trace, u64 file, u64 line, bool return_address) {
return _push_with_return_address(trace, file, line, FRAME_MARKER_NATIVE, return_address);
}

#ifdef __aarch64__
// Strips the PAC tag from a pointer.
//
// While all pointers can contain PAC tags, we only apply this function to code pointers, because
// that's where normalization is required to make the stack delta lookups work. Note that if that
// should ever change, we'd need a different mask for the data pointers, because it might diverge
// from the mask for code pointers.
static inline u64 normalize_pac_ptr(u64 ptr) {
// Retrieve PAC mask from the system config.
u32 key = 0;
SystemConfig* syscfg = bpf_map_lookup_elem(&system_config, &key);
if (!syscfg) {
// Unreachable: array maps are always fully initialized.
return ptr;
}

// Mask off PAC bits. Since we're always applying this to usermode pointers that should have all
// the high bits set to 0, we don't need to consider the case of having to fill up the resulting
// hole with 1s (like we'd have to for kernel ptrs).
ptr &= syscfg->inverse_pac_mask;
return ptr;
}
#endif

// A single step for the bsearch into the big_stack_deltas array. This is really a textbook bsearch
// step, built in a way to update the value of *lo and *hi. This function will be called repeatedly
// (since we cannot do loops). The return value signals whether the bsearch came to an end / found
Expand Down
24 changes: 24 additions & 0 deletions support/ebpf/tracemgmt.h
Original file line number Diff line number Diff line change
Expand Up @@ -455,6 +455,30 @@ void tail_call(void *ctx, int next) {
#define __USER_DS (GDT_ENTRY_DEFAULT_USER_DS*8 + 3)
#endif

#ifdef __aarch64__
// Strips the PAC tag from a pointer.
//
// While all pointers can contain PAC tags, we only apply this function to code pointers, because
// that's where normalization is required to make the stack delta lookups work. Note that if that
// should ever change, we'd need a different mask for the data pointers, because it might diverge
// from the mask for code pointers.
static inline u64 normalize_pac_ptr(u64 ptr) {
// Retrieve PAC mask from the system config.
u32 key = 0;
SystemConfig* syscfg = bpf_map_lookup_elem(&system_config, &key);
if (!syscfg) {
// Unreachable: array maps are always fully initialized.
return ptr;
}

// Mask off PAC bits. Since we're always applying this to usermode pointers that should have all
// the high bits set to 0, we don't need to consider the case of having to fill up the resulting
// hole with 1s (like we'd have to for kernel ptrs).
ptr &= syscfg->inverse_pac_mask;
return ptr;
}
#endif

// Initialize state from pt_regs
static inline ErrorCode copy_state_regs(UnwindState *state,
struct pt_regs *regs,
Expand Down
Binary file modified support/ebpf/tracer.ebpf.release.arm64
Binary file not shown.

0 comments on commit 70e92b3

Please sign in to comment.