lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190522164656.GK10244@mini-arch>
Date:   Wed, 22 May 2019 09:46:56 -0700
From:   Stanislav Fomichev <sdf@...ichev.me>
To:     Alexei Starovoitov <ast@...com>
Cc:     Andrii Nakryiko <andriin@...com>,
        "andrii.nakryiko@...il.com" <andrii.nakryiko@...il.com>,
        "netdev@...r.kernel.org" <netdev@...r.kernel.org>,
        "bpf@...r.kernel.org" <bpf@...r.kernel.org>,
        "daniel@...earbox.net" <daniel@...earbox.net>
Subject: Re: [PATCH bpf-next] libbpf: emit diff of mismatched public API, if
 any

On 05/22, Alexei Starovoitov wrote:
> On 5/22/19 9:15 AM, Andrii Nakryiko wrote:
> > It's easy to have a mismatch of "intended to be public" vs really
> > exposed API functions. While Makefile does check for this mismatch, if
> > it actually occurs it's not trivial to determine which functions are
> > accidentally exposed. This patch dumps out a diff showing what's not
> > supposed to be exposed facilitating easier fixing.
> > 
> > Signed-off-by: Andrii Nakryiko <andriin@...com>
> > ---
> >   tools/lib/bpf/.gitignore | 2 ++
> >   tools/lib/bpf/Makefile   | 8 ++++++++
> >   2 files changed, 10 insertions(+)
> > 
> > diff --git a/tools/lib/bpf/.gitignore b/tools/lib/bpf/.gitignore
> > index d9e9dec04605..c7306e858e2e 100644
> > --- a/tools/lib/bpf/.gitignore
> > +++ b/tools/lib/bpf/.gitignore
> > @@ -3,3 +3,5 @@ libbpf.pc
> >   FEATURE-DUMP.libbpf
> >   test_libbpf
> >   libbpf.so.*
> > +libbpf_global_syms.tmp
> > +libbpf_versioned_syms.tmp
> > diff --git a/tools/lib/bpf/Makefile b/tools/lib/bpf/Makefile
> > index f91639bf5650..7e7d6d851713 100644
> > --- a/tools/lib/bpf/Makefile
> > +++ b/tools/lib/bpf/Makefile
> > @@ -204,6 +204,14 @@ check_abi: $(OUTPUT)libbpf.so
> >   		     "versioned symbols in $^ ($(VERSIONED_SYM_COUNT))." \
> >   		     "Please make sure all LIBBPF_API symbols are"	 \
> >   		     "versioned in $(VERSION_SCRIPT)." >&2;		 \
> > +		readelf -s --wide $(OUTPUT)libbpf-in.o |		 \
> > +		    awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $$8}'|   \
> > +		    sort -u > $(OUTPUT)libbpf_global_syms.tmp;		 \
> > +		readelf -s --wide $(OUTPUT)libbpf.so |			 \
> > +		    grep -Eo '[^ ]+@...BPF_' | cut -d@ -f1 |		 \
> > +		    sort -u > $(OUTPUT)libbpf_versioned_syms.tmp; 	 \
> > +		diff -u $(OUTPUT)libbpf_global_syms.tmp			 \
> > +		     $(OUTPUT)libbpf_versioned_syms.tmp;		 \
> >   		exit 1;							 \
> 
> good idea.
> how about removing tmp files instead of adding them to .gitignore?
We should be able to do it without any temp files. At least in bash
one can do:

diff -u <(readelf -s --wide ${OUTPUT}libbpf-in.o | \
	  awk '/GLOBAL/ && /DEFAULT/ && !/UND/ {print $8}' | \
	  sort -u) \
	<(readelf -s --wide ${OUTPUT}libbpf.so | \
	  grep -Eo '[^ ]+@...BPF_' | cut -d@ -f1 | \
	  sort -u)

But might be complicated in the makefile :-/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ