Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FaultInjector: Add ARM support #17

Merged
merged 2 commits into from
Jan 6, 2023
Merged

Conversation

aymericDD
Copy link
Contributor

@aymericDD aymericDD commented Dec 20, 2022

What does this PR do?

Fix issue: #16

  • support arm architecture arm64: The prefix of kernel functions is different across operating system. Exemple with the syscall sys_perf_event_open:
# Linux lima-debian 5.10.160 aarch64 GNU/Linux
# bpftrace -l|grep arm64_sys|grep perf
kfunc:__arm64_sys_perf_event_open
# Linux lima-debian 5.10.160 amd64 GNU/Linux
# bpftrace -l|grep arm64_sys|grep perf
kfunc:__x64_sys_perf_event_open

Before fix

# ebpfault --config config.yaml -p 1
Generating fault injectors...

 > openat
   Error list:
   -  50% => -ENOENT
Failed to create the enterKprobe event. Errno: 2

After fix

# ebpfault --config config.yaml -p 1
Generating fault injectors...

 > openat
   Error list:
   -  50% => -ENOENT

timestamp: 79479141991224 syscall: openat process_id: 1 thread_id: 1 injected_error: -ENOENT
       r15 ffff80001002beb0        r14 ffffb771225a4d10        r13 ffffb77122de1780 
       r12 ffffb77122db377c        rbp 0000000000000000        rbx 0000000000000000 
       r11 0000000000000000        r10 0000000000000000         r9 0000000000000000 
        r8 ffffb7712228a40c        rax 0000000000000000        rcx 0000000000000000 
       rdx 0000000000000000        rsi 0000000000000000        rdi 0000000000000000 
  orig_rax 0000000000000000        rip 0000000000000000         cs 0000000000000000 
    eflags 0000000000000000        rsp ffff80001002beb0         ss 0000000000000038 

Testing

  • I manually tested the following steps:
    • locally: ✅ with a Linux lima-debian 5.10.160 aarch64 GNU/Linux instance and it works properly after rebuild the linux kernel with the CONFIG_BPF_KPROBE_OVERRIDE option enabled.
    • locally: ✅ with a Linux lima-debian-amd64 5.10.0-19-amd64 Debian 5 instance and it works properly after rebuild the linux kernel with the CONFIG_BPF_KPROBE_OVERRIDE option enabled.

@CLAassistant
Copy link

CLAassistant commented Dec 20, 2022

CLA assistant check
All committers have signed the CLA.

@aymericDD aymericDD changed the title Fix/16 ARM support - fix #16 Dec 20, 2022
@aymericDD
Copy link
Contributor Author

Hello @alessandrogario

What you think about this fix?

@alessandrogario alessandrogario changed the title ARM support - fix #16 FaultInjector: Add ARM support Jan 6, 2023
@alessandrogario alessandrogario merged commit 378006d into trailofbits:main Jan 6, 2023
@alessandrogario
Copy link
Member

Hello @alessandrogario

What you think about this fix?

Hello @aymericDD,

thanks so much for fixing ARM support! We should probably create a new release that includes your fix 😄

@aymericDD
Copy link
Contributor Author

Really happy to help 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ebpfault fails to create syscall Kprobes/Kretprobes on ARM processors
3 participants