* [PATCH net] selftests/bpf: fix broken build
@ 2017-03-11 6:05 Alexei Starovoitov
2017-03-11 11:59 ` Daniel Borkmann
2017-03-13 6:48 ` David Miller
0 siblings, 2 replies; 3+ messages in thread
From: Alexei Starovoitov @ 2017-03-11 6:05 UTC (permalink / raw)
To: David S . Miller; +Cc: Daniel Borkmann, Shuah Khan, netdev
Recent merge of 'linux-kselftest-4.11-rc1' tree broke bpf test build.
None of the tests were building and test_verifier.c had tons of compiler errors.
Fix it and add #ifdef CAP_IS_SUPPORTED to support old versions of libcap.
Tested on centos 6.8 and 7
Signed-off-by: Alexei Starovoitov <ast@kernel.org>
---
tools/include/uapi/linux/bpf_perf_event.h | 18 ++++++++++++++++++
tools/testing/selftests/bpf/Makefile | 4 +++-
tools/testing/selftests/bpf/test_verifier.c | 4 ++++
3 files changed, 25 insertions(+), 1 deletion(-)
create mode 100644 tools/include/uapi/linux/bpf_perf_event.h
diff --git a/tools/include/uapi/linux/bpf_perf_event.h b/tools/include/uapi/linux/bpf_perf_event.h
new file mode 100644
index 000000000000..067427259820
--- /dev/null
+++ b/tools/include/uapi/linux/bpf_perf_event.h
@@ -0,0 +1,18 @@
+/* Copyright (c) 2016 Facebook
+ *
+ * This program is free software; you can redistribute it and/or
+ * modify it under the terms of version 2 of the GNU General Public
+ * License as published by the Free Software Foundation.
+ */
+#ifndef _UAPI__LINUX_BPF_PERF_EVENT_H__
+#define _UAPI__LINUX_BPF_PERF_EVENT_H__
+
+#include <linux/types.h>
+#include <linux/ptrace.h>
+
+struct bpf_perf_event_data {
+ struct pt_regs regs;
+ __u64 sample_period;
+};
+
+#endif /* _UAPI__LINUX_BPF_PERF_EVENT_H__ */
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
index 4b498265dae6..67531f47781b 100644
--- a/tools/testing/selftests/bpf/Makefile
+++ b/tools/testing/selftests/bpf/Makefile
@@ -1,12 +1,14 @@
LIBDIR := ../../../lib
BPFOBJ := $(LIBDIR)/bpf/bpf.o
-CFLAGS += -Wall -O2 -lcap -I../../../include/uapi -I$(LIBDIR)
+CFLAGS += -Wall -O2 -lcap -I../../../include/uapi -I$(LIBDIR) $(BPFOBJ)
TEST_GEN_PROGS = test_verifier test_tag test_maps test_lru_map test_lpm_map
TEST_PROGS := test_kmod.sh
+all: $(TEST_GEN_PROGS)
+
.PHONY: all clean force
# force a rebuild of BPFOBJ when its dependencies are updated
diff --git a/tools/testing/selftests/bpf/test_verifier.c b/tools/testing/selftests/bpf/test_verifier.c
index e1f5b9eea1e8..d1555e4240c0 100644
--- a/tools/testing/selftests/bpf/test_verifier.c
+++ b/tools/testing/selftests/bpf/test_verifier.c
@@ -8,6 +8,8 @@
* License as published by the Free Software Foundation.
*/
+#include <asm/types.h>
+#include <linux/types.h>
#include <stdint.h>
#include <stdio.h>
#include <stdlib.h>
@@ -4583,10 +4585,12 @@ static bool is_admin(void)
cap_flag_value_t sysadmin = CAP_CLEAR;
const cap_value_t cap_val = CAP_SYS_ADMIN;
+#ifdef CAP_IS_SUPPORTED
if (!CAP_IS_SUPPORTED(CAP_SETFCAP)) {
perror("cap_get_flag");
return false;
}
+#endif
caps = cap_get_proc();
if (!caps) {
perror("cap_get_proc");
--
2.8.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH net] selftests/bpf: fix broken build
2017-03-11 6:05 [PATCH net] selftests/bpf: fix broken build Alexei Starovoitov
@ 2017-03-11 11:59 ` Daniel Borkmann
2017-03-13 6:48 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: Daniel Borkmann @ 2017-03-11 11:59 UTC (permalink / raw)
To: Alexei Starovoitov, David S . Miller; +Cc: Shuah Khan, netdev
On 03/11/2017 07:05 AM, Alexei Starovoitov wrote:
> Recent merge of 'linux-kselftest-4.11-rc1' tree broke bpf test build.
> None of the tests were building and test_verifier.c had tons of compiler errors.
> Fix it and add #ifdef CAP_IS_SUPPORTED to support old versions of libcap.
> Tested on centos 6.8 and 7
>
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Fix looks correct to me and makes the test suite work again.
Acked-by: Daniel Borkmann <daniel@iogearbox.net>
Tested-by: Daniel Borkmann <daniel@iogearbox.net>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH net] selftests/bpf: fix broken build
2017-03-11 6:05 [PATCH net] selftests/bpf: fix broken build Alexei Starovoitov
2017-03-11 11:59 ` Daniel Borkmann
@ 2017-03-13 6:48 ` David Miller
1 sibling, 0 replies; 3+ messages in thread
From: David Miller @ 2017-03-13 6:48 UTC (permalink / raw)
To: ast; +Cc: daniel, shuah, netdev
From: Alexei Starovoitov <ast@fb.com>
Date: Fri, 10 Mar 2017 22:05:55 -0800
> Recent merge of 'linux-kselftest-4.11-rc1' tree broke bpf test build.
> None of the tests were building and test_verifier.c had tons of compiler errors.
> Fix it and add #ifdef CAP_IS_SUPPORTED to support old versions of libcap.
> Tested on centos 6.8 and 7
>
> Signed-off-by: Alexei Starovoitov <ast@kernel.org>
Applied, thanks.
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-03-13 6:48 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2017-03-11 6:05 [PATCH net] selftests/bpf: fix broken build Alexei Starovoitov
2017-03-11 11:59 ` Daniel Borkmann
2017-03-13 6:48 ` David Miller
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.