Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions support/ebpf/interpreter_dispatcher.ebpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -763,6 +763,7 @@ static EBPF_INLINE int unwind_stop(struct pt_regs *ctx)
increment_metric(metricID_NumUnknownPC);
}
// Fallthrough to report the error
[[fallthrough]];
default: increment_metric(state->error_metric);
}

Expand Down
9 changes: 6 additions & 3 deletions support/ebpf/native_stack_trace.ebpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -137,16 +137,19 @@ static EBPF_INLINE void *get_stack_delta_map(int mapID)
// Get the stack offset of the given instruction.
static EBPF_INLINE ErrorCode get_stack_delta(UnwindState *state, int *addrDiff, u32 *unwindInfo)
{
u64 text_section_offset = state->text_section_offset;
if (state->return_address)
--text_section_offset;
u64 exe_id = state->text_section_id;

// Look up the stack delta page information for this address.
StackDeltaPageKey key = {};
key.fileID = state->text_section_id;
key.page = state->text_section_offset & ~STACK_DELTA_PAGE_MASK;
key.page = text_section_offset & ~STACK_DELTA_PAGE_MASK;
DEBUG_PRINT(
"Look up stack delta for %lx:%lx",
(unsigned long)state->text_section_id,
(unsigned long)state->text_section_offset);
(unsigned long)text_section_offset);
StackDeltaPageInfo *info = bpf_map_lookup_elem(&stack_delta_page_to_info, &key);
if (!info) {
DEBUG_PRINT(
Expand Down Expand Up @@ -176,7 +179,7 @@ static EBPF_INLINE ErrorCode get_stack_delta(UnwindState *state, int *addrDiff,

// Preinitialize the idx for the index to use for page without any deltas.
u32 idx = info->firstDelta;
u16 page_offset = state->text_section_offset & STACK_DELTA_PAGE_MASK;
u16 page_offset = text_section_offset & STACK_DELTA_PAGE_MASK;
if (info->numDeltas) {
// Page has deltas, so find the correct one to use using binary search.
u32 lo = info->firstDelta;
Expand Down
Binary file modified support/ebpf/tracer.ebpf.amd64
Binary file not shown.
Binary file modified support/ebpf/tracer.ebpf.arm64
Binary file not shown.
30 changes: 30 additions & 0 deletions tools/coredump/testdata/arm64/rust-debug-offbyone.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
{
"coredump-ref": "517028a6d45241ed202e81083d836a47469e68a1345d7be7860f8127b5823d90",
"threads": [
{
"lwp": 3428,
"frames": [
"test_rust+0x12f60",
"test_rust+0x12f83",
"test_rust+0x12fa7",
"test_rust+0x1317f",
"test_rust+0x1303f",
"test_rust+0x1312b",
"test_rust+0x2be73",
"test_rust+0x13103",
"test_rust+0x1301f",
"<unwinding aborted due to error native_no_pid_page_mapping>"
]
}
],
"modules": [
{
"ref": "36d6ee161f7831c61ecad24a80fc26d8a7221db3907639c6f078d59bbadc2549",
"local-path": "/home/brennan/test_rust/target/debug/test_rust"
},
{
"ref": "a5945db37288c7ccf89169b911fa7ac634e7d2434a0b8287e485cf5ea98d5646",
"local-path": "/gnu/store/50jqiigxwa1s9xljqrl1wh85yncqnybr-glibc-2.41/lib/ld-linux-aarch64.so.1"
}
]
}
Loading