mirror of
https://github.com/kubeshark/kubeshark.git
synced 2025-08-06 11:05:08 +00:00
* Determine the Go ABI and get `goid` offset from DWARF
* Add `ABI` enum and morph the function according to the detected ABI
* Pass `goid` offset to an eBPF map to retrieve it in eBPF context
* Add `vmlinux.h` and implement `get_goid_from_thread_local_storage`
* Fix BPF verifier errors
* Update the comments
* Add `go_abi_0.h` and implement `ABI0` specific reads for `arm64`
* Upgrade `github.com/cilium/ebpf` to `v0.9.0`
* Add a comment
* Add macros for x86 specific parts
* Update `x86.o`
* Fix the map key type
* Add `user_pt_regs`
* Update arm64 object file
* Fix the version detection logic
* Add `getGStructOffset` method
* Define `goid_offsets`, `goid_offsets_map` structs and pass the offsets correctly
* Fix the `net.TCPConn` and buffer addresses for `ABI0`
* Remove comment
* Fix the issues for arm64 build
* Update x86.o
* Revert "Fix the issues for arm64 build"
This reverts commit 48b041b1b6
.
* Revert `user_pt_regs`
* Add `vmlinux` directory
* Fix the `build.sh` and `Dockerfile`
* Add vmlinux_arm64.h
* Disable `get_goid_from_thread_local_storage` on ARM64 with a macro
* Update x86.o
* Update arm64.o
* x86
* arm64
* Fix the cross-compilation issue from x86 to arm64
* Fix the same thing for x86
* Use `BPF_CORE_READ` macro instead of `bpf_ringbuf_reserve` to support kernel versions older than 5.8
Also;
Add legacy version of thread_struct: thread_struct___v46
Build an additional object file for the kernel versions older than or equal to 4.6 and load them accordingly.
Add github.com/moby/moby
* Make #define directives more definitive
* Select the x86 and arm64 versions of `vmlinux.h` using macros
* Put `goid` offsets into the map before installing `uprobe`(s)
* arm64
* #run_acceptance_tests
* Remove a forgotten `fmt.Printf`
* Log the detected Linux kernel version
56 lines
1.4 KiB
C
56 lines
1.4 KiB
C
/*
|
|
Note: This file is licenced differently from the rest of the project
|
|
SPDX-License-Identifier: GPL-2.0
|
|
Copyright (C) UP9 Inc.
|
|
*/
|
|
|
|
#ifndef __TARGET_ARCH__
|
|
#define __TARGET_ARCH__
|
|
|
|
/* Scan the ARCH passed in from ARCH env variable */
|
|
#if defined(__TARGET_ARCH_x86)
|
|
#define bpf_target_x86
|
|
#define bpf_target_defined
|
|
#elif defined(__TARGET_ARCH_s390)
|
|
#define bpf_target_s390
|
|
#define bpf_target_defined
|
|
#elif defined(__TARGET_ARCH_arm)
|
|
#define bpf_target_arm
|
|
#define bpf_target_defined
|
|
#elif defined(__TARGET_ARCH_arm64)
|
|
#define bpf_target_arm64
|
|
#define bpf_target_defined
|
|
#elif defined(__TARGET_ARCH_mips)
|
|
#define bpf_target_mips
|
|
#define bpf_target_defined
|
|
#elif defined(__TARGET_ARCH_powerpc)
|
|
#define bpf_target_powerpc
|
|
#define bpf_target_defined
|
|
#elif defined(__TARGET_ARCH_sparc)
|
|
#define bpf_target_sparc
|
|
#define bpf_target_defined
|
|
#else
|
|
#undef bpf_target_defined
|
|
#endif
|
|
|
|
/* Fall back to what the compiler says */
|
|
#ifndef bpf_target_defined
|
|
#if defined(__x86_64__)
|
|
#define bpf_target_x86
|
|
#elif defined(__s390__)
|
|
#define bpf_target_s390
|
|
#elif defined(__arm__)
|
|
#define bpf_target_arm
|
|
#elif defined(__aarch64__)
|
|
#define bpf_target_arm64
|
|
#elif defined(__mips__)
|
|
#define bpf_target_mips
|
|
#elif defined(__powerpc__)
|
|
#define bpf_target_powerpc
|
|
#elif defined(__sparc__)
|
|
#define bpf_target_sparc
|
|
#endif
|
|
#endif
|
|
|
|
#endif /* __TARGET_ARCH__ */
|