public inbox for libc-alpha@sourceware.org
 help / color / mirror / Atom feed
* [PATCH] linux: Handle personality filtering for 32 bits
@ 2023-06-06 16:48 Adhemerval Zanella
  2023-08-02 16:31 ` Adhemerval Zanella Netto
  0 siblings, 1 reply; 2+ messages in thread
From: Adhemerval Zanella @ 2023-06-06 16:48 UTC (permalink / raw)
  To: libc-alpha

Since commit e0043e17dfc52fe170274, 32 bit personality wrapper does
not set errno because kernel default implementation always successfully
changes the personality if requested (although some arch-specific
implementations might return an error, like aarch64).

However if syscall is being filtered (by a seccomp filter for instance)
there is no way to distinguish a syscall error
(INTERNAL_SYSCALL_ERROR_P) from a possible kernel value.

So in this case just set the test as unsupported.
---
 sysdeps/unix/sysv/linux/tst-personality.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sysdeps/unix/sysv/linux/tst-personality.c b/sysdeps/unix/sysv/linux/tst-personality.c
index 5e59627826..79d9c607e1 100644
--- a/sysdeps/unix/sysv/linux/tst-personality.c
+++ b/sysdeps/unix/sysv/linux/tst-personality.c
@@ -34,10 +34,17 @@ do_test (void)
   if (r == -1)
     {
       /* The syscall argument might be filtered by kernel, so the
-        test can not check for the bug issue.  */
+        test can not check for the bug issue.  For 32 bit architectures
+        the syscall wrapper also never sets the errno (check commit
+        e0043e17dfc52fe170274 for a full explanation), so in this case
+        there is no way to detected if the syscall is filtered.  */
+#if __WORDSIZE == 32
+      FAIL_UNSUPPORTED ("personality syscall argument are filtered");
+#else
       if (errno == EPERM)
        FAIL_UNSUPPORTED ("personality syscall argument are filtered");
       FAIL_EXIT1 ("personality (%#x) failed: %m", test_persona);
+#endif
     }
 
   TEST_COMPARE (r, saved_persona);
-- 
2.34.1


^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2023-08-02 16:32 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-06-06 16:48 [PATCH] linux: Handle personality filtering for 32 bits Adhemerval Zanella
2023-08-02 16:31 ` Adhemerval Zanella Netto

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).