Assert failure when running in Docker: core/unix/rseq_linux.c:283 res == 0
Created by: Carrotman42
The assert happens on line 283 in rseq_is_registered_for_current_thread, where we get a return value from SYS_rseq that is not EINVAL, ENOSYS, or 0; the comment there suggests "the struct size or sthg changed!":
http://www.github.com/DynamoRIO/dynamorio/blob/d465def/core/unix/rseq_linux.c#L269-L289
I did this based on the cronbuild (on a system without a compiler) so I can't easily add debug logs, and I can't get gdb to work in a container correctly. Here are the reproducer steps while I have them handy:
Step 1: I created a new Virtual Machine in Google Compute Engine; the OS I used was COS (https://cloud.google.com/container-optimized-os/docs/, version R76-12239.60.0)
( I did this step in the web UI, so there's no command line reproducer unfortunately; I can get one for the gcloud CLI if requested.)
Step 2: SSH to VM; download and untar the DR distribution (running as root on the VM):
# mkdir /mnt/stateful_partition/dr
# cd /mnt/stateful_partition/dr
# wget https://github.com/DynamoRIO/dynamorio/releases/download/cronbuild-7.91.18151/DynamoRIO-x86_64-Linux-7.91.18151-0.tar.gz
# tar -xvzf DynamoRIO-x86_64-Linux-7.91.18151-0.tar.gz
# cat <<EOF >Dockerfile
FROM ubuntu:18.04
COPY DynamoRIO-x86_64-Linux-7.91.18151-0 .
EOF
Step 3: I created a new docker image based on this Dockerfile:
# docker build .
Step 4: Run ls
via drrun in debug mode without any clients:
# docker run ${IMAGE_HASH_FROM_LAST_STEP} ./bin64/drrun -debug -- ls
<Starting application /bin/ls (1)>
<Application /bin/ls (1). Internal Error: DynamoRIO debug check failure: /home/travis/build/DynamoRIO/dynamorio/core/unix/rseq_linux.c:283 res == 0
(Error occurred @0 frags)
version 7.91.18151, custom build
-no_dynamic_options -code_api -stack_size 56K -signal_stack_size 32K -max_elide_jmp 0 -max_elide_call 0 -early_inject -emulate_brk -no_inline_ignored_syscalls -native_exec_default_list '' -no_native_exec_managed_code -no_indcall2direct
0x00007ffd492a3880 0x00007f55173ad8a3
0x00007ffd492a3ad0 0x00007f55175cf1b3
0x00007ffd492a3b30 0x00007f55175ceca3
0x00007ffd492a3be0 0x00007f5517586730
0x00007ffd492a3bf0 0x00007f5517324105
0x00007ffd492a4420 0x00007f55175bd627
0x00007ffd492a54d0 0x00007f551756cd07>