From 48b041b1b60526658a1fa8774e5b24708af5b8a3 Mon Sep 17 00:00:00 2001 From: "M. Mert Yildiran" Date: Thu, 30 Jun 2022 22:20:15 +0300 Subject: [PATCH] Fix the issues for arm64 build --- tap/tlstapper/bpf/include/headers.h | 1 + tap/tlstapper/bpf/include/vmlinux.h | 6 +++--- tap/tlstapper/tlstapper_bpfel_arm64.go | 11 ++++++++--- 3 files changed, 12 insertions(+), 6 deletions(-) diff --git a/tap/tlstapper/bpf/include/headers.h b/tap/tlstapper/bpf/include/headers.h index a173fd512..213181189 100644 --- a/tap/tlstapper/bpf/include/headers.h +++ b/tap/tlstapper/bpf/include/headers.h @@ -7,6 +7,7 @@ Copyright (C) UP9 Inc. #ifndef __HEADERS__ #define __HEADERS__ +#include #include "vmlinux.h" #include #include "bpf/bpf_tracing.h" diff --git a/tap/tlstapper/bpf/include/vmlinux.h b/tap/tlstapper/bpf/include/vmlinux.h index 79b8922e8..4828e3462 100644 --- a/tap/tlstapper/bpf/include/vmlinux.h +++ b/tap/tlstapper/bpf/include/vmlinux.h @@ -55746,15 +55746,15 @@ struct getdents_callback___2 { int sequence; }; -typedef u16 wchar_t; +typedef u16 vm_wchar_t; typedef u32 unicode_t; struct nls_table { const char *charset; const char *alias; - int (*uni2char)(wchar_t, unsigned char *, int); - int (*char2uni)(const unsigned char *, int, wchar_t *); + int (*uni2char)(vm_wchar_t, unsigned char *, int); + int (*char2uni)(const unsigned char *, int, vm_wchar_t *); const unsigned char *charset2lower; const unsigned char *charset2upper; struct module *owner; diff --git a/tap/tlstapper/tlstapper_bpfel_arm64.go b/tap/tlstapper/tlstapper_bpfel_arm64.go index 4ef3a7794..73c776b90 100644 --- a/tap/tlstapper/tlstapper_bpfel_arm64.go +++ b/tap/tlstapper/tlstapper_bpfel_arm64.go @@ -13,6 +13,11 @@ import ( "github.com/cilium/ebpf" ) +type tlsTapperGoidOffsets struct { + G_addrOffset uint64 + GoidOffset uint64 +} + type tlsTapperTlsChunk struct { Pid uint32 Tgid uint32 @@ -100,7 +105,7 @@ type tlsTapperMapSpecs struct { FileDescriptorToIpv4 *ebpf.MapSpec `ebpf:"file_descriptor_to_ipv4"` GoReadContext *ebpf.MapSpec `ebpf:"go_read_context"` GoWriteContext *ebpf.MapSpec `ebpf:"go_write_context"` - GoidOffsetMap *ebpf.MapSpec `ebpf:"goid_offset_map"` + GoidOffsetsMap *ebpf.MapSpec `ebpf:"goid_offsets_map"` Heap *ebpf.MapSpec `ebpf:"heap"` LogBuffer *ebpf.MapSpec `ebpf:"log_buffer"` OpensslReadContext *ebpf.MapSpec `ebpf:"openssl_read_context"` @@ -134,7 +139,7 @@ type tlsTapperMaps struct { FileDescriptorToIpv4 *ebpf.Map `ebpf:"file_descriptor_to_ipv4"` GoReadContext *ebpf.Map `ebpf:"go_read_context"` GoWriteContext *ebpf.Map `ebpf:"go_write_context"` - GoidOffsetMap *ebpf.Map `ebpf:"goid_offset_map"` + GoidOffsetsMap *ebpf.Map `ebpf:"goid_offsets_map"` Heap *ebpf.Map `ebpf:"heap"` LogBuffer *ebpf.Map `ebpf:"log_buffer"` OpensslReadContext *ebpf.Map `ebpf:"openssl_read_context"` @@ -151,7 +156,7 @@ func (m *tlsTapperMaps) Close() error { m.FileDescriptorToIpv4, m.GoReadContext, m.GoWriteContext, - m.GoidOffsetMap, + m.GoidOffsetsMap, m.Heap, m.LogBuffer, m.OpensslReadContext,