public inbox for glibc-cvs@sourceware.org
help / color / mirror / Atom feed
* [glibc/azanella/syscall-refactor] Remove local-setxid.h
@ 2020-06-29 21:43 Adhemerval Zanella
0 siblings, 0 replies; only message in thread
From: Adhemerval Zanella @ 2020-06-29 21:43 UTC (permalink / raw)
To: glibc-cvs
https://sourceware.org/git/gitweb.cgi?p=glibc.git;h=128094469c8f4f96b094e1332bc740345a1379ba
commit 128094469c8f4f96b094e1332bc740345a1379ba
Author: Adhemerval Zanella <adhemerval.zanella@linaro.org>
Date: Mon May 25 13:49:29 2020 -0300
Remove local-setxid.h
Diff:
---
sysdeps/generic/local-setxid.h | 4 ----
sysdeps/posix/spawni.c | 5 ++---
sysdeps/unix/sysv/linux/local-setxid.h | 16 ----------------
sysdeps/unix/sysv/linux/spawni.c | 22 +++++++++++++++++++---
4 files changed, 21 insertions(+), 26 deletions(-)
diff --git a/sysdeps/generic/local-setxid.h b/sysdeps/generic/local-setxid.h
deleted file mode 100644
index b70d9ffb32..0000000000
--- a/sysdeps/generic/local-setxid.h
+++ /dev/null
@@ -1,4 +0,0 @@
-/* No special support. Fall back to the regular functions. */
-
-#define local_seteuid(id) seteuid (id)
-#define local_setegid(id) setegid (id)
diff --git a/sysdeps/posix/spawni.c b/sysdeps/posix/spawni.c
index 943a598771..2dcbc1bf24 100644
--- a/sysdeps/posix/spawni.c
+++ b/sysdeps/posix/spawni.c
@@ -26,7 +26,6 @@
#include <sys/param.h>
#include <sys/mman.h>
#include <not-cancel.h>
-#include <local-setxid.h>
#include <shlib-compat.h>
#include <nptl/pthreadP.h>
#include <dl-sysdep.h>
@@ -139,8 +138,8 @@ __spawni_child (void *arguments)
/* Set the effective user and group IDs. */
if ((attr->__flags & POSIX_SPAWN_RESETIDS) != 0
- && (local_seteuid (__getuid ()) != 0
- || local_setegid (__getgid ())) != 0)
+ && (__seteuid (__getuid ()) != 0
+ || __setegid (__getgid ())) != 0)
goto fail;
/* Execute the file actions. */
diff --git a/sysdeps/unix/sysv/linux/local-setxid.h b/sysdeps/unix/sysv/linux/local-setxid.h
deleted file mode 100644
index 97d787d942..0000000000
--- a/sysdeps/unix/sysv/linux/local-setxid.h
+++ /dev/null
@@ -1,16 +0,0 @@
-/* SETxID functions which only have to change the local thread and
- none of the possible other threads. */
-#include <sysdep.h>
-
-#ifdef __NR_setresuid32
-# define local_seteuid(id) INLINE_SYSCALL (setresuid32, 3, -1, id, -1)
-#else
-# define local_seteuid(id) INLINE_SYSCALL (setresuid, 3, -1, id, -1)
-#endif
-
-
-#ifdef __NR_setresgid32
-# define local_setegid(id) INLINE_SYSCALL (setresgid32, 3, -1, id, -1)
-#else
-# define local_setegid(id) INLINE_SYSCALL (setresgid, 3, -1, id, -1)
-#endif
diff --git a/sysdeps/unix/sysv/linux/spawni.c b/sysdeps/unix/sysv/linux/spawni.c
index f157bfffd2..aab777fb43 100644
--- a/sysdeps/unix/sysv/linux/spawni.c
+++ b/sysdeps/unix/sysv/linux/spawni.c
@@ -25,7 +25,6 @@
#include <sys/param.h>
#include <sys/mman.h>
#include <not-cancel.h>
-#include <local-setxid.h>
#include <shlib-compat.h>
#include <nptl/pthreadP.h>
#include <dl-sysdep.h>
@@ -74,6 +73,24 @@
# define STACK(__stack, __stack_size) (__stack + __stack_size)
#endif
+/* SETxID functions which only have to change the local thread and none of the
+ possible other threads. */
+static int local_seteuid (uid_t euid)
+{
+#ifndef __NR_setresuid32
+# define __NR_setresuid32 __NR_setresuid
+#endif
+ return INLINE_SYSCALL_CALL (setresuid32, -1, euid, -1);
+}
+
+static int local_setegid (uid_t egid)
+{
+#ifndef __NR_setresgid32
+# define __NR_setresgid32 __NR_setresgid
+#endif
+ return INLINE_SYSCALL_CALL (setresgid32, -1, egid, -1);
+}
+
struct posix_spawn_args
{
@@ -152,8 +169,7 @@ __spawni_child (void *arguments)
if (sa.sa_handler == SIG_IGN)
continue;
sa.sa_handler = SIG_DFL;
- }
- }
+ }}
else
continue;
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2020-06-29 21:43 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-06-29 21:43 [glibc/azanella/syscall-refactor] Remove local-setxid.h Adhemerval Zanella
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).