Skip to content

Commit 92e5605

Browse files
committed
Merge tag 'linux_kselftest-fixes-6.10-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest
Pull kselftest fixes from Shuah Khan: - filesystems: warn_unused_result warnings - seccomp: format-zero-length warnings - fchmodat2: clang build warnings due to-static-libasan - openat2: clang build warnings due to static-libasan, LOCAL_HDRS * tag 'linux_kselftest-fixes-6.10-rc5' of git://git.kernel.org/pub/scm/linux/kernel/git/shuah/linux-kselftest: selftests/fchmodat2: fix clang build failure due to -static-libasan selftests/openat2: fix clang build failures: -static-libasan, LOCAL_HDRS selftests: seccomp: fix format-zero-length warnings selftests: filesystems: fix warn_unused_result build warnings
2 parents 5d272dd + ed3994a commit 92e5605

File tree

4 files changed

+35
-8
lines changed

4 files changed

+35
-8
lines changed
Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,15 @@
11
# SPDX-License-Identifier: GPL-2.0-or-later
22

3-
CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined -static-libasan $(KHDR_INCLUDES)
3+
CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined $(KHDR_INCLUDES)
4+
5+
# gcc requires -static-libasan in order to ensure that Address Sanitizer's
6+
# library is the first one loaded. However, clang already statically links the
7+
# Address Sanitizer if -fsanitize is specified. Therefore, simply omit
8+
# -static-libasan for clang builds.
9+
ifeq ($(LLVM),)
10+
CFLAGS += -static-libasan
11+
endif
12+
413
TEST_GEN_PROGS := fchmodat2_test
514

615
include ../lib.mk

tools/testing/selftests/filesystems/statmount/statmount_test.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -125,8 +125,16 @@ static uint32_t old_root_id, old_parent_id;
125125

126126
static void cleanup_namespace(void)
127127
{
128-
fchdir(orig_root);
129-
chroot(".");
128+
int ret;
129+
130+
ret = fchdir(orig_root);
131+
if (ret == -1)
132+
ksft_perror("fchdir to original root");
133+
134+
ret = chroot(".");
135+
if (ret == -1)
136+
ksft_perror("chroot to original root");
137+
130138
umount2(root_mntpoint, MNT_DETACH);
131139
rmdir(root_mntpoint);
132140
}
Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,18 @@
11
# SPDX-License-Identifier: GPL-2.0-or-later
22

3-
CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined -static-libasan
3+
CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined
44
TEST_GEN_PROGS := openat2_test resolve_test rename_attack_test
55

6+
# gcc requires -static-libasan in order to ensure that Address Sanitizer's
7+
# library is the first one loaded. However, clang already statically links the
8+
# Address Sanitizer if -fsanitize is specified. Therefore, simply omit
9+
# -static-libasan for clang builds.
10+
ifeq ($(LLVM),)
11+
CFLAGS += -static-libasan
12+
endif
13+
14+
LOCAL_HDRS += helpers.h
15+
616
include ../lib.mk
717

8-
$(TEST_GEN_PROGS): helpers.c helpers.h
18+
$(TEST_GEN_PROGS): helpers.c

tools/testing/selftests/seccomp/seccomp_benchmark.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -194,14 +194,14 @@ int main(int argc, char *argv[])
194194
ksft_set_plan(7);
195195

196196
ksft_print_msg("Running on:\n");
197-
ksft_print_msg("");
197+
ksft_print_msg("%s", "");
198198
system("uname -a");
199199

200200
ksft_print_msg("Current BPF sysctl settings:\n");
201201
/* Avoid using "sysctl" which may not be installed. */
202-
ksft_print_msg("");
202+
ksft_print_msg("%s", "");
203203
system("grep -H . /proc/sys/net/core/bpf_jit_enable");
204-
ksft_print_msg("");
204+
ksft_print_msg("%s", "");
205205
system("grep -H . /proc/sys/net/core/bpf_jit_harden");
206206

207207
affinity();

0 commit comments

Comments
 (0)