diff mbox series

nptl: Fall back to setresuid32 in tst-setuid2

Message ID 87o74dfml8.fsf@oldenburg.str.redhat.com
State New
Headers show
Series nptl: Fall back to setresuid32 in tst-setuid2 | expand

Commit Message

Florian Weimer Sept. 24, 2024, 9:05 a.m. UTC
On sparcv9-linux-gnu, __NR_setresuid is not defined.  Use
__NR_setresuid32 instead.  (Presumably, setresuid was once
the 16-bit variant of the system call.)

---
 nptl/tst-setuid2.c | 5 +++++
 1 file changed, 5 insertions(+)


base-commit: 16a59571e4e9fd019d3fc23a2e7d73c1df8bb5cb

Comments

Andreas Schwab Sept. 24, 2024, 10:23 a.m. UTC | #1
On Sep 24 2024, Florian Weimer wrote:

> On sparcv9-linux-gnu, __NR_setresuid is not defined.  Use
> __NR_setresuid32 instead.  (Presumably, setresuid was once
> the 16-bit variant of the system call.)

__NR_setresuid32 should generally be preferred over __NR_setresuid.  If
both exist the latter is the obsolete 16-bit variant.
diff mbox series

Patch

diff --git a/nptl/tst-setuid2.c b/nptl/tst-setuid2.c
index 33d4e39fff..205f1459a3 100644
--- a/nptl/tst-setuid2.c
+++ b/nptl/tst-setuid2.c
@@ -76,7 +76,12 @@  run_on_thread (void (*func) (void))
 static void
 change_thread_ids (void)
 {
+#ifdef __NR_setresuid
   long ret = syscall (__NR_setresuid, 2001, 2002, 2003);
+#else
+  /* Needed on sparcv9, which does not have the setresuid system call.  */
+  long ret = syscall (__NR_setresuid32, 2001, 2002, 2003);
+#endif
   if (ret != 0)
     FAIL ("setresuid (2001, 2002, 2003): %ld", ret);
 }