Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HANG assert failure causes hang in drcachesim #4376

Open
abhinav92003 opened this issue Jul 20, 2020 · 1 comment
Open

HANG assert failure causes hang in drcachesim #4376

abhinav92003 opened this issue Jul 20, 2020 · 1 comment

Comments

@abhinav92003
Copy link
Contributor

Describe the bug
While working on #4341 I noticed that failure of DR_ASSERT causes a hang in drcachesim, which then needs to be terminated manually.

To reproduce

  1. Patch the following diff. It causes the assert failure, which reveals the bug.
clients/drcachesim/tests/allasm_aarch64_prefetch.asm
@@ -163,6 +163,8 @@ _start:
         prfum    pstl3strm, [x1]
         prfum    pstl3strm, [x1]
 
+        prfum    28, [x1]
+
         // Exit.
         mov      w0, #1            // stdout
         adr      x1, helloworld

  1. On an AArch64 machine, run the following commands
cmake -DDEBUG=ON  -DBUILD_TESTS=ON <path-to-source>
make -j
./bin64/drrun -t drcachesim -- suite/tests/bin/allasm_aarch64_prefetch
  1. This will cause an assert failure at
    DR_ASSERT_MSG(false, "Unsupported AArch64 prefetch operation.");
ASSERT FAILURE: /home/abhinavas/dr/src/i4328-1/clients/drcachesim/tracer/instru.cpp:147: false (Unsupported AArch64 prefetch operation.)

But the process does not exit.

ps -x output:

abhinavas@tx1:~$ ps -x
  PID TTY      STAT   TIME COMMAND
...
50632 pts/4    R+     0:02 /home/abhinavas/dr/build/i4328-1/bin64/../clients/bin64/drcachesim -dr /home/abhinavas/dr/build/i4328-1/bin64/.. -dr_ops  -tracer /home/abhinavas/dr/build/i4328-1/bin64/../clients/lib64/debug/libdrmemtrace.so -tracer_alt /home/abhinavas/dr/build/i4328
50633 pts/4    Z+     0:00 [allasm_aarch64_] <defunct>
...

The test app (allasm_aarch64_prefetch) is shown as defunct and the drcachesim process is still running. Based on man:

Processes marked <defunct> are dead processes (so-called "zombies")
       that remain because their parent has not destroyed them properly.
  • What happens when you run without any client?
    No issues.
  • What happens when you run with debug build ("-debug" flag to drrun/drconfig/drinject)?
    Same issue with -dr_debug

Expected behavior
drcachesim and test app should exit properly after the assert failure

Versions

  • What version of DynamoRIO are you using?
    At commit cdc24cb

  • What operating system version are you running on?
    Debian GNU/Linux 9.5 (stretch) on AArch64

  • Is your application 32-bit or 64-bit?
    64-bit

Additional context
I found that after adding -dr_ops -unsafe_build_ldstex and setarch, the processes exit as expected.

./bin64/drrun -t drcachesim  -dr_ops -unsafe_build_ldstex --  setarch `uname -m` -R suite/tests/bin/allasm_aarch64_prefetch

I confirmed that both the additional options are required.

@derekbruening
Copy link
Contributor

Xref #4296. Normally this would be due to the pipe not being closed, which would be dependent on a clean exit, and unrelated to -unsafe_build_ldstex, which affects whether the app hangs during code cache execution.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants