-
Notifications
You must be signed in to change notification settings - Fork 11k
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
LLDB should skip disabling ASLR when permissions do not allow it to #61899
Comments
@llvm/issue-subscribers-lldb |
@am11 FYI: With
Still not friendly enough, IMO😕 |
Another report via the forums https://discourse.llvm.org/t/running-lldb-in-a-container/76801. |
@DavidSpickett I think the change of subject that you did yesterday seems incorrect, while the original subject was correct - ASLR is enabled by default by the OS, and when running in a debugger, the debugger wants to disable ASLR. But we should allow skipping the disabling. I.e. |
Reproduced this on the official Ubuntu docker image, just GDB's warning:
lldb:
Workaround is to opt out of disabling ALSR before running the program:
The way this works is we send a packet to set the option to disable ALSR:
The setting isn't applied until we launch.
That giant hex number is the error message This hack ignores the failure and allows you to debug, but it's a hack because there's no way to know from lldb that something failed:
I see some reports online that GDB in this scenario has trouble with breakpoints. Haven't tested that myself but it means we definitely need to warn users. The good news is that given we already send errors back to lldb, there is a stream we could write a warning too. Bad news is that stream is only used if the run fails. So I'll have to find some way to send that info back to lldb, perhaps we can already attach strings to "OK" responses, or there is an async messaging thing we can use. I looked at how gdb does it. The warning comes from gdbserver, or the "in process" version of gdbserver that runs inside gdb when you're running stuff locally. This means they aren't using any remote protocol packets to send that warning to gdb.
|
We could change that. If we figure out a way to check that disabling the ASLR will fail (worst case: fork a child and let it try disabling it?), we could return an error here. The client could print it, and resume launching. That said, I don't think having this warning is a prerequisite for making the aslr errors non-fatal. |
Running application under lldb in a docker container gives an unfriendly error:
Workaround is to manually enable ASLR by setting disable-aslr to false:
settings set target.disable-aslr false
gdb, on the other hand, makes its best effort by tolerating the case when disabling ASLR fails; with a warning:
Expected behavior
Warn but still continue with ASLR
Adapt to the environment constraints in a similar manner as gdb.
Issue a friendly error and stop
Alternatively, a better (searchable) error message would be appreciated:
The text was updated successfully, but these errors were encountered: