diff --git a/devops/linux-x86_64-musl-go-libpcap-capstone/Dockerfile b/devops/linux-x86_64-musl-go-libpcap-capstone/Dockerfile index fc7a40bd5..d413bda76 100644 --- a/devops/linux-x86_64-musl-go-libpcap-capstone/Dockerfile +++ b/devops/linux-x86_64-musl-go-libpcap-capstone/Dockerfile @@ -34,6 +34,6 @@ WORKDIR / # Build and install Capstone from source RUN curl https://github.com/aquynh/capstone/archive/4.0.2.tar.gz -Lo ./capstone.tar.gz \ && tar -xzf capstone.tar.gz && mv ./capstone-* ./capstone -WORKDIR /work/capstone +WORKDIR /capstone RUN ./make.sh \ && ./make.sh install diff --git a/tap/tlstapper/bpf/include/common.h b/tap/tlstapper/bpf/include/common.h index fcffd3e2f..613376396 100644 --- a/tap/tlstapper/bpf/include/common.h +++ b/tap/tlstapper/bpf/include/common.h @@ -7,7 +7,7 @@ Copyright (C) UP9 Inc. #ifndef __COMMON__ #define __COMMON__ -const int32_t invalid_fd = -1; +const __s32 invalid_fd = -1; static int add_address_to_chunk(struct pt_regs *ctx, struct tls_chunk* chunk, __u64 id, __u32 fd); static void send_chunk_part(struct pt_regs *ctx, __u8* buffer, __u64 id, struct tls_chunk* chunk, int start, int end); diff --git a/tap/tlstapper/bpf/include/go_types.h b/tap/tlstapper/bpf/include/go_types.h index b6cd1b78b..c865448c6 100644 --- a/tap/tlstapper/bpf/include/go_types.h +++ b/tap/tlstapper/bpf/include/go_types.h @@ -8,7 +8,7 @@ Copyright (C) UP9 Inc. #define __GO_TYPES__ struct go_interface { - int64_t type; + __s64 type; void* ptr; }; diff --git a/tap/tlstapper/bpf/include/headers.h b/tap/tlstapper/bpf/include/headers.h index 756a92407..8078051af 100644 --- a/tap/tlstapper/bpf/include/headers.h +++ b/tap/tlstapper/bpf/include/headers.h @@ -8,7 +8,6 @@ Copyright (C) UP9 Inc. #define __HEADERS__ #include -#include #include #include #include diff --git a/tap/tlstapper/go_offsets.go b/tap/tlstapper/go_offsets.go index 2a202382f..5a10d6110 100644 --- a/tap/tlstapper/go_offsets.go +++ b/tap/tlstapper/go_offsets.go @@ -5,6 +5,7 @@ import ( "debug/elf" "fmt" "os" + "runtime" "github.com/Masterminds/semver" "github.com/cilium/ebpf/link" @@ -66,10 +67,21 @@ func findGoOffsets(filePath string) (goOffsets, error) { func getOffsets(filePath string) (offsets map[string]*goExtendedOffset, err error) { var engine gapstone.Engine - engine, err = gapstone.New( - gapstone.CS_ARCH_X86, - gapstone.CS_MODE_64, - ) + switch runtime.GOARCH { + case "amd64": + engine, err = gapstone.New( + gapstone.CS_ARCH_X86, + gapstone.CS_MODE_64, + ) + case "arm64": + engine, err = gapstone.New( + gapstone.CS_ARCH_ARM64, + gapstone.CS_MODE_ARM, + ) + default: + err = fmt.Errorf("Unsupported architecture: %v", runtime.GOARCH) + return + } if err != nil { return } diff --git a/tap/tlstapper/tlstapper_bpfeb.o b/tap/tlstapper/tlstapper_bpfeb.o index 2a68d1638..ce984dfd4 100644 Binary files a/tap/tlstapper/tlstapper_bpfeb.o and b/tap/tlstapper/tlstapper_bpfeb.o differ diff --git a/tap/tlstapper/tlstapper_bpfel.o b/tap/tlstapper/tlstapper_bpfel.o index bf73cf269..42e336f51 100644 Binary files a/tap/tlstapper/tlstapper_bpfel.o and b/tap/tlstapper/tlstapper_bpfel.o differ