* [PATCH] selinux-testsuite: add libelf to builds using libbpf
@ 2019-09-24 22:58 Paul Moore
2019-09-25 9:06 ` Ondrej Mosnacek
0 siblings, 1 reply; 6+ messages in thread
From: Paul Moore @ 2019-09-24 22:58 UTC (permalink / raw)
To: selinux
From: Paul Moore <paul@paul-moore.com>
On a modern Rawhide system builds that include libbpf require libelf
as well to avoid the following linker errors:
# cc -g -O0 -Wall -D_GNU_SOURCE -DHAVE_BPF \
client.c ../bpf/bpf_common.c ../bpf/bpf_common.h -lbpf -o client
/usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getshdr'
/usr/bin/ld: ... libbpf.so: undefined reference to `elf_rawdata'
/usr/bin/ld: ... libbpf.so: undefined reference to `elf_getscn'
/usr/bin/ld: ... libbpf.so: undefined reference to `elf_begin'
/usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getrel'
/usr/bin/ld: ... libbpf.so: undefined reference to `elf_memory'
/usr/bin/ld: ... libbpf.so: undefined reference to `elf_end'
/usr/bin/ld: ... libbpf.so: undefined reference to `elf_strptr'
/usr/bin/ld: ... libbpf.so: undefined reference to `elf_nextscn'
/usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getehdr'
/usr/bin/ld: ... libbpf.so: undefined reference to `elf_version'
/usr/bin/ld: ... libbpf.so: undefined reference to `elf_getdata'
/usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getsym'
Signed-off-by: Paul Moore <paul@paul-moore.com>
---
tests/binder/Makefile | 2 +-
tests/bpf/Makefile | 2 +-
tests/fdreceive/Makefile | 2 +-
3 files changed, 3 insertions(+), 3 deletions(-)
diff --git a/tests/binder/Makefile b/tests/binder/Makefile
index e78ad16..8f3cc28 100644
--- a/tests/binder/Makefile
+++ b/tests/binder/Makefile
@@ -12,7 +12,7 @@ endif
ifneq (,$(findstring -DHAVE_BPF,$(CFLAGS)))
DEPS += ../bpf/bpf_common.c ../bpf/bpf_common.h
- LDLIBS += -lbpf
+ LDLIBS += -lelf -lbpf
endif
all: $(TARGETS)
diff --git a/tests/bpf/Makefile b/tests/bpf/Makefile
index 6fb230d..7b00b41 100644
--- a/tests/bpf/Makefile
+++ b/tests/bpf/Makefile
@@ -1,6 +1,6 @@
TARGETS = bpf_test
DEPS = bpf_common.c bpf_common.h
-LDLIBS += -lselinux -lbpf
+LDLIBS += -lselinux -lelf -lbpf
# export so that BPF_ENABLED entries get built correctly on local build
export CFLAGS += -DHAVE_BPF
diff --git a/tests/fdreceive/Makefile b/tests/fdreceive/Makefile
index 895f91c..cf57327 100644
--- a/tests/fdreceive/Makefile
+++ b/tests/fdreceive/Makefile
@@ -2,7 +2,7 @@ TARGETS = client server
ifneq (,$(findstring -DHAVE_BPF,$(CFLAGS)))
DEPS = ../bpf/bpf_common.c ../bpf/bpf_common.h
- LDLIBS += -lbpf
+ LDLIBS += -lelf -lbpf
endif
all: $(TARGETS)
^ permalink raw reply related [flat|nested] 6+ messages in thread
* Re: [PATCH] selinux-testsuite: add libelf to builds using libbpf
2019-09-24 22:58 [PATCH] selinux-testsuite: add libelf to builds using libbpf Paul Moore
@ 2019-09-25 9:06 ` Ondrej Mosnacek
2019-09-25 15:22 ` Paul Moore
0 siblings, 1 reply; 6+ messages in thread
From: Ondrej Mosnacek @ 2019-09-25 9:06 UTC (permalink / raw)
To: Paul Moore; +Cc: SElinux list
On Wed, Sep 25, 2019 at 12:58 AM Paul Moore <paul@paul-moore.com> wrote:
> From: Paul Moore <paul@paul-moore.com>
>
> On a modern Rawhide system builds that include libbpf require libelf
> as well to avoid the following linker errors:
>
> # cc -g -O0 -Wall -D_GNU_SOURCE -DHAVE_BPF \
> client.c ../bpf/bpf_common.c ../bpf/bpf_common.h -lbpf -o client
> /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getshdr'
> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_rawdata'
> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_getscn'
> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_begin'
> /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getrel'
> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_memory'
> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_end'
> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_strptr'
> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_nextscn'
> /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getehdr'
> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_version'
> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_getdata'
> /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getsym'
This is a bug in libbpf. I filed a bug against the Fedora package [1]
and also opened a PR [2] against the upstream repo (which is a
modified mirror of the code in the kernel repo under tools/lib/bpf,
where the bug is not present), which I think should fix this problem
also in the Fedora builds.
[1] https://bugzilla.redhat.com/show_bug.cgi?id=1755317
[2] https://github.com/libbpf/libbpf/pull/72
>
> Signed-off-by: Paul Moore <paul@paul-moore.com>
> ---
> tests/binder/Makefile | 2 +-
> tests/bpf/Makefile | 2 +-
> tests/fdreceive/Makefile | 2 +-
> 3 files changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/tests/binder/Makefile b/tests/binder/Makefile
> index e78ad16..8f3cc28 100644
> --- a/tests/binder/Makefile
> +++ b/tests/binder/Makefile
> @@ -12,7 +12,7 @@ endif
>
> ifneq (,$(findstring -DHAVE_BPF,$(CFLAGS)))
> DEPS += ../bpf/bpf_common.c ../bpf/bpf_common.h
> - LDLIBS += -lbpf
> + LDLIBS += -lelf -lbpf
> endif
>
> all: $(TARGETS)
> diff --git a/tests/bpf/Makefile b/tests/bpf/Makefile
> index 6fb230d..7b00b41 100644
> --- a/tests/bpf/Makefile
> +++ b/tests/bpf/Makefile
> @@ -1,6 +1,6 @@
> TARGETS = bpf_test
> DEPS = bpf_common.c bpf_common.h
> -LDLIBS += -lselinux -lbpf
> +LDLIBS += -lselinux -lelf -lbpf
>
> # export so that BPF_ENABLED entries get built correctly on local build
> export CFLAGS += -DHAVE_BPF
> diff --git a/tests/fdreceive/Makefile b/tests/fdreceive/Makefile
> index 895f91c..cf57327 100644
> --- a/tests/fdreceive/Makefile
> +++ b/tests/fdreceive/Makefile
> @@ -2,7 +2,7 @@ TARGETS = client server
>
> ifneq (,$(findstring -DHAVE_BPF,$(CFLAGS)))
> DEPS = ../bpf/bpf_common.c ../bpf/bpf_common.h
> - LDLIBS += -lbpf
> + LDLIBS += -lelf -lbpf
> endif
>
> all: $(TARGETS)
>
--
Ondrej Mosnacek <omosnace at redhat dot com>
Software Engineer, Security Technologies
Red Hat, Inc.
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] selinux-testsuite: add libelf to builds using libbpf
2019-09-25 9:06 ` Ondrej Mosnacek
@ 2019-09-25 15:22 ` Paul Moore
2019-10-09 18:27 ` Stephen Smalley
0 siblings, 1 reply; 6+ messages in thread
From: Paul Moore @ 2019-09-25 15:22 UTC (permalink / raw)
To: Ondrej Mosnacek; +Cc: SElinux list
On Wed, Sep 25, 2019 at 5:06 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> On Wed, Sep 25, 2019 at 12:58 AM Paul Moore <paul@paul-moore.com> wrote:
> > From: Paul Moore <paul@paul-moore.com>
> >
> > On a modern Rawhide system builds that include libbpf require libelf
> > as well to avoid the following linker errors:
> >
> > # cc -g -O0 -Wall -D_GNU_SOURCE -DHAVE_BPF \
> > client.c ../bpf/bpf_common.c ../bpf/bpf_common.h -lbpf -o client
> > /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getshdr'
> > /usr/bin/ld: ... libbpf.so: undefined reference to `elf_rawdata'
> > /usr/bin/ld: ... libbpf.so: undefined reference to `elf_getscn'
> > /usr/bin/ld: ... libbpf.so: undefined reference to `elf_begin'
> > /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getrel'
> > /usr/bin/ld: ... libbpf.so: undefined reference to `elf_memory'
> > /usr/bin/ld: ... libbpf.so: undefined reference to `elf_end'
> > /usr/bin/ld: ... libbpf.so: undefined reference to `elf_strptr'
> > /usr/bin/ld: ... libbpf.so: undefined reference to `elf_nextscn'
> > /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getehdr'
> > /usr/bin/ld: ... libbpf.so: undefined reference to `elf_version'
> > /usr/bin/ld: ... libbpf.so: undefined reference to `elf_getdata'
> > /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getsym'
>
> This is a bug in libbpf. I filed a bug against the Fedora package [1]
> and also opened a PR [2] against the upstream repo (which is a
> modified mirror of the code in the kernel repo under tools/lib/bpf,
> where the bug is not present), which I think should fix this problem
> also in the Fedora builds.
>
> [1] https://bugzilla.redhat.com/show_bug.cgi?id=1755317
> [2] https://github.com/libbpf/libbpf/pull/72
Thanks for tracking down the root cause and filing a report upstream;
I didn't have time to sort out the "why", I just wanted to get the
test working again :)
It looks like the best course of action is to hold off on this fix in
hopes that it gets fixed upstream, or at least in Fedora. If this
issue persists for a week or two we can always go ahead and merge this
fix, it shouldn't break anything if/when this gets fixed upstream.
Tests that fail to run made me sad :(
--
paul moore
www.paul-moore.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] selinux-testsuite: add libelf to builds using libbpf
2019-09-25 15:22 ` Paul Moore
@ 2019-10-09 18:27 ` Stephen Smalley
2019-10-09 22:44 ` Paul Moore
2019-10-10 11:42 ` Ondrej Mosnacek
0 siblings, 2 replies; 6+ messages in thread
From: Stephen Smalley @ 2019-10-09 18:27 UTC (permalink / raw)
To: Paul Moore, Ondrej Mosnacek; +Cc: SElinux list
On 9/25/19 11:22 AM, Paul Moore wrote:
> On Wed, Sep 25, 2019 at 5:06 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
>> On Wed, Sep 25, 2019 at 12:58 AM Paul Moore <paul@paul-moore.com> wrote:
>>> From: Paul Moore <paul@paul-moore.com>
>>>
>>> On a modern Rawhide system builds that include libbpf require libelf
>>> as well to avoid the following linker errors:
>>>
>>> # cc -g -O0 -Wall -D_GNU_SOURCE -DHAVE_BPF \
>>> client.c ../bpf/bpf_common.c ../bpf/bpf_common.h -lbpf -o client
>>> /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getshdr'
>>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_rawdata'
>>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_getscn'
>>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_begin'
>>> /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getrel'
>>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_memory'
>>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_end'
>>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_strptr'
>>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_nextscn'
>>> /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getehdr'
>>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_version'
>>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_getdata'
>>> /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getsym'
>>
>> This is a bug in libbpf. I filed a bug against the Fedora package [1]
>> and also opened a PR [2] against the upstream repo (which is a
>> modified mirror of the code in the kernel repo under tools/lib/bpf,
>> where the bug is not present), which I think should fix this problem
>> also in the Fedora builds.
>>
>> [1] https://bugzilla.redhat.com/show_bug.cgi?id=1755317
>> [2] https://github.com/libbpf/libbpf/pull/72
>
> Thanks for tracking down the root cause and filing a report upstream;
> I didn't have time to sort out the "why", I just wanted to get the
> test working again :)
>
> It looks like the best course of action is to hold off on this fix in
> hopes that it gets fixed upstream, or at least in Fedora. If this
> issue persists for a week or two we can always go ahead and merge this
> fix, it shouldn't break anything if/when this gets fixed upstream.
>
> Tests that fail to run made me sad :(
FWIW, this is still broken on F30 (don't know about F31). Any chance we
can get the updated package pushed to F30/F31 too?
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] selinux-testsuite: add libelf to builds using libbpf
2019-10-09 18:27 ` Stephen Smalley
@ 2019-10-09 22:44 ` Paul Moore
2019-10-10 11:42 ` Ondrej Mosnacek
1 sibling, 0 replies; 6+ messages in thread
From: Paul Moore @ 2019-10-09 22:44 UTC (permalink / raw)
To: Stephen Smalley; +Cc: Ondrej Mosnacek, SElinux list
On Wed, Oct 9, 2019 at 2:27 PM Stephen Smalley <sds@tycho.nsa.gov> wrote:
> On 9/25/19 11:22 AM, Paul Moore wrote:
> > On Wed, Sep 25, 2019 at 5:06 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> >> On Wed, Sep 25, 2019 at 12:58 AM Paul Moore <paul@paul-moore.com> wrote:
> >>> From: Paul Moore <paul@paul-moore.com>
> >>>
> >>> On a modern Rawhide system builds that include libbpf require libelf
> >>> as well to avoid the following linker errors:
> >>>
> >>> # cc -g -O0 -Wall -D_GNU_SOURCE -DHAVE_BPF \
> >>> client.c ../bpf/bpf_common.c ../bpf/bpf_common.h -lbpf -o client
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getshdr'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_rawdata'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_getscn'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_begin'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getrel'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_memory'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_end'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_strptr'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_nextscn'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getehdr'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_version'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_getdata'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getsym'
> >>
> >> This is a bug in libbpf. I filed a bug against the Fedora package [1]
> >> and also opened a PR [2] against the upstream repo (which is a
> >> modified mirror of the code in the kernel repo under tools/lib/bpf,
> >> where the bug is not present), which I think should fix this problem
> >> also in the Fedora builds.
> >>
> >> [1] https://bugzilla.redhat.com/show_bug.cgi?id=1755317
> >> [2] https://github.com/libbpf/libbpf/pull/72
> >
> > Thanks for tracking down the root cause and filing a report upstream;
> > I didn't have time to sort out the "why", I just wanted to get the
> > test working again :)
> >
> > It looks like the best course of action is to hold off on this fix in
> > hopes that it gets fixed upstream, or at least in Fedora. If this
> > issue persists for a week or two we can always go ahead and merge this
> > fix, it shouldn't break anything if/when this gets fixed upstream.
> >
> > Tests that fail to run made me sad :(
>
> FWIW, this is still broken on F30 (don't know about F31). Any chance we
> can get the updated package pushed to F30/F31 too?
Alternatively, it is worth just patching the test suite? It's
obviously better if Fedora (and all the other distros) fix this
everywhere, but it doesn't look like that is happening.
--
paul moore
www.paul-moore.com
^ permalink raw reply [flat|nested] 6+ messages in thread
* Re: [PATCH] selinux-testsuite: add libelf to builds using libbpf
2019-10-09 18:27 ` Stephen Smalley
2019-10-09 22:44 ` Paul Moore
@ 2019-10-10 11:42 ` Ondrej Mosnacek
1 sibling, 0 replies; 6+ messages in thread
From: Ondrej Mosnacek @ 2019-10-10 11:42 UTC (permalink / raw)
To: Stephen Smalley; +Cc: Paul Moore, SElinux list
On Wed, Oct 9, 2019 at 8:27 PM Stephen Smalley <sds@tycho.nsa.gov> wrote:
> On 9/25/19 11:22 AM, Paul Moore wrote:
> > On Wed, Sep 25, 2019 at 5:06 AM Ondrej Mosnacek <omosnace@redhat.com> wrote:
> >> On Wed, Sep 25, 2019 at 12:58 AM Paul Moore <paul@paul-moore.com> wrote:
> >>> From: Paul Moore <paul@paul-moore.com>
> >>>
> >>> On a modern Rawhide system builds that include libbpf require libelf
> >>> as well to avoid the following linker errors:
> >>>
> >>> # cc -g -O0 -Wall -D_GNU_SOURCE -DHAVE_BPF \
> >>> client.c ../bpf/bpf_common.c ../bpf/bpf_common.h -lbpf -o client
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getshdr'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_rawdata'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_getscn'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_begin'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getrel'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_memory'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_end'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_strptr'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_nextscn'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getehdr'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_version'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `elf_getdata'
> >>> /usr/bin/ld: ... libbpf.so: undefined reference to `gelf_getsym'
> >>
> >> This is a bug in libbpf. I filed a bug against the Fedora package [1]
> >> and also opened a PR [2] against the upstream repo (which is a
> >> modified mirror of the code in the kernel repo under tools/lib/bpf,
> >> where the bug is not present), which I think should fix this problem
> >> also in the Fedora builds.
> >>
> >> [1] https://bugzilla.redhat.com/show_bug.cgi?id=1755317
> >> [2] https://github.com/libbpf/libbpf/pull/72
> >
> > Thanks for tracking down the root cause and filing a report upstream;
> > I didn't have time to sort out the "why", I just wanted to get the
> > test working again :)
> >
> > It looks like the best course of action is to hold off on this fix in
> > hopes that it gets fixed upstream, or at least in Fedora. If this
> > issue persists for a week or two we can always go ahead and merge this
> > fix, it shouldn't break anything if/when this gets fixed upstream.
> >
> > Tests that fail to run made me sad :(
>
> FWIW, this is still broken on F30 (don't know about F31). Any chance we
> can get the updated package pushed to F30/F31 too?
There are updates pending for F3[01], which both have the issue fixed:
https://bodhi.fedoraproject.org/updates/FEDORA-2019-aa28a02f4e
https://bodhi.fedoraproject.org/updates/FEDORA-2019-8519f326c2
Both should get pushed to stable automatically in 2 days if there is
no negative feedback (or earlier if there is enough positive feedback
- feel free to test and add +1 karma).
--
Ondrej Mosnacek <omosnace at redhat dot com>
Software Engineer, Security Technologies
Red Hat, Inc.
^ permalink raw reply [flat|nested] 6+ messages in thread
end of thread, other threads:[~2019-10-10 11:42 UTC | newest]
Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2019-09-24 22:58 [PATCH] selinux-testsuite: add libelf to builds using libbpf Paul Moore
2019-09-25 9:06 ` Ondrej Mosnacek
2019-09-25 15:22 ` Paul Moore
2019-10-09 18:27 ` Stephen Smalley
2019-10-09 22:44 ` Paul Moore
2019-10-10 11:42 ` Ondrej Mosnacek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).