Skip to content

Fix ARM64 compatibility with kernel version-aware VMA collection#47

Merged
saimizi merged 1 commit intomainfrom
feature/fix-issue-46
Oct 12, 2025
Merged

Fix ARM64 compatibility with kernel version-aware VMA collection#47
saimizi merged 1 commit intomainfrom
feature/fix-issue-46

Conversation

@saimizi
Copy link
Owner

@saimizi saimizi commented Oct 12, 2025

What's changed

Problem:

  • bpf_find_vma helper (introduced in kernel 5.17) not available on older kernels
  • BPF verifier rejects program with 'invalid func unknown#180' error
  • ARM64 systems often run kernel 5.15.52 which lacks this helper

Solution:

  • Add compile-time kernel version detection using LINUX_VERSION_CODE
  • Implement dual VMA collection methods:
    • Kernel 5.17+: Use modern bpf_find_vma() helper (optimal performance)
    • Kernel <5.17: Use manual VMA walking via task->mm->mmap (compatibility)
  • Automatic method selection at compile time
  • Safety bounds (max 1000 VMAs) to prevent infinite loops
  • File path extraction works on both implementation paths

Benefits:

  • ARM64 compatibility on kernel 5.15.52
  • Preserves VMA information for symbol resolution
  • No performance regression on modern kernels
  • Future-proof design with automatic detection
  • Maintains all existing segfault analysis capabilities

The segfault analyzer now works on both modern and older kernel versions, automatically selecting the appropriate VMA collection method.

Fixes #46

Resolves issue #46: segfault_analyzer fails on ARM64 kernel 5.15.52

Problem:
- bpf_find_vma helper (introduced in kernel 5.17) not available on older kernels
- BPF verifier rejects program with 'invalid func unknown#180' error
- ARM64 systems often run kernel 5.15.52 which lacks this helper

Solution:
- Add compile-time kernel version detection using LINUX_VERSION_CODE
- Implement dual VMA collection methods:
  * Kernel 5.17+: Use modern bpf_find_vma() helper (optimal performance)
  * Kernel <5.17: Use manual VMA walking via task->mm->mmap (compatibility)
- Automatic method selection at compile time
- Safety bounds (max 1000 VMAs) to prevent infinite loops
- File path extraction works on both implementation paths

Benefits:
- ARM64 compatibility on kernel 5.15.52
- Preserves VMA information for symbol resolution
- No performance regression on modern kernels
- Future-proof design with automatic detection
- Maintains all existing segfault analysis capabilities

The segfault analyzer now works on both modern and older kernel versions,
automatically selecting the appropriate VMA collection method.
@saimizi saimizi merged commit 30e07b9 into main Oct 12, 2025
3 checks passed
@saimizi saimizi deleted the feature/fix-issue-46 branch October 12, 2025 14:31
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.

segfault_analyzer fails to run in ARM64 environment

1 participant