selftests/bpf: Declare bpf_log_buf variables as static
Subsystems (5)
PATCH 1/1 selftests/bpf: Declare bpf_log_buf variables as static
The cgroup selftests did not declare the bpf_log_buf variable as static, leading to a linker error with GCC 10 (which defaults to -fno-common). Fix this by adding the missing static declarations.
--- .../testing/selftests/bpf/prog_tests/cgroup_attach_autodetach.c | 2 +- tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c | 2 +- tools/testing/selftests/bpf/prog_tests/cgroup_attach_override.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)
tools/testing/selftests/bpf/prog_tests/cgroup_attach_autodetach.c +1 -1
@@ -6,7 +6,7 @@#define PING_CMD "ping -q -c1 -w1 127.0.0.1 > /dev/null" -char bpf_log_buf[BPF_LOG_BUF_SIZE ]; +static char bpf_log_buf[BPF_LOG_BUF_SIZE ];static int prog_load (void ) {
tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c +1 -1
@@ -6,7 +6,7 @@#define PING_CMD "ping -q -c1 -w1 127.0.0.1 > /dev/null" -char bpf_log_buf[BPF_LOG_BUF_SIZE ]; +static char bpf_log_buf[BPF_LOG_BUF_SIZE ];static int map_fd =-1 ;
tools/testing/selftests/bpf/prog_tests/cgroup_attach_override.c +1 -1
@@ -8,7 +8,7 @@#define BAR "/foo/bar/"#define PING_CMD "ping -q -c1 -w1 127.0.0.1 > /dev/null" -char bpf_log_buf[BPF_LOG_BUF_SIZE ]; +static char bpf_log_buf[BPF_LOG_BUF_SIZE ];static int prog_load (int verdict) {
Signature · 1 line
2.25.1
Toke Høiland-Jørgensen <[email protected]> [Mon, 2020-03-02 06:54 -0800]:
Quoted 5 lines
The cgroup selftests did not declare the
bpf_log_bufvariable as static, leading to a linker error with GCC 10 (which defaults to -fno-common). Fix this by adding the missing static declarations.Fixes 257c88559f36 ("selftests/bpf: Convert test_cgroup_attach to prog_tests")
Hi Toke,
Thanks for the fix.
My 257c88559f36 commit was just a split that simply moved this bpf_log_buf from tools/testing/selftests/bpf/test_cgroup_attach.c to all new three files as is among many other things. Before that it was moved as is from samples/ inba0c0cc05dda ("selftests/bpf: convert test_cgrp2_attach2 example into kselftest") and before that it was introduced ind40fc181ebec ("samples/bpf: Make samples more libbpf-centric")
Though since these are new files I guess having just 257c88559f36 in the tag should be fine(?) so:
Quoted 49 lines
Signed-off-by Toke Høiland-Jørgensen <[email protected]>--- .../testing/selftests/bpf/prog_tests/cgroup_attach_autodetach.c | 2 +- tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c | 2 +- tools/testing/selftests/bpf/prog_tests/cgroup_attach_override.c | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-)tools/testing/selftests/bpf/prog_tests/cgroup_attach_autodetach.c +1
-1@@ -6,7 +6,7 @@#define PING_CMD "ping -q -c1 -w1 127.0.0.1 > /dev/null" -char bpf_log_buf[BPF_LOG_BUF_SIZE ]; +static char bpf_log_buf[BPF_LOG_BUF_SIZE ];static int prog_load (void ) {tools/testing/selftests/bpf/prog_tests/cgroup_attach_multi.c +1
-1@@ -6,7 +6,7 @@#define PING_CMD "ping -q -c1 -w1 127.0.0.1 > /dev/null" -char bpf_log_buf[BPF_LOG_BUF_SIZE ]; +static char bpf_log_buf[BPF_LOG_BUF_SIZE ];static int map_fd =-1 ;tools/testing/selftests/bpf/prog_tests/cgroup_attach_override.c +1
-1@@ -8,7 +8,7 @@#define BAR "/foo/bar/"#define PING_CMD "ping -q -c1 -w1 127.0.0.1 > /dev/null" -char bpf_log_buf[BPF_LOG_BUF_SIZE ]; +static char bpf_log_buf[BPF_LOG_BUF_SIZE ];static int prog_load (int verdict) {Signature · 1 line
2.25.1
Signature · 1 line
Andrey Ignatov
Quoted 19 lines · Andrey Ignatov
Toke Høiland-Jørgensen <[email protected]> [Mon, 2020-03-02 06:54 -0800]:
Quoted 5 lines
The cgroup selftests did not declare the
bpf_log_bufvariable as static, leading to a linker error with GCC 10 (which defaults to -fno-common). Fix this by adding the missing static declarations.Fixes 257c88559f36 ("selftests/bpf: Convert test_cgroup_attach to prog_tests")Hi Toke,
Thanks for the fix.
My
257c88559f36commit was just a split that simply moved thisbpf_log_buffromtools/testing/selftests/bpf/test_cgroup_attach.cto all new three files as is among many other things. Before that it was moved as is fromsamples/inba0c0cc05dda("selftests/bpf: converttest_cgrp2_attach2example into kselftest") and before that it was introduced ind40fc181ebec("samples/bpf: Make samples more libbpf-centric")
Quoted 2 lines
Though since these are new files I guess having just
257c88559f36in the tag should be fine(?) so:
Yeah, I did realise you didn't write the original code, but this Fixes tag should at least make the patch be picked up by any stable trees after you moved things around, so I guess that's good enough :)
-Toke
Alexei Starovoitov
AppliedQuoted 6 lines · Toke Høiland-Jørgensen
The cgroup selftests did not declare the
bpf_log_bufvariable as static, leading to a linker error with GCC 10 (which defaults to -fno-common). Fix this by adding the missing static declarations.Fixes 257c88559f36 ("selftests/bpf: Convert test_cgroup_attach to prog_tests")Signed-off-by Toke Høiland-Jørgensen <[email protected]>
Applied to bpf-next.
It's hardly a fix. Fixes tag doesn't make it a fix in my mind. I really see no point rushing it into bpf->net->Linus's tree at this point.
Quoted 10 lines · Alexei Starovoitov
Quoted 6 lines · Toke Høiland-Jørgensen
The cgroup selftests did not declare the
bpf_log_bufvariable as static, leading to a linker error with GCC 10 (which defaults to -fno-common). Fix this by adding the missing static declarations.Fixes 257c88559f36 ("selftests/bpf: Convert test_cgroup_attach to prog_tests")Signed-off-by Toke Høiland-Jørgensen <[email protected]>Applied to bpf-next.
It's hardly a fix. Fixes tag doesn't make it a fix in my mind.
It fixes a compile error of selftests with GCC 10; how is that not a fix? We found it while setting up a CI test compiling Linus' tree on Fedora rawhide, so it does happen in the wild.
Quoted 1 line
I really see no point rushing it into bpf->net->Linus's tree at this point.
Well if you're not pushing any other fixes then OK, sure, no reason to go through the whole process just for this. But if you end up pushing another round of fixes anyway, please include this as well. If not, I guess we can wait :)
-Toke
Quoted 18 lines · Toke Høiland-Jørgensen
Quoted 10 lines · Alexei Starovoitov
Quoted 6 lines · Toke Høiland-Jørgensen
The cgroup selftests did not declare the
bpf_log_bufvariable as static, leading to a linker error with GCC 10 (which defaults to -fno-common). Fix this by adding the missing static declarations.Fixes 257c88559f36 ("selftests/bpf: Convert test_cgroup_attach to prog_tests")Signed-off-by Toke Høiland-Jørgensen <[email protected]>Applied to bpf-next.
It's hardly a fix. Fixes tag doesn't make it a fix in my mind.It fixes a compile error of selftests with GCC 10; how is that not a fix? We found it while setting up a CI test compiling Linus' tree on Fedora rawhide, so it does happen in the wild.
Quoted 6 lines
Quoted 1 line
I really see no point rushing it into bpf->net->Linus's tree at this point.
Well if you're not pushing any other fixes then OK, sure, no reason to go through the whole process just for this. But if you end up pushing another round of fixes anyway, please include this as well. If not, I guess we can wait :)
CI stands for Continuous Integration == development. stable tree is not for development.
If you want to develop anything or accommodate the tree for external development you need to use development tree. Which is bpf-next.