Bug 1431441 - Part 7 - Relax WebReplay fcntl rules to avoid sqlite crash r=froydnj
authorHaik Aftandilian <haftandilian@mozilla.com>
Thu, 18 Oct 2018 20:53:48 +0000
changeset 490780 178100c1204ca777a4d263f6d92dfca94333570a
parent 490779 c70d57adec824c605e77196e651191c784c84bc3
child 490781 2d0174d68cec998537cb529f688c96cfa729a892
push id247
push userfmarier@mozilla.com
push dateSat, 27 Oct 2018 01:06:44 +0000
reviewersfroydnj
bugs1431441
milestone64.0a1
Bug 1431441 - Part 7 - Relax WebReplay fcntl rules to avoid sqlite crash r=froydnj Patch provided by Brian Hackett <bhackett@mozilla.com>. Only allow a limited set of commands to be used when events are not passed through and we are recording/replaying the outputs. Depends on D8474 Differential Revision: https://phabricator.services.mozilla.com/D8475
toolkit/recordreplay/ProcessRedirectDarwin.cpp
--- a/toolkit/recordreplay/ProcessRedirectDarwin.cpp
+++ b/toolkit/recordreplay/ProcessRedirectDarwin.cpp
@@ -1015,17 +1015,24 @@ Preamble_getpid(CallArguments* aArgument
     return PreambleResult::Veto;
   }
   return PreambleResult::Redirect;
 }
 
 static PreambleResult
 Preamble_fcntl(CallArguments* aArguments)
 {
-  // Make sure fcntl is only used with a limited set of commands.
+  // We don't record any outputs for fcntl other than its return value, but
+  // some commands have an output parameter they write additional data to.
+  // Handle this by only allowing a limited set of commands to be used when
+  // events are not passed through and we are recording/replaying the outputs.
+  if (AreThreadEventsPassedThrough()) {
+    return PreambleResult::Redirect;
+  }
+
   auto& cmd = aArguments->Arg<1, size_t>();
   switch (cmd) {
   case F_GETFL:
   case F_SETFL:
   case F_GETFD:
   case F_SETFD:
   case F_NOCACHE:
   case F_SETLK: