Skip to content

Commit 1e8e05a

Browse files
authored
Sync kernel-patches/vmtest (#170)
1 parent 236da0f commit 1e8e05a

11 files changed

+2870
-4
lines changed

.github/workflows/kernel-build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ jobs:
5252

5353
BPF_NEXT_BASE_BRANCH: 'master'
5454
BPF_NEXT_FETCH_DEPTH: 64 # A bit of history is needed to facilitate incremental builds
55-
BUILD_SCHED_EXT_SELFTESTS: ${{ inputs.arch == 'x86_64' || inputs.arch == 'aarch64' && 'true' || '' }}
55+
# BUILD_SCHED_EXT_SELFTESTS: ${{ inputs.arch == 'x86_64' || inputs.arch == 'aarch64' && 'true' || '' }}
5656
KBUILD_OUTPUT: ${{ github.workspace }}/kbuild-output
5757
KERNEL: ${{ inputs.kernel }}
5858
KERNEL_ROOT: ${{ github.workspace }}

.github/workflows/test.yml

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,8 @@ jobs:
2626
- {"test": "test_progs_no_alu32", "continue_on_error": false, "timeout_minutes": 360}
2727
- {"test": "test_verifier", "continue_on_error": false, "timeout_minutes": 360}
2828
- {"test": "test_maps", "continue_on_error": false, "timeout_minutes": 360}
29-
- {"test": "test_progs-bpf_gcc", "continue_on_error": false, "timeout_minutes": 360}
30-
# Uncomment this to enable sched_ext selftests jobs
3129
# - {"test": "sched_ext", "continue_on_error": false, "timeout_minutes": 360}
30+
# - {"test": "test_progs-bpf_gcc", "continue_on_error": false, "timeout_minutes": 360}
3231
fail-fast: false
3332
# Setting name to arch-compiler here to avoid lengthy autogenerated names due to matrix
3433
# e.g build-and-test x86_64-gcc / test (test_progs_parallel, true, 30) / test_progs_parallel on x86_64 with gcc
Lines changed: 46 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,46 @@
1+
From faf291ff4beaef8dedebd166f11f815cdee257dc Mon Sep 17 00:00:00 2001
2+
From: "Masami Hiramatsu (Google)" <[email protected]>
3+
Date: Wed, 29 Jan 2025 00:29:37 +0900
4+
Subject: [PATCH 2000/2001] s390: fgraph: Fix to remove
5+
ftrace_test_recursion_trylock()
6+
7+
Fix to remove ftrace_test_recursion_trylock() from ftrace_graph_func()
8+
because commit d576aec24df9 ("fgraph: Get ftrace recursion lock in
9+
function_graph_enter") has been moved it to function_graph_enter_regs()
10+
already.
11+
12+
Reported-by: Jiri Olsa <[email protected]>
13+
Closes: https://lore.kernel.org/all/Z5O0shrdgeExZ2kF@krava/
14+
Fixes: d576aec24df9 ("fgraph: Get ftrace recursion lock in function_graph_enter")
15+
Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
16+
Tested-by: Jiri Olsa <[email protected]>
17+
---
18+
arch/s390/kernel/ftrace.c | 5 -----
19+
1 file changed, 5 deletions(-)
20+
21+
diff --git a/arch/s390/kernel/ftrace.c b/arch/s390/kernel/ftrace.c
22+
index c0b2c97efefb..63ba6306632e 100644
23+
--- a/arch/s390/kernel/ftrace.c
24+
+++ b/arch/s390/kernel/ftrace.c
25+
@@ -266,18 +266,13 @@ void ftrace_graph_func(unsigned long ip, unsigned long parent_ip,
26+
struct ftrace_ops *op, struct ftrace_regs *fregs)
27+
{
28+
unsigned long *parent = &arch_ftrace_regs(fregs)->regs.gprs[14];
29+
- int bit;
30+
31+
if (unlikely(ftrace_graph_is_dead()))
32+
return;
33+
if (unlikely(atomic_read(&current->tracing_graph_pause)))
34+
return;
35+
- bit = ftrace_test_recursion_trylock(ip, *parent);
36+
- if (bit < 0)
37+
- return;
38+
if (!function_graph_enter_regs(*parent, ip, 0, parent, fregs))
39+
*parent = (unsigned long)&return_to_handler;
40+
- ftrace_test_recursion_unlock(bit);
41+
}
42+
43+
#endif /* CONFIG_FUNCTION_GRAPH_TRACER */
44+
--
45+
2.48.1
46+
Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,28 @@
1+
From 04fce0d606f59a62105729094013c4784492ec7b Mon Sep 17 00:00:00 2001
2+
From: "Masami Hiramatsu (Google)" <[email protected]>
3+
Date: Wed, 29 Jan 2025 00:29:48 +0900
4+
Subject: [PATCH 2001/2001] s390: tracing: Define ftrace_get_symaddr() for s390
5+
6+
Add ftrace_get_symaddr() for s390, which returns the symbol address
7+
from ftrace's 'ip' parameter.
8+
9+
Signed-off-by: Masami Hiramatsu (Google) <[email protected]>
10+
---
11+
arch/s390/include/asm/ftrace.h | 1 +
12+
1 file changed, 1 insertion(+)
13+
14+
diff --git a/arch/s390/include/asm/ftrace.h b/arch/s390/include/asm/ftrace.h
15+
index a3b73a4f626e..185331e91f83 100644
16+
--- a/arch/s390/include/asm/ftrace.h
17+
+++ b/arch/s390/include/asm/ftrace.h
18+
@@ -51,6 +51,7 @@ static inline unsigned long ftrace_call_adjust(unsigned long addr)
19+
{
20+
return addr;
21+
}
22+
+#define ftrace_get_symaddr(fentry_ip) ((unsigned long)(fentry_ip))
23+
24+
#include <linux/ftrace_regs.h>
25+
26+
--
27+
2.48.1
28+
Lines changed: 75 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,75 @@
1+
From f44275e7155dc310d36516fc25be503da099781c Mon Sep 17 00:00:00 2001
2+
From: Ihor Solodrai <[email protected]>
3+
Date: Mon, 6 Jan 2025 20:17:31 +0000
4+
Subject: [PATCH] selftests/bpf: add -fno-strict-aliasing to BPF_CFLAGS
5+
6+
Following the discussion at [1], set -fno-strict-aliasing flag for all
7+
BPF object build rules. Remove now unnecessary <test>-CFLAGS variables.
8+
9+
[1] https://lore.kernel.org/bpf/[email protected]/
10+
11+
CC: Jose E. Marchesi <[email protected]>
12+
Signed-off-by: Ihor Solodrai <[email protected]>
13+
Acked-by: Eduard Zingerman <[email protected]>
14+
Link: https://lore.kernel.org/r/[email protected]
15+
Signed-off-by: Alexei Starovoitov <[email protected]>
16+
---
17+
tools/testing/selftests/bpf/Makefile | 28 +---------------------------
18+
1 file changed, 1 insertion(+), 27 deletions(-)
19+
20+
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
21+
index eb4d21651aa7..d5be2f94deef 100644
22+
--- a/tools/testing/selftests/bpf/Makefile
23+
+++ b/tools/testing/selftests/bpf/Makefile
24+
@@ -54,21 +54,6 @@ PCAP_LIBS := $(shell $(PKG_CONFIG) --libs libpcap 2>/dev/null)
25+
LDLIBS += $(PCAP_LIBS)
26+
CFLAGS += $(PCAP_CFLAGS)
27+
28+
-# The following tests perform type punning and they may break strict
29+
-# aliasing rules, which are exploited by both GCC and clang by default
30+
-# while optimizing. This can lead to broken programs.
31+
-progs/bind4_prog.c-CFLAGS := -fno-strict-aliasing
32+
-progs/bind6_prog.c-CFLAGS := -fno-strict-aliasing
33+
-progs/dynptr_fail.c-CFLAGS := -fno-strict-aliasing
34+
-progs/linked_list_fail.c-CFLAGS := -fno-strict-aliasing
35+
-progs/map_kptr_fail.c-CFLAGS := -fno-strict-aliasing
36+
-progs/syscall.c-CFLAGS := -fno-strict-aliasing
37+
-progs/test_pkt_md_access.c-CFLAGS := -fno-strict-aliasing
38+
-progs/test_sk_lookup.c-CFLAGS := -fno-strict-aliasing
39+
-progs/timer_crash.c-CFLAGS := -fno-strict-aliasing
40+
-progs/test_global_func9.c-CFLAGS := -fno-strict-aliasing
41+
-progs/verifier_nocsr.c-CFLAGS := -fno-strict-aliasing
42+
-
43+
# Some utility functions use LLVM libraries
44+
jit_disasm_helpers.c-CFLAGS = $(LLVM_CFLAGS)
45+
46+
@@ -103,18 +88,6 @@ progs/btf_dump_test_case_packing.c-bpf_gcc-CFLAGS := -Wno-error
47+
progs/btf_dump_test_case_padding.c-bpf_gcc-CFLAGS := -Wno-error
48+
progs/btf_dump_test_case_syntax.c-bpf_gcc-CFLAGS := -Wno-error
49+
50+
-# The following tests do type-punning, via the __imm_insn macro, from
51+
-# `struct bpf_insn' to long and then uses the value. This triggers an
52+
-# "is used uninitialized" warning in GCC due to strict-aliasing
53+
-# rules.
54+
-progs/verifier_ref_tracking.c-bpf_gcc-CFLAGS := -fno-strict-aliasing
55+
-progs/verifier_unpriv.c-bpf_gcc-CFLAGS := -fno-strict-aliasing
56+
-progs/verifier_cgroup_storage.c-bpf_gcc-CFLAGS := -fno-strict-aliasing
57+
-progs/verifier_ld_ind.c-bpf_gcc-CFLAGS := -fno-strict-aliasing
58+
-progs/verifier_map_ret_val.c-bpf_gcc-CFLAGS := -fno-strict-aliasing
59+
-progs/verifier_spill_fill.c-bpf_gcc-CFLAGS := -fno-strict-aliasing
60+
-progs/verifier_subprog_precision.c-bpf_gcc-CFLAGS := -fno-strict-aliasing
61+
-progs/verifier_uninit.c-bpf_gcc-CFLAGS := -fno-strict-aliasing
62+
endif
63+
64+
ifneq ($(CLANG_CPUV4),)
65+
@@ -474,6 +447,7 @@ CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH))
66+
BPF_CFLAGS = -g -Wall -Werror -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN) \
67+
-I$(INCLUDE_DIR) -I$(CURDIR) -I$(APIDIR) \
68+
-I$(abspath $(OUTPUT)/../usr/include) \
69+
+ -fno-strict-aliasing \
70+
-Wno-compare-distinct-pointer-types
71+
# TODO: enable me -Wsign-compare
72+
73+
--
74+
2.47.1
75+
Lines changed: 63 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,63 @@
1+
From bab18c7db44d3aa6c84450095451580922359c7a Mon Sep 17 00:00:00 2001
2+
From: Ihor Solodrai <[email protected]>
3+
Date: Tue, 7 Jan 2025 23:58:18 +0000
4+
Subject: [PATCH] selftests/bpf: add -std=gnu11 to BPF_CFLAGS and CFLAGS
5+
6+
Latest versions of GCC BPF use C23 standard by default. This causes
7+
compilation errors in vmlinux.h due to bool types declarations.
8+
9+
Add -std=gnu11 to BPF_CFLAGS and CFLAGS. This aligns with the version
10+
of the standard used when building the kernel currently [1].
11+
12+
For more details see the discussions at [2] and [3].
13+
14+
[1] https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/tree/Makefile#n465
15+
[2] https://lore.kernel.org/bpf/EYcXjcKDCJY7Yb0GGtAAb7nLKPEvrgWdvWpuNzXm2qi6rYMZDixKv5KwfVVMBq17V55xyC-A1wIjrqG3aw-Imqudo9q9X7D7nLU2gWgbN0w=@pm.me/
16+
[3] https://lore.kernel.org/bpf/[email protected]/
17+
18+
CC: Jose E. Marchesi <[email protected]>
19+
Signed-off-by: Ihor Solodrai <[email protected]>
20+
Link: https://lore.kernel.org/r/[email protected]
21+
Signed-off-by: Alexei Starovoitov <[email protected]>
22+
---
23+
tools/testing/selftests/bpf/Makefile | 8 ++++++--
24+
1 file changed, 6 insertions(+), 2 deletions(-)
25+
26+
diff --git a/tools/testing/selftests/bpf/Makefile b/tools/testing/selftests/bpf/Makefile
27+
index d5be2f94deef..ea9cee5de0f8 100644
28+
--- a/tools/testing/selftests/bpf/Makefile
29+
+++ b/tools/testing/selftests/bpf/Makefile
30+
@@ -41,7 +41,7 @@ srctree := $(patsubst %/,%,$(dir $(srctree)))
31+
srctree := $(patsubst %/,%,$(dir $(srctree)))
32+
endif
33+
34+
-CFLAGS += -g $(OPT_FLAGS) -rdynamic \
35+
+CFLAGS += -g $(OPT_FLAGS) -rdynamic -std=gnu11 \
36+
-Wall -Werror -fno-omit-frame-pointer \
37+
$(GENFLAGS) $(SAN_CFLAGS) $(LIBELF_CFLAGS) \
38+
-I$(CURDIR) -I$(INCLUDE_DIR) -I$(GENDIR) -I$(LIBDIR) \
39+
@@ -447,6 +447,7 @@ CLANG_SYS_INCLUDES = $(call get_sys_includes,$(CLANG),$(CLANG_TARGET_ARCH))
40+
BPF_CFLAGS = -g -Wall -Werror -D__TARGET_ARCH_$(SRCARCH) $(MENDIAN) \
41+
-I$(INCLUDE_DIR) -I$(CURDIR) -I$(APIDIR) \
42+
-I$(abspath $(OUTPUT)/../usr/include) \
43+
+ -std=gnu11 \
44+
-fno-strict-aliasing \
45+
-Wno-compare-distinct-pointer-types
46+
# TODO: enable me -Wsign-compare
47+
@@ -787,9 +788,12 @@ $(OUTPUT)/xdp_features: xdp_features.c $(OUTPUT)/network_helpers.o $(OUTPUT)/xdp
48+
$(Q)$(CC) $(CFLAGS) $(filter %.a %.o %.c,$^) $(LDLIBS) -o $@
49+
50+
# Make sure we are able to include and link libbpf against c++.
51+
+CXXFLAGS += $(CFLAGS)
52+
+CXXFLAGS := $(subst -D_GNU_SOURCE=,,$(CXXFLAGS))
53+
+CXXFLAGS := $(subst -std=gnu11,-std=gnu++11,$(CXXFLAGS))
54+
$(OUTPUT)/test_cpp: test_cpp.cpp $(OUTPUT)/test_core_extern.skel.h $(BPFOBJ)
55+
$(call msg,CXX,,$@)
56+
- $(Q)$(CXX) $(subst -D_GNU_SOURCE=,,$(CFLAGS)) $(filter %.a %.o %.cpp,$^) $(LDLIBS) -o $@
57+
+ $(Q)$(CXX) $(CXXFLAGS) $(filter %.a %.o %.cpp,$^) $(LDLIBS) -o $@
58+
59+
# Benchmark runner
60+
$(OUTPUT)/bench_%.o: benchs/bench_%.c bench.h $(BPFOBJ)
61+
--
62+
2.47.1
63+

0 commit comments

Comments
 (0)