1*7c3d14c8STreehugger Robot // RUN: %clang_tsan -O1 %s -o %t && %env_tsan_opts=flush_memory_ms=1:memory_limit_mb=1 %run %t 2>&1 | FileCheck %s 2*7c3d14c8STreehugger Robot // 3*7c3d14c8STreehugger Robot // setuid(0) hangs on powerpc64 big endian. When this is fixed remove 4*7c3d14c8STreehugger Robot // the unsupported flag. 5*7c3d14c8STreehugger Robot // https://llvm.org/bugs/show_bug.cgi?id=25799 6*7c3d14c8STreehugger Robot // 7*7c3d14c8STreehugger Robot // UNSUPPORTED: powerpc64-unknown-linux-gnu 8*7c3d14c8STreehugger Robot #include "test.h" 9*7c3d14c8STreehugger Robot #include <sys/types.h> 10*7c3d14c8STreehugger Robot #include <unistd.h> 11*7c3d14c8STreehugger Robot #include <time.h> 12*7c3d14c8STreehugger Robot 13*7c3d14c8STreehugger Robot // Test that setuid call works in presence of stoptheworld. 14*7c3d14c8STreehugger Robot main()15*7c3d14c8STreehugger Robotint main() { 16*7c3d14c8STreehugger Robot unsigned long long tp0, tp1; 17*7c3d14c8STreehugger Robot tp0 = monotonic_clock_ns(); 18*7c3d14c8STreehugger Robot tp1 = monotonic_clock_ns(); 19*7c3d14c8STreehugger Robot while (tp1 - tp0 < 3 * 1000000000ull) { 20*7c3d14c8STreehugger Robot tp1 = monotonic_clock_ns(); 21*7c3d14c8STreehugger Robot setuid(0); 22*7c3d14c8STreehugger Robot } 23*7c3d14c8STreehugger Robot fprintf(stderr, "DONE\n"); 24*7c3d14c8STreehugger Robot return 0; 25*7c3d14c8STreehugger Robot } 26*7c3d14c8STreehugger Robot 27*7c3d14c8STreehugger Robot // CHECK: DONE 28