Skip to content
This repository has been archived by the owner on Oct 20, 2022. It is now read-only.

verifier: Program with ubpf_printf() is rejected by the BPF verifier #4

Open
osinstom opened this issue Jan 30, 2020 · 1 comment
Open
Assignees
Labels
bug Something isn't working

Comments

@osinstom
Copy link
Contributor

I'm trying to test programs with ubpf_printf(). However, verifier rejects them. I use mpls.c from exmaples/ as the reference program.

If I put ubpf_printf() before ubpf_packet_data() I'm getting the following message:

|bpf|WARN|Failed to load code: uninitialized register 0 at PC 2

If I put ubpf_printf() after ubpf_packet_data() I'm getting the following message:

|bpf|WARN|Failed to load code: invalid access to packet (0 + 8 > 0) at PC 4

The latter is quite strange for me, as ubpf_printf() does not impact the actual packet.

@pchaigno Would you be able to take a look at it?

@osinstom osinstom added the bug Something isn't working label Jan 30, 2020
@pchaigno
Copy link
Contributor

I understand the second error, but not the first. In the second case, R0 is marked as UINIT by the call to printf. It is then used to access the packet, so the verifier complains. I need to check what's the correct behaviour there.

For the first case, does your printf have multiple arguments? I don't understand why R0 is accessed... I will try to find some time to run tests.

@pchaigno pchaigno self-assigned this Jan 30, 2020
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

2 participants