[NFC] Move setuid.c test into sanitizer_common

This commit is contained in:
Vitaly Buka 2021-11-08 18:23:42 -08:00
parent 937e40a8cf
commit 33af9a31c0
2 changed files with 7 additions and 4 deletions

View File

@ -1745,7 +1745,8 @@ void *internal_start_thread(void *(*func)(void *arg), void *arg) {
internal_sigfillset(&set);
#if SANITIZER_LINUX && !SANITIZER_ANDROID
// Glibc uses SIGSETXID signal during setuid call. If this signal is blocked
// on any thread, setuid call hangs (see test/tsan/setuid.c).
// on any thread, setuid call hangs.
// See test/sanitizer_common/TestCases/Linux/setuid.c.
internal_sigdelset(&set, 33);
#endif
internal_sigprocmask(SIG_SETMASK, &set, &old);

View File

@ -1,15 +1,17 @@
// RUN: %clang_tsan -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
// RUN: %clang -O1 %s -o %t && %run %t 2>&1 | FileCheck %s
//
// setuid(0) hangs on powerpc64 big endian. When this is fixed remove
// the unsupported flag.
// https://llvm.org/bugs/show_bug.cgi?id=25799
//
// UNSUPPORTED: powerpc64-unknown-linux-gnu
#include "test.h"
#include <pthread.h>
#include <stdio.h>
#include <sys/types.h>
#include <unistd.h>
// Setuid call used to hang because the background tsan thread did not handle
// Setuid call used to hang because the new thread did not handle
// SIGSETXID signal. Note that we don't care whether setuid call succeeds
// or not.