Subject: Re: [PATCHv3 iproute2-next 0/5] iproute2: add libbpf support

From: Jiri Benc <[email-masked]>
Date: Wed, 4 Nov 2020 10:28:16 +0100

On Tue, 3 Nov 2020 18:45:59 -0800, Alexei Starovoitov wrote:
> libbpf is the only library I know that is backward and forward compatible.

This is great to hear. It means there will be no problem with iproute2
using the system libbpf. As libbpf is both backward and forward
compatible, iproute2 will just work with whatever version it is used
with.

> All other libraries are backwards compatible only.

Backward compatibility would be enough for iproute2 but forward
compatibility does not hurt, of course.

> The users can upgrade and downgrade libbpf version at any time.
> They can upgrade and downgrade kernel while keeping libbpf version the same.
> The users can upgrade llvm as well and libbpf has to expect unexpected
> and deal with all combinations.

This actually goes beyond what would be needed for iproute2 dynamically
linked against system libbpf.

> > How so? If libbpf is written against kernel APIs and properly versioned,
> > it should just work. A new version of libbpf changes the .so version, so
> > old commands will not load it.  
> 
> Please point out where do you see this happening in the patch set.
> See tools/lib/bpf/README.rst to understand the versioning.

If the iproute2 binaries are linked against a symbol of a newer version than
is available in the system libbpf (which should not really happen
unless the system is broken), the dynamic linker will refuse to load
it. If the binary is linked against an old version of a particular
symbol, that old version will be used, if it's still provided by the
library. Otherwise, it will not load. I don't see a problem here?

The only problem would be if a particular function changed its
semantics while retaining ABI. But since libbpf is backward and forward
compatible, this should not happen.

 Jiri