Skip to content

bpf: fix mount point parsing and drop the legacy loader

Stephen Hemminger netdev 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest0 of 7 patches 1 replyIn review

Patches in v1 No applies recorded yet

None of the 7 patches the cover letter announces are in this archive.

Reviews trailers per patch

PatchJamal Hadi Salim
SeriesR-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH iproute2-next 0/7] bpf: fix mount point parsing and drop the legacy loader

While looking at OSS Scanner reports noticed a pattern of issues around the BPF loader. The first set related to parsing of mount points with fscanf("%s").

The next part were issues from the legacy BPF loader which is no longer needed. This series rips the band-aid off and related parts no longer needed.

There were also some bugs in error handling found
while changing all this.

Note: lib/bpf_legacy.c becomes lib/bpf_util.c. "ar rcs" does not drop members that are no longer built, so a stale bpf_legacy.o and sha1.o stay in lib/libutil.a and are picked up by the link. The build still succeeds, but run "make distclean" to be rid of them.

The libbpf build options are gone: libbpf is now always required, and pkg-config is the only way it is found. Both --libbpf_force and --libbpf_dir are now rejected rather than silently ignored.

The last patch adds a tc bpf test, there was none before. It caught a regression in this series that the build did not: the tc/ pin subdirectory quietly went missing.

Since v1: squashed the four libbpf configure patches into one, dropped the bpf_pinning fallback fix since the loader removal deletes that code anyway, moved the tc-bpf(8) update next to the change it documents, and reworded the export removal after Jamal pointed out that LIBBPF_FORCE=off builds did have a working import/run. Dropped Toke's Reviewed-by from the mount point check:
it now also restores the pin subdirectory, so it is not the patch he reviewed.

Stephen Hemminger (7):
lib/bpf: parse /proc/mounts with getmntent and check fs magic lib/fs: parse /proc/mounts with getmntent and check fs magic
tc: remove eBPF map export and exec bpf import
man: tc-bpf: drop references to the removed eBPF agent lib/bpf: require libbpf 1.0 and remove legacy ELF loader lib/bpf: check for missing bpf fs mount point
testsuite: add tc bpf test

 bash-completion/tc                   |   18 +-
 configure                            |  129 +-
 etc/iproute2/bpf_pinning             |    6 -
 examples/bpf/README                  |   18 +-
 examples/bpf/bpf_map_in_map.c        |    4 +-
 examples/bpf/bpf_shared.c            |   14 +-
 examples/bpf/legacy/bpf_cyclic.c     |   35 -
 examples/bpf/legacy/bpf_graft.c      |   66 -
 examples/bpf/legacy/bpf_map_in_map.c |   56 -
 examples/bpf/legacy/bpf_shared.c     |   53 -
 examples/bpf/legacy/bpf_tailcall.c   |  117 -
 include/bpf_api.h                    |    7 +-
 include/bpf_elf.h                    |   35 +-
 include/bpf_scm.h                    |   77 -
 include/bpf_util.h                   |   41 +-
 include/sha1.h                       |   18 -
 ip/iplink.c                          |    4 -
 lib/Makefile                         |   10 +-
 lib/bpf_glue.c                       |   15 +-
 lib/bpf_legacy.c                     | 3306 --------------------------
 lib/bpf_libbpf.c                     |  260 +-
 lib/bpf_util.c                       | 1105 +++++++++
 lib/fs.c                             |   33 +-
 lib/sha1.c                           |  108 -
 man/man8/ip-link.8.in                |    5 +-
 man/man8/tc-bpf.8                    |  173 +-
 misc/ss.c                            |  946 +++++---
 tc/e_bpf.c                           |  157 +-
 tc/f_bpf.c                           |   12 +-
 tc/m_bpf.c                           |   13 +-
 testsuite/tests/tc/bpf.t             |  153 ++
 31 files changed, 2095 insertions(+), 4899 deletions(-)
 delete mode 100644 etc/iproute2/bpf_pinning
 delete mode 100644 examples/bpf/legacy/bpf_cyclic.c
 delete mode 100644 examples/bpf/legacy/bpf_graft.c
 delete mode 100644 examples/bpf/legacy/bpf_map_in_map.c
 delete mode 100644 examples/bpf/legacy/bpf_shared.c
 delete mode 100644 examples/bpf/legacy/bpf_tailcall.c
 delete mode 100644 include/bpf_scm.h
 delete mode 100644 include/sha1.h
 delete mode 100644 lib/bpf_legacy.c
 create mode 100644 lib/bpf_util.c
 delete mode 100644 lib/sha1.c
 create mode 100755 testsuite/tests/tc/bpf.t
Signature · 1 line
2.53.0