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

nptl: Fix abort in case of set*id failure [BZ #17135]

If a call to the set*id functions fails in a multi-threaded program,
the abort introduced in commit 13f7fe35ae
was triggered.

We address by checking that all calls to set*id on all threads give
the same result, and only abort if we see success followed by failure
(or vice versa).
This commit is contained in:
Florian Weimer
2014-07-10 17:34:46 +02:00
parent bc1da1765e
commit 771eb1415f
8 changed files with 149 additions and 6 deletions

View File

@ -248,10 +248,10 @@ sighandler_setxid (int sig, siginfo_t *si, void *ctx)
INTERNAL_SYSCALL_DECL (err);
result = INTERNAL_SYSCALL_NCS (__xidcmd->syscall_no, err, 3, __xidcmd->id[0],
__xidcmd->id[1], __xidcmd->id[2]);
int error = 0;
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 ();
error = INTERNAL_SYSCALL_ERRNO (result, err);
__nptl_setxid_error (__xidcmd, error);
/* Reset the SETXID flag. */
struct pthread *self = THREAD_SELF;