[compiler-rt] r340764 - [sanitizer][fuzzer] Transition back to ZX_TIME_INFINITE

Petr Hosek via llvm-commits llvm-commits at lists.llvm.org
Mon Aug 27 10:51:52 PDT 2018


Author: phosek
Date: Mon Aug 27 10:51:52 2018
New Revision: 340764

URL: http://llvm.org/viewvc/llvm-project?rev=340764&view=rev
Log:
[sanitizer][fuzzer] Transition back to ZX_TIME_INFINITE

Now that all Zircon calls have been transitioned to take time as signed
value, we can transition back to ZX_TIME_INFINITE, undoing the change
made in r337802.

Differential Revision: https://reviews.llvm.org/D51266

Modified:
    compiler-rt/trunk/lib/fuzzer/FuzzerUtilFuchsia.cpp
    compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc

Modified: compiler-rt/trunk/lib/fuzzer/FuzzerUtilFuchsia.cpp
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/fuzzer/FuzzerUtilFuchsia.cpp?rev=340764&r1=340763&r2=340764&view=diff
==============================================================================
--- compiler-rt/trunk/lib/fuzzer/FuzzerUtilFuchsia.cpp (original)
+++ compiler-rt/trunk/lib/fuzzer/FuzzerUtilFuchsia.cpp Mon Aug 27 10:51:52 2018
@@ -49,9 +49,6 @@ void CrashTrampolineAsm() __asm__("Crash
 
 namespace {
 
-// TODO(phosek): remove this and replace it with ZX_TIME_INFINITE
-#define ZX_TIME_INFINITE_OLD INT64_MAX
-
 // A magic value for the Zircon exception port, chosen to spell 'FUZZING'
 // when interpreted as a byte sequence on little-endian platforms.
 const uint64_t kFuzzingCrash = 0x474e495a5a5546;
@@ -237,7 +234,7 @@ void CrashHandler(zx_handle_t *Event) {
             "_zx_object_signal");
 
   zx_port_packet_t Packet;
-  ExitOnErr(_zx_port_wait(Port.Handle, ZX_TIME_INFINITE_OLD, &Packet),
+  ExitOnErr(_zx_port_wait(Port.Handle, ZX_TIME_INFINITE, &Packet),
             "_zx_port_wait");
 
   // At this point, we want to get the state of the crashing thread, but
@@ -315,8 +312,8 @@ void SetSignalHandler(const FuzzingOptio
   ExitOnErr(_zx_event_create(0, &Event), "_zx_event_create");
 
   std::thread T(CrashHandler, &Event);
-  zx_status_t Status = _zx_object_wait_one(Event, ZX_USER_SIGNAL_0,
-                                           ZX_TIME_INFINITE_OLD, nullptr);
+  zx_status_t Status =
+      _zx_object_wait_one(Event, ZX_USER_SIGNAL_0, ZX_TIME_INFINITE, nullptr);
   _zx_handle_close(Event);
   ExitOnErr(Status, "_zx_object_wait_one");
 
@@ -440,7 +437,7 @@ int ExecuteCommand(const Command &Cmd) {
 
   // Now join the process and return the exit status.
   if ((rc = _zx_object_wait_one(ProcessHandle, ZX_PROCESS_TERMINATED,
-                                ZX_TIME_INFINITE_OLD, nullptr)) != ZX_OK) {
+                                ZX_TIME_INFINITE, nullptr)) != ZX_OK) {
     Printf("libFuzzer: failed to join '%s': %s\n", Argv[0],
            _zx_status_get_string(rc));
     return rc;

Modified: compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc
URL: http://llvm.org/viewvc/llvm-project/compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc?rev=340764&r1=340763&r2=340764&view=diff
==============================================================================
--- compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc (original)
+++ compiler-rt/trunk/lib/sanitizer_common/sanitizer_fuchsia.cc Mon Aug 27 10:51:52 2018
@@ -29,9 +29,6 @@
 
 namespace __sanitizer {
 
-// TODO(phosek): remove this and replace it with ZX_TIME_INFINITE
-#define ZX_TIME_INFINITE_OLD INT64_MAX
-
 void NORETURN internal__exit(int exitcode) { _zx_process_exit(exitcode); }
 
 uptr internal_sched_yield() {
@@ -123,7 +120,7 @@ void BlockingMutex::Lock() {
     return;
   while (atomic_exchange(m, MtxSleeping, memory_order_acquire) != MtxUnlocked) {
     zx_status_t status = _zx_futex_wait(reinterpret_cast<zx_futex_t *>(m),
-                                        MtxSleeping, ZX_TIME_INFINITE_OLD);
+                                        MtxSleeping, ZX_TIME_INFINITE);
     if (status != ZX_ERR_BAD_STATE)  // Normal race.
       CHECK_EQ(status, ZX_OK);
   }




More information about the llvm-commits mailing list