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

bpf: unit tests and fixes for prepend_name function #1902

Merged
merged 4 commits into from
Jan 3, 2024

Commits on Jan 3, 2024

  1. deps: bump cilium/ebpf for fix cilium/ebpf#1275

    In order to make BPF_PROG_RUN work with BPF_PROG_TYPE_RAW_TRACEPOINT in
    cilium/ebpf.
    
    Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
    mtardy committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    ba75a57 View commit details
    Browse the repository at this point in the history
  2. bpf: add unit tests for the prepend_name function

    It looked like this particular function presented some bugs:
    - It would not return -ENAMETOOLONG when the buffer was filled
      "best-effort" because the name was not fitting.
    - It would never fill the first byte of the buffer, thus reducing the
      maximum size written by one.
    - It would not fill "best-effort" correctly. E.g, previously in a buffer
      of 4, "pizza" would have been "/piz" (when ignoring previous bug)
      instead of "izza". Now it tries to write the "end" of the name without
      a wrong "/" char.
    - It would behave unexpectedly when filled with more data than size of
      buffer.
    
    BPF unit tests were put under bpf/tests, as more can be added there in
    the future. The Makefile was updated so that we can share variable
    definition between the bpf/Makefile and the bpf/tests/Makefile file.
    This separation allows us not compile the test program along the rest of
    the BPF progs, and not ship them in the released images/archives.
    
    Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
    mtardy committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    a3aeff8 View commit details
    Browse the repository at this point in the history
  3. bpf: fix bugs in the prepend_name function

    Unit tests were added in the previous commit for this function,
    highlighting some of the issues it presented. This commit introduce a
    few changes trying to fix the detected bugs.
    
    Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
    mtardy committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    ddd07ff View commit details
    Browse the repository at this point in the history
  4. workflows: run BPF unit tests on BPF changes

    Signed-off-by: Mahe Tardy <mahe.tardy@gmail.com>
    mtardy committed Jan 3, 2024
    Configuration menu
    Copy the full SHA
    d23a34a View commit details
    Browse the repository at this point in the history