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: <1498214246-1244-2-git-send-email-marcin.nowakowski@imgtec.com>
Date:   Fri, 23 Jun 2017 12:37:24 +0200
From:   Marcin Nowakowski <marcin.nowakowski@...tec.com>
To:     Shuah Khan <shuah@...nel.org>
CC:     <linux-kselftest@...r.kernel.org>, <linux-kernel@...r.kernel.org>,
        Marcin Nowakowski <marcin.nowakowski@...tec.com>
Subject: [PATCH 1/3] selftests/{net,memfd}: fix undefined references to external libraries

net test fails to link properly due to a missing reference to -lnuma and
fails with:
reuseport_bpf_numa.c:138: undefined reference to `numa_run_on_node'
reuseport_bpf_numa.c:230: undefined reference to `numa_available'
reuseport_bpf_numa.c:233: undefined reference to `numa_max_node'
collect2: error: ld returned 1 exit status

running make -p shows that this is due to a wrong LDFLAGS variable
definition which doesn't include the output prefix location:

 # makefile (from 'Makefile', line 6)
reuseport_bpf_numa: LDFLAGS += -lnuma
 # Not a target:
reuseport_bpf_numa:

The same issue has been observed in memfd with its references to
libfuse.

Resolve this by adding a pattern-matching to allow the binary name to be
prefixed with an output location.

For memfd also replace LDFLAGS with LDLIBS definition to ensure correct
ordering of arguments in the make's implicit rules.

Fixes: a8ba798bc8ec ('selftests: enable O and KBUILD_OUTPUT')

Signed-off-by: Marcin Nowakowski <marcin.nowakowski@...tec.com>
---
 tools/testing/selftests/memfd/Makefile | 4 ++--
 tools/testing/selftests/net/Makefile   | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/tools/testing/selftests/memfd/Makefile b/tools/testing/selftests/memfd/Makefile
index 79891d0..754e92f 100644
--- a/tools/testing/selftests/memfd/Makefile
+++ b/tools/testing/selftests/memfd/Makefile
@@ -6,8 +6,8 @@ CFLAGS += -I../../../../usr/include/
 TEST_PROGS := run_fuse_test.sh
 TEST_GEN_FILES := memfd_test fuse_mnt fuse_test
 
-fuse_mnt.o: CFLAGS += $(shell pkg-config fuse --cflags)
-fuse_mnt: LDFLAGS += $(shell pkg-config fuse --libs)
+%/fuse_mnt: CFLAGS += $(shell pkg-config fuse --cflags)
+%/fuse_mnt: LDLIBS += $(shell pkg-config fuse --libs)
 
 include ../lib.mk
 
diff --git a/tools/testing/selftests/net/Makefile b/tools/testing/selftests/net/Makefile
index 35cbb4c..d7abe8b 100644
--- a/tools/testing/selftests/net/Makefile
+++ b/tools/testing/selftests/net/Makefile
@@ -3,7 +3,7 @@
 CFLAGS =  -Wall -Wl,--no-as-needed -O2 -g
 CFLAGS += -I../../../../usr/include/
 
-reuseport_bpf_numa: LDFLAGS += -lnuma
+%/reuseport_bpf_numa: LDFLAGS += -lnuma
 
 TEST_PROGS := run_netsocktests run_afpackettests test_bpf.sh netdevice.sh
 TEST_GEN_FILES =  socket
-- 
2.7.4

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ