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

test: fix CO-RE issue on kernel 6.9 and above in eBPF tests #723

Merged
merged 1 commit into from
Dec 30, 2024

Conversation

Integral-Tech
Copy link
Contributor

Background

Checklist

Full Changelogs

  • Fix CO-RE issue on kernel 6.9 and above in eBPF tests

Issue Reference

Closes #[issue number]

Test Result

Before:

=== RUN   Test
    bpf_test.go:72: Failed to load objects: Verifier error: load program: bad CO-RE relocation:
                0: R1=ctx() R10=fp0
                ; int testcheck_mac_match(struct __sk_buff *skb) @ bpf_test.c:549
                0: (bf) r6 = r1                       ; R1=ctx() R6_w=ctx()
                1: (b7) r1 = 0                        ; R1_w=0
                ; struct lpm_key lpm_key = {}; @ bpf_test.c:551
                2: (7b) *(u64 *)(r10 -72) = r1        ; R1_w=0 R10=fp0 fp-72_w=0
                3: (7b) *(u64 *)(r10 -80) = r1        ; R1_w=0 R10=fp0 fp-80_w=0
                4: (bf) r2 = r10                      ; R2_w=fp0 R10=fp0
                ;  @ bpf_test.c:0
                5: (07) r2 += -80                     ; R2_w=fp-80
                6: (b7) r1 = 128                      ; R1_w=128
                ; instruction poisoned by CO-RE @ :0
                7: (85) call unknown#195896080
                invalid func unknown#195896080
                processed 8 insns (limit 1000000) max_states_per_insn 0 total_states 0 peak_states 0 mark_read 0
        
        field TestcheckMacMatch: program testcheck_mac_match: load program: bad CO-RE relocation: invalid func unknown#195896080 (14 line(s) omitted)
--- FAIL: Test (0.18s)
FAIL
FAIL    github.com/daeuniverse/dae/control/kern/tests   0.186s
FAIL
make: *** [Makefile:110: ebpf-test] Error 1

After:

=== RUN   Test
    bpf_test.go:130: Running test: AndMatch1
    bpf_test.go:130: Running test: AndMatch2
    bpf_test.go:130: Running test: AndMismatch
    bpf_test.go:130: Running test: DportMatch
    bpf_test.go:130: Running test: DportMismatch
    bpf_test.go:130: Running test: DscpMatch
    bpf_test.go:130: Running test: DscpMismatch
    bpf_test.go:130: Running test: IpsetMatch
    bpf_test.go:130: Running test: IpsetMismatch
    bpf_test.go:130: Running test: IpversionMatch
    bpf_test.go:130: Running test: IpversionMismatch
    bpf_test.go:130: Running test: L4protoMatch
    bpf_test.go:130: Running test: L4protoMismatch
    bpf_test.go:130: Running test: MacMatch
    bpf_test.go:130: Running test: MacMismatch
    bpf_test.go:130: Running test: NotMatch
    bpf_test.go:130: Running test: NotMismtach
    bpf_test.go:130: Running test: SourceIpsetMatch
    bpf_test.go:130: Running test: SourceIpsetMismatch
    bpf_test.go:130: Running test: SportMatch
    bpf_test.go:130: Running test: SportMismatch
--- PASS: Test (1.45s)
PASS
ok      github.com/daeuniverse/dae/control/kern/tests   1.459s

Test Environment: Arch Linux, 6.12.4-arch1-1

@Integral-Tech Integral-Tech requested a review from a team as a code owner December 30, 2024 09:08
@Integral-Tech Integral-Tech merged commit 3f4cceb into daeuniverse:main Dec 30, 2024
31 checks passed
@Integral-Tech Integral-Tech deleted the fix-ebpf-test-on-6.9 branch December 30, 2024 09:29
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants