Vitaly Buka | 33af9a3 | 2021-11-08 18:23:42 -0800 | [diff] [blame] | 1 | // RUN: %clang -O1 %s -o %t && %run %t 2>&1 | FileCheck %s |
Bill Seurer | 67a1830 | 2016-03-07 01:30:02 +0000 | [diff] [blame] | 2 | // |
| 3 | // setuid(0) hangs on powerpc64 big endian. When this is fixed remove |
| 4 | // the unsupported flag. |
| 5 | // https://llvm.org/bugs/show_bug.cgi?id=25799 |
| 6 | // |
| 7 | // UNSUPPORTED: powerpc64-unknown-linux-gnu |
Vitaly Buka | 33af9a3 | 2021-11-08 18:23:42 -0800 | [diff] [blame] | 8 | |
| 9 | #include <pthread.h> |
| 10 | #include <stdio.h> |
Dmitry Vyukov | 3658f6f | 2015-04-23 09:33:27 +0000 | [diff] [blame] | 11 | #include <sys/types.h> |
| 12 | #include <unistd.h> |
| 13 | |
Vitaly Buka | 33af9a3 | 2021-11-08 18:23:42 -0800 | [diff] [blame] | 14 | // Setuid call used to hang because the new thread did not handle |
Dmitry Vyukov | 3658f6f | 2015-04-23 09:33:27 +0000 | [diff] [blame] | 15 | // SIGSETXID signal. Note that we don't care whether setuid call succeeds |
| 16 | // or not. |
| 17 | |
| 18 | static void *thread(void *arg) { |
| 19 | (void)arg; |
| 20 | sleep(1); |
| 21 | return 0; |
| 22 | } |
| 23 | |
| 24 | int main() { |
| 25 | // Create another thread just for completeness of the picture. |
| 26 | pthread_t th; |
| 27 | pthread_create(&th, 0, thread, 0); |
| 28 | setuid(0); |
| 29 | pthread_join(th, 0); |
| 30 | fprintf(stderr, "DONE\n"); |
| 31 | return 0; |
| 32 | } |
| 33 | |
| 34 | // CHECK: DONE |