linux_kselftest-fixes-6.10-rc5

This kselftest fixes update consists of 4 fixes to the following
 build warnings:
 
 - 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
 -----BEGIN PGP SIGNATURE-----
 
 iQIzBAABCgAdFiEEPZKym/RZuOCGeA/kCwJExA0NQxwFAmZxxK8ACgkQCwJExA0N
 QxzD/BAAheSzmhNpJX/z3LPMz5aSr/vuYGE6yOlBPl3ESK6jthP/Qw/k8A7RfxHJ
 07B0OdQdBJJJpEw800biJpUWp8aeP0ireyqf/UNxZhPlM6p2070Wazv4vVo0O3Xe
 2MdFofrPV7pIB9zIXHRvwTKlfXrd53AsakxFD+2ezrl52kDzeMKvP+aypCYxD5+m
 J1d8XLNFsUwu3iIghO5wGrKax29+qM9F/cUk12oDsVDqV625cwPLwt3ricvRLo+F
 8G9JaTI6bUWK8danDGPCh67RRtGCU+CYVVc79bZiW3TFt2EYaL5wi2IIpLv8Hsig
 FJFvwYq7YjvBMEfDTxdomFP4zC02E0yxatckeOrzVH38SdqnjIVPhhr/1dtvn6om
 Ii+4JtgrB+ogiNYC4N1Y79dliUrRLUGcbhoVjdZLUE+vgEGVNsWI5dq98iQJ8zBA
 TvPY/MoU8G18F+41vbn3QErKM91GQWZhiMMkeinksb1xa1FpCSePIh/DXM/qoqD4
 pOw8WZpLdLVw0dgPLTVxn2AGXf0zz2c6cf+3mqzvCT+yrhnKppL5TKPgs6spqihS
 RWgxbwDbcTbqThHsZYcPEzLDnHZbIwgJkrWfShG0BwhrXiBYQ04uFfu67gpTohsd
 ABuqD4342UHZ4FIQ68OJXZz28uJWolaj2FXpFneR/JQT/MfvQWI=
 =1XhG
 -----END PGP SIGNATURE-----

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
This commit is contained in:
Linus Torvalds 2024-06-18 13:36:43 -07:00
commit 92e5605a19
4 changed files with 35 additions and 8 deletions

View File

@ -1,6 +1,15 @@
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined -static-libasan $(KHDR_INCLUDES) CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined $(KHDR_INCLUDES)
# gcc requires -static-libasan in order to ensure that Address Sanitizer's
# library is the first one loaded. However, clang already statically links the
# Address Sanitizer if -fsanitize is specified. Therefore, simply omit
# -static-libasan for clang builds.
ifeq ($(LLVM),)
CFLAGS += -static-libasan
endif
TEST_GEN_PROGS := fchmodat2_test TEST_GEN_PROGS := fchmodat2_test
include ../lib.mk include ../lib.mk

View File

@ -125,8 +125,16 @@ static uint32_t old_root_id, old_parent_id;
static void cleanup_namespace(void) static void cleanup_namespace(void)
{ {
fchdir(orig_root); int ret;
chroot(".");
ret = fchdir(orig_root);
if (ret == -1)
ksft_perror("fchdir to original root");
ret = chroot(".");
if (ret == -1)
ksft_perror("chroot to original root");
umount2(root_mntpoint, MNT_DETACH); umount2(root_mntpoint, MNT_DETACH);
rmdir(root_mntpoint); rmdir(root_mntpoint);
} }

View File

@ -1,8 +1,18 @@
# SPDX-License-Identifier: GPL-2.0-or-later # SPDX-License-Identifier: GPL-2.0-or-later
CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined -static-libasan CFLAGS += -Wall -O2 -g -fsanitize=address -fsanitize=undefined
TEST_GEN_PROGS := openat2_test resolve_test rename_attack_test TEST_GEN_PROGS := openat2_test resolve_test rename_attack_test
# gcc requires -static-libasan in order to ensure that Address Sanitizer's
# library is the first one loaded. However, clang already statically links the
# Address Sanitizer if -fsanitize is specified. Therefore, simply omit
# -static-libasan for clang builds.
ifeq ($(LLVM),)
CFLAGS += -static-libasan
endif
LOCAL_HDRS += helpers.h
include ../lib.mk include ../lib.mk
$(TEST_GEN_PROGS): helpers.c helpers.h $(TEST_GEN_PROGS): helpers.c

View File

@ -194,14 +194,14 @@ int main(int argc, char *argv[])
ksft_set_plan(7); ksft_set_plan(7);
ksft_print_msg("Running on:\n"); ksft_print_msg("Running on:\n");
ksft_print_msg(""); ksft_print_msg("%s", "");
system("uname -a"); system("uname -a");
ksft_print_msg("Current BPF sysctl settings:\n"); ksft_print_msg("Current BPF sysctl settings:\n");
/* Avoid using "sysctl" which may not be installed. */ /* Avoid using "sysctl" which may not be installed. */
ksft_print_msg(""); ksft_print_msg("%s", "");
system("grep -H . /proc/sys/net/core/bpf_jit_enable"); system("grep -H . /proc/sys/net/core/bpf_jit_enable");
ksft_print_msg(""); ksft_print_msg("%s", "");
system("grep -H . /proc/sys/net/core/bpf_jit_harden"); system("grep -H . /proc/sys/net/core/bpf_jit_harden");
affinity(); affinity();