selftests/nolibc: remove gettimeofday_bad1/2 completely
authorZhangjin Wu <falcon@tinylab.org>
Sat, 3 Jun 2023 08:14:55 +0000 (16:14 +0800)
committerPaul E. McKenney <paulmck@kernel.org>
Fri, 9 Jun 2023 18:46:10 +0000 (11:46 -0700)
In the clock_gettime / clock_gettime64 syscalls based gettimeofday(),
there is no way to let kernel space 'fixup' the invalid data pointer of
'struct timeval' and 'struct timezone' for us for we need to read
timespec from kernel space and then convert to timeval in user-space
ourselves and also we need to simply ignore and reset timezone in
user-space.

Without this removal, the invalid (void *)1 address will trigger a
sigsegv (signum = 11) signal and stop the whole test.

Suggested-by: Willy Tarreau <w@1wt.eu>
Link: https://lore.kernel.org/linux-riscv/20230528113325.GJ1956@1wt.eu/
Signed-off-by: Zhangjin Wu <falcon@tinylab.org>
Reviewed-by: Thomas Weißschuh <linux@weissschuh.net>
Signed-off-by: Willy Tarreau <w@1wt.eu>
Signed-off-by: Paul E. McKenney <paulmck@kernel.org>
tools/testing/selftests/nolibc/nolibc-test.c

index 7896bc3f609ef91683d9a5e362820a2340cd959c..b1f3ad25de3585f7294491f5f76d0ab94e65bc2c 100644 (file)
@@ -593,10 +593,6 @@ int run_syscall(int min, int max)
                CASE_TEST(fork);              EXPECT_SYSZR(1, test_fork()); break;
                CASE_TEST(getdents64_root);   EXPECT_SYSNE(1, test_getdents64("/"), -1); break;
                CASE_TEST(getdents64_null);   EXPECT_SYSER(1, test_getdents64("/dev/null"), -1, ENOTDIR); break;
-#ifdef NOLIBC
-               CASE_TEST(gettimeofday_bad1); EXPECT_SYSER(1, gettimeofday((void *)1, NULL), -1, EFAULT); break;
-               CASE_TEST(gettimeofday_bad2); EXPECT_SYSER(1, gettimeofday(NULL, (void *)1), -1, EFAULT); break;
-#endif
                CASE_TEST(getpagesize);       EXPECT_SYSZR(1, test_getpagesize()); break;
                CASE_TEST(ioctl_tiocinq);     EXPECT_SYSZR(1, ioctl(0, TIOCINQ, &tmp)); break;
                CASE_TEST(ioctl_tiocinq);     EXPECT_SYSZR(1, ioctl(0, TIOCINQ, &tmp)); break;