Linux PID attach feature causes application to segfault
Created by: natarajanragavendra
Describe the bug The PID attach feature on Linux causes an application segfault. However, the attach feature on the debug build of DynamoRio works correctly
To Reproduce Steps to reproduce the behavior:
- Pointer to a minimized application (ideally the source code for it and instructions on which toolchain it was built with)
int main()
{
int array [16384];
for (int j = 0; j < 16384; j++) {
for (int i = 0; i < 16384; i++) {
array [i] = i;
}
}
return 0;
}
-
Precise command line for running the application. ./a.out
-
Exact output or incorrect behavior.
$ ./a.out & /mnt/benchmarks/raga/dimprint/exports/bin64/drrun -attach $(pidof a.out) [1] 65099 [1]+ Segmentation fault (core dumped) ./a.out
Please also answer these questions:
- What happens when you run without any client? The application segfaults
- What happens when you run with debug build ("-debug" flag to drrun/drconfig/drinject)?
The application and PID attach work as expected
$ ./a.out & /mnt/benchmarks/raga/dimprint/exports/bin64/drrun -debug -attach $(pidof a.out) [1] 65106 <Starting application /mnt/benchmarks/raga/a.out (65106)> <Initial options = -no_dynamic_options -code_api -stack_size 56K -signal_stack_size 32K -max_elide_jmp 0 -max_elide_call 0 -no_inline_ignored_syscalls -native_exec_default_list '' -no_native_exec_managed_code -no_indcall2direct > <Stopping application /mnt/benchmarks/raga/a.out (65106)> [1]+ Done ./a.out
Expected behavior DynamoRio should attach to the specified PID
Screenshots or Pasted Text If applicable, add screenshots to help explain your problem. For text, please cut and paste the text here, delimited by lines consisting of three backtics to render it verbatim, like this:
``` paste output here ```
Versions
-
What version of DynamoRIO are you using? drrun version 8.0.18855 -- build 0
-
Does the latest build from https://github.com/DynamoRIO/dynamorio/releases solve the problem? No
-
What operating system version are you running on? ("Windows 10" is not sufficient: give the release number.)
$ cat /etc/os-release NAME="Ubuntu" VERSION="18.04.5 LTS (Bionic Beaver)" ID=ubuntu ID_LIKE=debian PRETTY_NAME="Ubuntu 18.04.5 LTS" VERSION_ID="18.04" HOME_URL="https://www.ubuntu.com/" SUPPORT_URL="https://help.ubuntu.com/" BUG_REPORT_URL="https://bugs.launchpad.net/ubuntu/" PRIVACY_POLICY_URL="https://www.ubuntu.com/legal/terms-and-policies/privacy-policy" VERSION_CODENAME=bionic UBUNTU_CODENAME=bionic
- Is your application 32-bit or 64-bit? 64-bit
$ file ./a.out ./a.out: ELF 64-bit LSB shared object, x86-64, version 1 (SYSV), dynamically linked, interpreter /lib64/ld-linux-x86-64.so.2, for GNU/Linux 3.2.0, BuildID[sha1]=3040b314526c220386b916098a9a46fbce7ebe23, not stripped
Additional context Add any other context about the problem here.