Fix some of the issues on ARM64

This commit is contained in:
M. Mert Yildiran 2022-06-12 09:37:17 +03:00
parent 00c1d8c0ef
commit 0b3eceddf4
No known key found for this signature in database
GPG Key ID: D42ADB236521BF7A
7 changed files with 19 additions and 8 deletions

View File

@ -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

View File

@ -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);

View File

@ -8,7 +8,7 @@ Copyright (C) UP9 Inc.
#define __GO_TYPES__
struct go_interface {
int64_t type;
__s64 type;
void* ptr;
};

View File

@ -8,7 +8,6 @@ Copyright (C) UP9 Inc.
#define __HEADERS__
#include <stddef.h>
#include <stdint.h>
#include <linux/bpf.h>
#include <linux/ptrace.h>
#include <bpf/bpf_helpers.h>

View File

@ -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
}

Binary file not shown.

Binary file not shown.