lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20240929-nolibc-csky-v1-5-bb28031a73b0@weissschuh.net>
Date: Sun, 29 Sep 2024 23:47:40 +0200
From: Thomas Weißschuh <linux@...ssschuh.net>
To: Guo Ren <guoren@...nel.org>, Willy Tarreau <w@....eu>, 
 Shuah Khan <shuah@...nel.org>
Cc: linux-kernel@...r.kernel.org, linux-csky@...r.kernel.org, 
 linux-kselftest@...r.kernel.org, 
 Thomas Weißschuh <linux@...ssschuh.net>
Subject: [PATCH 5/5] selftests/nolibc: skip test for getppid() on csky

Old non-mainline Linux and current non-mainline qemu-user use different
syscall numbers than mainline Linux.
__NR_getppid and __NR_rt_sigreturn are swapped.
As the runtime environment can't be determined during compilation,
sidestep the whole issue by skipping the test.

Link: https://lore.kernel.org/linux-csky/2fa3151f-5aab-406c-95d9-add398ae58b3@t-8ch.de/
Signed-off-by: Thomas Weißschuh <linux@...ssschuh.net>
---
 tools/testing/selftests/nolibc/nolibc-test.c | 9 +++++++--
 1 file changed, 7 insertions(+), 2 deletions(-)

diff --git a/tools/testing/selftests/nolibc/nolibc-test.c b/tools/testing/selftests/nolibc/nolibc-test.c
index 6fba7025c5e3c002085862fdf6fa950da6000d6c..daf6a9b84a3051413cbb1d01918f745c3b83426c 100644
--- a/tools/testing/selftests/nolibc/nolibc-test.c
+++ b/tools/testing/selftests/nolibc/nolibc-test.c
@@ -995,7 +995,7 @@ int run_syscall(int min, int max)
 	int tmp;
 	int ret = 0;
 	void *p1, *p2;
-	int has_gettid = 1;
+	int has_gettid = 1, has_getppid = 1;
 	int has_brk;
 
 	/* <proc> indicates whether or not /proc is mounted */
@@ -1009,6 +1009,11 @@ int run_syscall(int min, int max)
 	has_gettid = __GLIBC__ > 2 || (__GLIBC__ == 2 && __GLIBC_MINOR__ >= 30);
 #endif
 
+	/* qemu-user and non-mainline Linux use different syscall number */
+#if defined(__csky__)
+	has_getppid = 0;
+#endif
+
 	/* on musl setting brk()/sbrk() always fails */
 	has_brk = brk(0) == 0;
 
@@ -1020,7 +1025,7 @@ int run_syscall(int min, int max)
 		 */
 		switch (test + __LINE__ + 1) {
 		CASE_TEST(getpid);            EXPECT_SYSNE(1, getpid(), -1); break;
-		CASE_TEST(getppid);           EXPECT_SYSNE(1, getppid(), -1); break;
+		CASE_TEST(getppid);           EXPECT_SYSNE(has_getppid, getppid(), -1); break;
 		CASE_TEST(gettid);            EXPECT_SYSNE(has_gettid, gettid(), -1); break;
 		CASE_TEST(getpgid_self);      EXPECT_SYSNE(1, getpgid(0), -1); break;
 		CASE_TEST(getpgid_bad);       EXPECT_SYSER(1, getpgid(-1), -1, ESRCH); break;

-- 
2.46.2


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ