feat: apply custom labels patch#16
Closed
elsakeirouz wants to merge 1 commit intonsavoire/update_upstreamfrom
Closed
feat: apply custom labels patch#16elsakeirouz wants to merge 1 commit intonsavoire/update_upstreamfrom
elsakeirouz wants to merge 1 commit intonsavoire/update_upstreamfrom
Conversation
elsakeirouz
commented
Apr 18, 2025
- .github/workflows/unit-test-on-pull-request.yml
- Makefile
- customlabelstest/customlabels_test.go
- host/host.go
- interpreter/customlabels/customlabels.go
- libpf/interpretertype.go
- libpf/pfelf/file.go
- libpf/trace.go
- processmanager/ebpf/ebpf.go
- processmanager/execinfomanager/manager.go
- processmanager/manager.go
- remotememory/remotememory.go
- rust-crates/custom-labels-example/Cargo.lock
- rust-crates/custom-labels-example/Cargo.toml
- rust-crates/custom-labels-example/build.rs
- rust-crates/custom-labels-example/src/main.rs
- support/ebpf/interpreter_dispatcher.ebpf.c
- support/ebpf/native_stack_trace.ebpf.c
- support/ebpf/tracemgmt.h
- support/ebpf/tracer.ebpf.amd64
- support/ebpf/types.h
- support/ebpf/util.h
- tools/coredump/coredump.go
- tracer/tracer.go
cb16a5a to
cda6ff4
Compare
62491ea to
877b6e4
Compare
* .github/workflows/unit-test-on-pull-request.yml * Makefile * customlabelstest/customlabels_test.go * host/host.go * interpreter/customlabels/customlabels.go * libpf/interpretertype.go * libpf/pfelf/file.go * libpf/trace.go * processmanager/ebpf/ebpf.go * processmanager/execinfomanager/manager.go * processmanager/manager.go * processmanager/manager_test.go * remotememory/remotememory.go * rust-crates/custom-labels-example/Cargo.lock * rust-crates/custom-labels-example/Cargo.toml * rust-crates/custom-labels-example/build.rs * rust-crates/custom-labels-example/src/main.rs * support/ebpf/interpreter_dispatcher.ebpf.c * support/ebpf/native_stack_trace.ebpf.c * support/ebpf/tracemgmt.h * support/ebpf/tracer.ebpf.amd64 * support/ebpf/types.h * support/ebpf/util.h * testutils/helpers.go * tools/coredump/coredump.go * tracer/tracer.go
877b6e4 to
4a3ba07
Compare
nsavoire
added a commit
that referenced
this pull request
Aug 21, 2025
Go binaries built with -buildmode=pie have slightly different assembly code. On arm64, the runtime.load_g symbol has 2 mov (movz and movk) instructions instead of 1 mov: 0x00000000000c2290 <+0>: adrp x27, 0x2ca000 <runtime.itabTableInit+3072> 0x00000000000c2294 <+4>: ldrsb x0, [x27, #1766] 0x00000000000c2298 <+8>: cbz x0, 0xc22ac <runtime.load_g+28> 0x00000000000c229c <+12>: mrs x0, tpidr_el0 0x00000000000c22a0 <+16>: movz x27, #0x0, lsl #16 0x00000000000c22a4 <+20>: movk x27, #0x10 0x00000000000c22a8 <+24>: ldr x28, [x0, x27] 0x00000000000c22ac <+28>: ret And on amd64, the runtime.stackcheck symbol has also 2 mov instructions instead of 1: 0x00000000007ec320 <+0>: mov $0xfffffffffffffff8,%rcx 0x00000000007ec327 <+7>: mov %fs:(%rcx),%rax This commit fixes the TLS offset retrieval for both architectures. On amd64, it uses amd.Interpreter to find the mov instruction with fs segment and then determine the offset into the segment when displacement is a register. On arm64, it looks for mov or movk instructions (ignoring movz instruction since it seems to always be 0).
nsavoire
added a commit
that referenced
this pull request
Sep 1, 2025
Go binaries built with -buildmode=pie have slightly different assembly code. On arm64, the runtime.load_g symbol has 2 mov (movz and movk) instructions instead of 1 mov: 0x00000000000c2290 <+0>: adrp x27, 0x2ca000 <runtime.itabTableInit+3072> 0x00000000000c2294 <+4>: ldrsb x0, [x27, #1766] 0x00000000000c2298 <+8>: cbz x0, 0xc22ac <runtime.load_g+28> 0x00000000000c229c <+12>: mrs x0, tpidr_el0 0x00000000000c22a0 <+16>: movz x27, #0x0, lsl #16 0x00000000000c22a4 <+20>: movk x27, #0x10 0x00000000000c22a8 <+24>: ldr x28, [x0, x27] 0x00000000000c22ac <+28>: ret And on amd64, the runtime.stackcheck symbol has also 2 mov instructions instead of 1: 0x00000000007ec320 <+0>: mov $0xfffffffffffffff8,%rcx 0x00000000007ec327 <+7>: mov %fs:(%rcx),%rax This commit fixes the TLS offset retrieval for both architectures. On amd64, it uses amd.Interpreter to find the mov instruction with fs segment and then determine the offset into the segment when displacement is a register. On arm64, it looks for mov or movk instructions (ignoring movz instruction since it seems to always be 0).
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.