[llvm-bugs] [Bug 45380] New: Expression evaluation causes inferior crash on ARM32 remote target

via llvm-bugs llvm-bugs at lists.llvm.org
Tue Mar 31 20:29:26 PDT 2020


https://bugs.llvm.org/show_bug.cgi?id=45380

            Bug ID: 45380
           Summary: Expression evaluation causes inferior crash on ARM32
                    remote target
           Product: lldb
           Version: unspecified
          Hardware: PC
                OS: Windows NT
            Status: NEW
          Severity: enhancement
          Priority: P
         Component: All Bugs
          Assignee: lldb-dev at lists.llvm.org
          Reporter: emrekultursay at google.com
                CC: jdevlieghere at apple.com, llvm-bugs at lists.llvm.org

When debugging armeabi-v7a Android device, the call to process->CanJIT() at
UserExpression.cpp:190 eventually causes the inferior to crash:

    190:  if (process == nullptr || !process->CanJIT())
    191:    execution_policy = eExecutionPolicyNever;

AFAIU, LLDB tries to allocate memory on the inferior by calling mmap().
However, this mmap() execution triggers:

    Fatal signal 11 (SIGSEGV), code 2 (SEGV_ACCERR),
    fault addr 0xadc42fe6 in tid 25574
    (xample.app32bit), pid 25574 (xample.app32bit)

The 0xadc42fe6 address in this error message falls inside the `r--p` section of
the `app_process32` binary, and trying to execute (or write) to that location
would trigger such a crash. 



Repro Instructions:

1. Download Android Studio (3.5 through 4.1). (This is probably much easier
than manually setting up remote-android LLDB connections)
2. In Android Studio, create new project and select "Native C++ Activity" from
the wizard.
3. Set a breakpoint at native-lib.cpp:9
4. Modify app/build.gradle, and add the following:
       defaultConfig { ndk { abiFilters = ["armeabi-v7a"] } }
   so that you build 32-bit ARM only.
5. Hit Debug while targeting an ARM Android device (I tried only with 64-bit
devices).
6. When the breakpoint hits, open the LLDB console and type p hello to trigger
the crash.


How I debugged this issue so far:

// I'm on Windows 10 with Visual Studio
1. Build your own liblldb.dll with symbols
2. Put your DLL and symbols to $INSTALL\Android Studio 4.1 Canary
4\bin\lldb\bin while overwriting the existing liblldb.dll file there.
3. When the breakpoint hits, before you type (p hello) expression, attach to
the existing LLDBFrontend process (which had loaded liblldb.dll library).

-- 
You are receiving this mail because:
You are on the CC list for the bug.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.llvm.org/pipermail/llvm-bugs/attachments/20200401/69040872/attachment-0001.html>


More information about the llvm-bugs mailing list