1
0
mirror of https://sourceware.org/git/glibc.git synced 2025-07-29 11:41:21 +03:00

Check for syscall error in the SETXID implementation in NPTL (bug 13347).

At this point, we can only abort the process because we have already
switched credentials on other threads.  Returning an error would still
leave the process in an inconsistent state.

The new xtest needs root privileges to run.
This commit is contained in:
Florian Weimer
2014-03-24 15:24:02 +01:00
parent c859b32e9d
commit 13f7fe35ae
4 changed files with 161 additions and 3 deletions

View File

@ -232,6 +232,7 @@ sighandler_setxid (int sig, siginfo_t *si, void *ctx)
/* Determine the process ID. It might be negative if the thread is
in the middle of a fork() call. */
pid_t pid = THREAD_GETMEM (THREAD_SELF, pid);
int result;
if (__glibc_unlikely (pid < 0))
pid = -pid;
@ -245,8 +246,12 @@ sighandler_setxid (int sig, siginfo_t *si, void *ctx)
return;
INTERNAL_SYSCALL_DECL (err);
INTERNAL_SYSCALL_NCS (__xidcmd->syscall_no, err, 3, __xidcmd->id[0],
__xidcmd->id[1], __xidcmd->id[2]);
result = INTERNAL_SYSCALL_NCS (__xidcmd->syscall_no, err, 3, __xidcmd->id[0],
__xidcmd->id[1], __xidcmd->id[2]);
if (__glibc_unlikely (INTERNAL_SYSCALL_ERROR_P (result, err)))
/* Safety check. This should never happen if the setxid system
calls are only ever called through their glibc wrappers. */
abort ();
/* Reset the SETXID flag. */
struct pthread *self = THREAD_SELF;