Adds private loader redirection of open, close, read, and write to DR's syscall-wrapper versions (plus file descriptor isolation, for open and close). The libc write invokes pthread code for cancel features, and we are not able to create a private libpthread or isolate pthread resources (#956) which leads to poor interactions with application pthread uses and observed hangs.
Tested on the AArch64 Jenkins machine where these tests all hung every 5 to 10 runs in release build before and now they succeed 20,000 times in a row:
--------------------------------------------------
derek@dynamorio:~/dr/build_rel$ for i in sim.threads\$ sim.TLB-threads sim.coherence sim.threads-with; do echo $i; ctest --repeat-until-fail 20000 -R $i > RUN-$i 2>&1; done
sim.threads$
sim.TLB-threads
sim.coherence
sim.threads-with
derek@dynamorio:~/dr/build_rel$ grep -c Passed RUN-*
RUN-sim.coherence:20000
RUN-sim.threads$:20000
RUN-sim.threads-with:20000
RUN-sim.TLB-threads:20000
derek@dynamorio:~/dr/build_rel$ grep failed RUN-*
RUN-sim.coherence:100% tests passed, 0 tests failed out of 1
RUN-sim.threads$:100% tests passed, 0 tests failed out of 1
RUN-sim.threads-with:100% tests passed, 0 tests failed out of 1
RUN-sim.TLB-threads:100% tests passed, 0 tests failed out of 1
--------------------------------------------------
While at it, removes drcachesim.invariants which was tested as well and has no failures.
Issue: #4928 (closed), #4954 (closed), #2417, #956 Fixes #4928 (closed) Fixes #4954 (closed) Fixes #2892 (closed)