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: <20201203160245.1014867-12-jackmanb@google.com>
Date:   Thu,  3 Dec 2020 16:02:42 +0000
From:   Brendan Jackman <jackmanb@...gle.com>
To:     bpf@...r.kernel.org
Cc:     Alexei Starovoitov <ast@...nel.org>, Yonghong Song <yhs@...com>,
        Daniel Borkmann <daniel@...earbox.net>,
        KP Singh <kpsingh@...omium.org>,
        Florent Revest <revest@...omium.org>,
        linux-kernel@...r.kernel.org, Jann Horn <jannh@...gle.com>,
        Brendan Jackman <jackmanb@...gle.com>,
        Arnaldo Carvalho de Melo <acme@...hat.com>,
        Jiri Olsa <jolsa@...nel.org>,
        Quentin Monnet <quentin@...valent.com>,
        "Frank Ch. Eigler" <fche@...hat.com>,
        Stephane Eranian <eranian@...gle.com>,
        Namhyung Kim <namhyung@...nel.org>,
        Thomas Hebb <tommyhebb@...il.com>
Subject: [PATCH bpf-next v3 11/14] tools build: Implement feature check for
 BPF atomics in Clang

Change-Id: Ia15bb76f7152fff2974e38242d7430ce2987a71e

Cc: Arnaldo Carvalho de Melo <acme@...hat.com>
Cc: Jiri Olsa <jolsa@...nel.org>
Cc: Quentin Monnet <quentin@...valent.com>
Cc: "Frank Ch. Eigler" <fche@...hat.com>
Cc: Stephane Eranian <eranian@...gle.com>
Cc: Namhyung Kim <namhyung@...nel.org>
Cc: Thomas Hebb <tommyhebb@...il.com>
Change-Id: Ie2c3832eaf050d627764071d1927c7546e7c4b4b
Signed-off-by: Brendan Jackman <jackmanb@...gle.com>
---
 tools/build/feature/Makefile                 | 4 ++++
 tools/build/feature/test-clang-bpf-atomics.c | 9 +++++++++
 2 files changed, 13 insertions(+)
 create mode 100644 tools/build/feature/test-clang-bpf-atomics.c

diff --git a/tools/build/feature/Makefile b/tools/build/feature/Makefile
index cdde783f3018..81370d7fa193 100644
--- a/tools/build/feature/Makefile
+++ b/tools/build/feature/Makefile
@@ -70,6 +70,7 @@ FILES=                                          \
          test-libaio.bin			\
          test-libzstd.bin			\
          test-clang-bpf-co-re.bin		\
+         test-clang-bpf-atomics.bin		\
          test-file-handle.bin			\
          test-libpfm4.bin
 
@@ -331,6 +332,9 @@ $(OUTPUT)test-clang-bpf-co-re.bin:
 	$(CLANG) -S -g -target bpf -o - $(patsubst %.bin,%.c,$(@F)) |	\
 		grep BTF_KIND_VAR
 
+$(OUTPUT)test-clang-bpf-atomics.bin:
+	$(CLANG) -S -g -target bpf -mcpu=v3 -Werror=implicit-function-declaration -o - $(patsubst %.bin,%.c,$(@F)) 2>&1
+
 $(OUTPUT)test-file-handle.bin:
 	$(BUILD)
 
diff --git a/tools/build/feature/test-clang-bpf-atomics.c b/tools/build/feature/test-clang-bpf-atomics.c
new file mode 100644
index 000000000000..8b5fcdd4ba6f
--- /dev/null
+++ b/tools/build/feature/test-clang-bpf-atomics.c
@@ -0,0 +1,9 @@
+// SPDX-License-Identifier: GPL-2.0
+// Copyright (c) 2020 Google
+
+int x = 0;
+
+int foo(void)
+{
+	return __sync_val_compare_and_swap(&x, 1, 2);
+}
-- 
2.29.2.454.gaff20da3a2-goog

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ