Skip to content
Merged
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
9 changes: 9 additions & 0 deletions nativeunwind/stackdeltatypes/stackdeltatypes.go
Original file line number Diff line number Diff line change
Expand Up @@ -76,6 +76,15 @@ type IntervalData struct {
func (deltas *StackDeltaArray) AddEx(delta StackDelta, sorted bool) {
num := len(*deltas)
if delta.Info.Flags&support.UnwindFlagCommand != 0 {
if delta.Info.Param == support.UnwindCommandSignal {
// EBPF code does a -1 fixup for return addresses.
// To match the signal handler function injected into
// stack, the signal handler stack delta must start one
// byte earlier to accommodate for the ebpf fixup.
// C-libraries will have a 'nop' inserted to make sure
// nothing conflicts.
delta.Address--
}
// FP information is invalid/unused for command opcodes.
// But DWARF info often leaves bogus data there, so resetting it
// reduces the number of unique Info contents generated.
Expand Down
2 changes: 1 addition & 1 deletion processmanager/execinfomanager/synthdeltas.go
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ func createVDSOSyntheticRecordArm64(ef *pfelf.File) sdtypes.IntervalData {
if sym.Name == "__kernel_rt_sigreturn" {
deltas = append(
deltas,
sdtypes.StackDelta{Address: addr, Info: sdtypes.UnwindInfoSignal},
sdtypes.StackDelta{Address: addr - 1, Info: sdtypes.UnwindInfoSignal},
sdtypes.StackDelta{Address: addr + sym.Size, Info: sdtypes.UnwindInfoLR},
)
return true
Expand Down
2 changes: 1 addition & 1 deletion processmanager/execinfomanager/synthdeltas_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ func TestVDSOArm64(t *testing.T) {
{Address: 0x7e4, Info: sdtypes.UnwindInfoLR},
{Address: 0x800, Info: frameSize16},
{Address: 0x80c, Info: sdtypes.UnwindInfoLR},
{Address: 0x8f8, Info: sdtypes.UnwindInfoSignal},
{Address: 0x8f7, Info: sdtypes.UnwindInfoSignal},
{Address: 0x900, Info: sdtypes.UnwindInfoLR},
},
}
Expand Down
25 changes: 9 additions & 16 deletions support/ebpf/native_stack_trace.ebpf.c
Original file line number Diff line number Diff line change
Expand Up @@ -157,46 +157,39 @@ 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 exe_id = state->text_section_id;
unsigned long exe_id = state->text_section_id;
unsigned long offset = state->text_section_offset - (int)state->return_address;

// 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;
DEBUG_PRINT(
"Look up stack delta for %lx:%lx",
(unsigned long)state->text_section_id,
(unsigned long)state->text_section_offset);
key.fileID = exe_id;
key.page = offset & ~STACK_DELTA_PAGE_MASK;
DEBUG_PRINT("Look up stack delta for %lx:%lx", exe_id, offset);
StackDeltaPageInfo *info = bpf_map_lookup_elem(&stack_delta_page_to_info, &key);
if (!info) {
DEBUG_PRINT(
"Failure to look up stack delta page fileID %lx, page %lx",
(unsigned long)key.fileID,
(unsigned long)key.page);
DEBUG_PRINT("Failure to look up stack delta page fileID %lx, page %lx", exe_id, offset);
state->error_metric = metricID_UnwindNativeErrLookupTextSection;
return ERR_NATIVE_LOOKUP_TEXT_SECTION;
}

void *outer_map = get_stack_delta_map(info->mapID);
if (!outer_map) {
DEBUG_PRINT(
"Failure to look up outer map for text section %lx in mapID %d",
(unsigned long)exe_id,
(int)info->mapID);
"Failure to look up outer map for text section %lx in mapID %d", exe_id, (int)info->mapID);
state->error_metric = metricID_UnwindNativeErrLookupStackDeltaOuterMap;
return ERR_NATIVE_LOOKUP_STACK_DELTA_OUTER_MAP;
}

void *inner_map = bpf_map_lookup_elem(outer_map, &exe_id);
if (!inner_map) {
DEBUG_PRINT("Failure to look up inner map for text section %lx", (unsigned long)exe_id);
DEBUG_PRINT("Failure to look up inner map for text section %lx", exe_id);
state->error_metric = metricID_UnwindNativeErrLookupStackDeltaInnerMap;
return ERR_NATIVE_LOOKUP_STACK_DELTA_INNER_MAP;
}

// 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 = 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.
2 changes: 1 addition & 1 deletion tools/coredump/testdata/amd64/dotnet10-alpine3.23.json
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"ld-musl-x86_64.so.1+0x6799f",
"ld-musl-x86_64.so.1+0x6731a",
"ld-musl-x86_64.so.1+0x6757a",
"<unwinding aborted due to error native_zero_pc>"
"ld-musl-x86_64.so.1+0x68ec0"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,10 @@
"libjvm.so+0xbfe27b",
"libjvm.so+0xe59ff7",
"libjvm.so+0xe5a08f",
"<unwinding aborted due to error native_lr_unwinding_mid_trace>"
"libjvm.so+0xdc3dcb",
"libjvm.so+0xb56fbb",
"libc.so.6+0x7edd7",
"libc.so.6+0xe7e5b"
]
},
{
Expand All @@ -66,7 +69,10 @@
"libjvm.so+0xbfe27b",
"libjvm.so+0xe59ff7",
"libjvm.so+0xe5a08f",
"<unwinding aborted due to error native_lr_unwinding_mid_trace>"
"libjvm.so+0xdc3dcb",
"libjvm.so+0xb56fbb",
"libc.so.6+0x7edd7",
"libc.so.6+0xe7e5b"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,7 +121,10 @@
"libjvm.so+0xc09c1b",
"libjvm.so+0xe597f7",
"libjvm.so+0xe5988f",
"<unwinding aborted due to error native_lr_unwinding_mid_trace>"
"libjvm.so+0xdc5633",
"libjvm.so+0xb63fbb",
"libpthread-2.33.so+0x6f3b",
"libc-2.33.so+0xd2cdb"
]
},
{
Expand All @@ -148,7 +151,10 @@
"libjvm.so+0xc09c1b",
"libjvm.so+0xe597f7",
"libjvm.so+0xe5988f",
"<unwinding aborted due to error native_lr_unwinding_mid_trace>"
"libjvm.so+0xdc5633",
"libjvm.so+0xb63fbb",
"libpthread-2.33.so+0x6f3b",
"libc-2.33.so+0xd2cdb"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,10 @@
"libjvm.so+0xc09c1b",
"libjvm.so+0xe597f7",
"libjvm.so+0xe5988f",
"<unwinding aborted due to error native_lr_unwinding_mid_trace>"
"libjvm.so+0xdc5633",
"libjvm.so+0xb63fbb",
"libpthread-2.33.so+0x6f3b",
"libc-2.33.so+0xd2cdb"
]
},
{
Expand Down Expand Up @@ -262,7 +265,10 @@
"libjvm.so+0xc09c1b",
"libjvm.so+0xe597f7",
"libjvm.so+0xe5988f",
"<unwinding aborted due to error native_lr_unwinding_mid_trace>"
"libjvm.so+0xdc5633",
"libjvm.so+0xb63fbb",
"libpthread-2.33.so+0x6f3b",
"libc-2.33.so+0xd2cdb"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@
"libjvm.so+0xc09c1b",
"libjvm.so+0xe597f7",
"libjvm.so+0xe5988f",
"<unwinding aborted due to error native_lr_unwinding_mid_trace>"
"libjvm.so+0xdc5633",
"libjvm.so+0xb63fbb",
"libpthread-2.33.so+0x6f3b",
"libc-2.33.so+0xd2cdb"
]
},
{
Expand Down Expand Up @@ -173,7 +176,10 @@
"libjvm.so+0xc09c1b",
"libjvm.so+0xe597f7",
"libjvm.so+0xe5988f",
"<unwinding aborted due to error native_lr_unwinding_mid_trace>"
"libjvm.so+0xdc5633",
"libjvm.so+0xb63fbb",
"libpthread-2.33.so+0x6f3b",
"libc-2.33.so+0xd2cdb"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,10 @@
"libjvm.so+0xc09c1b",
"libjvm.so+0xe597f7",
"libjvm.so+0xe5988f",
"<unwinding aborted due to error native_lr_unwinding_mid_trace>"
"libjvm.so+0xdc5633",
"libjvm.so+0xb63fbb",
"libpthread-2.33.so+0x6f3b",
"libc-2.33.so+0xd2cdb"
]
},
{
Expand Down Expand Up @@ -116,7 +119,10 @@
"libjvm.so+0xc09c1b",
"libjvm.so+0xe597f7",
"libjvm.so+0xe5988f",
"<unwinding aborted due to error native_lr_unwinding_mid_trace>"
"libjvm.so+0xdc5633",
"libjvm.so+0xb63fbb",
"libpthread-2.33.so+0x6f3b",
"libc-2.33.so+0xd2cdb"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,10 @@
"libjvm.so+0xc09c1b",
"libjvm.so+0xe597f7",
"libjvm.so+0xe5988f",
"<unwinding aborted due to error native_lr_unwinding_mid_trace>"
"libjvm.so+0xdc5633",
"libjvm.so+0xb63fbb",
"libpthread-2.33.so+0x6f3b",
"libc-2.33.so+0xd2cdb"
]
},
{
Expand Down Expand Up @@ -156,7 +159,10 @@
"libjvm.so+0xc09c1b",
"libjvm.so+0xe597f7",
"libjvm.so+0xe5988f",
"<unwinding aborted due to error native_lr_unwinding_mid_trace>"
"libjvm.so+0xdc5633",
"libjvm.so+0xb63fbb",
"libpthread-2.33.so+0x6f3b",
"libc-2.33.so+0xd2cdb"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,10 @@
"libjvm.so+0xc09c1b",
"libjvm.so+0xe597f7",
"libjvm.so+0xe5988f",
"<unwinding aborted due to error native_lr_unwinding_mid_trace>"
"libjvm.so+0xdc5633",
"libjvm.so+0xb63fbb",
"libpthread-2.33.so+0x6f3b",
"libc-2.33.so+0xd2cdb"
]
},
{
Expand Down Expand Up @@ -286,7 +289,10 @@
"libjvm.so+0xc09c1b",
"libjvm.so+0xe597f7",
"libjvm.so+0xe5988f",
"<unwinding aborted due to error native_lr_unwinding_mid_trace>"
"libjvm.so+0xdc5633",
"libjvm.so+0xb63fbb",
"libpthread-2.33.so+0x6f3b",
"libc-2.33.so+0xd2cdb"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
"libruby.so.3.3.9+0x2ac5cf",
"libruby.so.3.3.9+0x2aca0b",
"libruby.so.3.3.9+0x2ac8e7",
"<unwinding aborted due to error native_lr_unwinding_mid_trace>"
"<unwinding aborted due to error native_zero_pc>"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@
"libruby.so.3.4.5+0x2ce9f7",
"libruby.so.3.4.5+0x2cefbf",
"libruby.so.3.4.5+0x2cee9f",
"<unwinding aborted due to error native_lr_unwinding_mid_trace>"
"<unwinding aborted due to error native_zero_pc>"
]
},
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
"libruby.so.3.5.0+0x2c6a47",
"libruby.so.3.5.0+0x2c700b",
"libruby.so.3.5.0+0x2c6eeb",
"<unwinding aborted due to error native_lr_unwinding_mid_trace>"
"<unwinding aborted due to error native_zero_pc>"
]
},
{
Expand Down
Loading