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

Probe kernel bpf2bpf support #657

Merged
merged 3 commits into from May 10, 2022
Merged

Probe kernel bpf2bpf support #657

merged 3 commits into from May 10, 2022

Commits on May 9, 2022

  1. internal: trim and convert verifier errors to Go strings directly

    Whitespace-trimming a C string using bytes.Trim is ineffective without
    first trimming the NUL byte(s).
    
    [ ... 108 101 32 105 110 115 110 32 50 56 10 0 0 0 ... ]
    
    Don't add \x00 to the cutset for performance reasons. Truncate on the first
    NUL like unix.ByteSliceToString does, then trim the remaining bytes.
    
    Signed-off-by: Timo Beckers <timo@isovalent.com>
    ti-mo committed May 9, 2022
    Copy the full SHA
    1bd9a13 View commit details
    Browse the repository at this point in the history
  2. syscalls: add haveBPFToBPFCalls feature probe

    When trying to load a program containing bpf2bpf calls on a kernel that
    doesn't support it, we bubble up the verifier error to the caller:
    
      program xdp_prog: load program: invalid argument: unreachable insn 28
    
    This is clear, but doesn't allow skipping tests when loading e.g. loader.c
    on older kernels due to it containing bpf2bpf calls.
    
    Implement a feature probe for bpf2bpf, return an unsupported error when
    trying to load a program with multiple subprogs on an older kernel.
    
    Update the test suite to skip unsupported features instead of hardcoding
    a skip on 4.16 and earlier.
    
    Signed-off-by: Timo Beckers <timo@isovalent.com>
    ti-mo committed May 9, 2022
    Copy the full SHA
    b83e121 View commit details
    Browse the repository at this point in the history
  3. prog: friendly error w/ sentinel if kernel doesn't support bpf2bpf

    If a program has function references, return ErrNotSupported if program
    creation fails and we know the kernel doesn't support bpf2bpf calls, or if the
    user is unprivileged.
    
    Signed-off-by: Timo Beckers <timo@isovalent.com>
    ti-mo committed May 9, 2022
    Copy the full SHA
    030ac0e View commit details
    Browse the repository at this point in the history