This is an archive of the discontinued LLVM Phabricator instance.

Fedora Linux fails `Unwind/thread-step-out-ret-addr-check.test`
ClosedPublic

Authored by jankratochvil on Dec 20 2019, 1:25 PM.

Details

Summary

D71372 introduced: Unwind/thread-step-out-ret-addr-check.test failing on Fedora 30 Linux x86_64.

One problem is the underscored _nonstandard_stub in the .s file but not in the LLDB command:

(lldb) breakpoint set -n nonstandard_stub
Breakpoint 1: no locations (pending).
WARNING:  Unable to resolve breakpoint to any actual locations.
(lldb) process launch
Process 21919 exited with status = 0 (0x00000000)
Process 21919 launched: '/home/jkratoch/redhat/llvm-monorepo-clangassert/tools/lldb/test/Unwind/Output/thread-step-out-ret-addr-check.test.tmp' (x86_64)
(lldb) thread step-out
error: invalid thread
(lldb) _

Another problem is that Fedora Linux has executable stack by default and all programs indicate non-executable stack by PT_GNU_STACK, after fixing the underscore I was getting:

(lldb) thread step-out
Process 22294 exited with status = 0 (0x00000000)
(lldb) _

Is the .section harmless for non-Linux platforms or will it need some conditional compilation? (#ifdef is not available in .s file)

Diff Detail

Event Timeline

jankratochvil created this revision.Dec 20 2019, 1:25 PM

Thanks for looking into this @jankratochvil!

Another problem is that Fedora Linux has executable stack by default and all programs indicate non-executable stack by PT_GNU_STACK, after fixing the underscore I was getting:

(lldb) thread step-out
Process 22294 exited with status = 0 (0x00000000)
(lldb) _
Is the .section harmless for non-Linux platforms or will it need some conditional compilation? (#ifdef is not available in .s file)

Ok, I guess I was incorrectly assuming the stack should be non-executable by default on all platforms. In this case, let's rewrite the test to have a variable that is actually in the .data section (therefore guaranteed to be non-executable), and pass a pass a pointer to it to nonstandard_stub. The core requirement is that the pointer passed to nonstandard_stub must simply point to some kind of non-executable memory. I can do this.

lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s
13

Maybe we can just remove the underscore version, and simply use nonstandard_stub if it will work everywhere?

The Windows failure (https://reviews.llvm.org/D71372#1793371) seems like it may also be caused by the underscore symbol issue.

As I said on the other patch, this is probably a simpler approach (assuming we can't find a way to make the data section non-executable in a generic way). You'll need to add an #ifdef for the section directive though...

lldb/test/Shell/Unwind/Inputs/thread-step-out-ret-addr-check.s
13

Yes, I'm pretty sure that would work.

Addressed the review and D71789 and enabled it for Linux again.

labath accepted this revision.Dec 21 2019, 2:02 AM
This revision is now accepted and ready to land.Dec 21 2019, 2:02 AM

Thanks for the review but is it tested on Darwin? I do not have any.

I didn't check this patch exactly, but I tried something very similar investigating this patch yesterday, so I think this should be fine. You should be able to see any darwin failures here: http://lab.llvm.org:8080/green/view/LLDB/job/lldb-cmake/

This revision was automatically updated to reflect the committed changes.