Skip to content

[lldb-dap][test] Set disableASLR to False for tests #113593

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

Merged
merged 2 commits into from
Oct 25, 2024

Conversation

Michael137
Copy link
Member

@Michael137 Michael137 commented Oct 24, 2024

When running in constrained environments like docker, disabling ASLR might fail with errors like:

AssertionError: False is not true : launch failed (Cannot launch
'/__w/.../lldb-dap/stackTrace/subtleFrames/TestDAP_subtleFrames.test_subtleFrames/a.out':
personality set failed: Operation not permitted)

E.g., #110303

Hence we already run settings set target.disable-aslr false as part of the init-commands for the non-DAP tests (see #88312 and https://discourse.llvm.org/t/running-lldb-in-a-container/76801).

But we never adjusted it for the DAP tests. As a result we get conflicting test logs like:

 {
    "arguments": {
      "commandEscapePrefix": null,
      "disableASLR": true,
     ....
      "initCommands": [
        ...
        "settings set target.disable-aslr false",

Disabling ASLR by default in tests isn't useulf (it's only really a debugging aid for users). So this patch sets disableASLR=False by default.

When running in constrained environments like docker,
disable ASLR might fail with errors like:
```
AssertionError: False is not true : launch failed (Cannot launch
'/__w/.../lldb-dap/stackTrace/subtleFrames/TestDAP_subtleFrames.test_subtleFrames/a.out':
personality set failed: Operation not permitted)
```
E.g., llvm#110303

Hence we already run `settings set target.disable-aslr false`
as part of the init-commands for the non-DAP tests (see
llvm#88312 and
https://discourse.llvm.org/t/running-lldb-in-a-container/76801).

But we never adjusted it for the DAP tests. Hence we get conflicting
test houtput like:
```
 {
    "arguments": {
      "commandEscapePrefix": null,
      "disableASLR": true,
     ....
      "initCommands": [
        ...
        "settings set target.disable-aslr false",
```

Disabling ASLR by default in tests isn't useulf (it's only really
a debugging aid for users). So this patch sets `disableASLR=False`
by default.
@llvmbot
Copy link
Member

llvmbot commented Oct 24, 2024

@llvm/pr-subscribers-lldb

Author: Michael Buch (Michael137)

Changes

When running in constrained environments like docker, disable ASLR might fail with errors like:

AssertionError: False is not true : launch failed (Cannot launch
'/__w/.../lldb-dap/stackTrace/subtleFrames/TestDAP_subtleFrames.test_subtleFrames/a.out':
personality set failed: Operation not permitted)

E.g., #110303

Hence we already run settings set target.disable-aslr false as part of the init-commands for the non-DAP tests (see #88312 and https://discourse.llvm.org/t/running-lldb-in-a-container/76801).

But we never adjusted it for the DAP tests. Hence we get conflicting test houtput like:

 {
    "arguments": {
      "commandEscapePrefix": null,
      "disableASLR": true,
     ....
      "initCommands": [
        ...
        "settings set target.disable-aslr false",

Disabling ASLR by default in tests isn't useulf (it's only really a debugging aid for users). So this patch sets disableASLR=False by default.


Full diff: https://github.com/llvm/llvm-project/pull/113593.diff

1 Files Affected:

  • (modified) lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py (+1-1)
diff --git a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
index 7e80912be44642..cf30aad6b7f35b 100644
--- a/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
+++ b/lldb/packages/Python/lldbsuite/test/tools/lldb-dap/lldbdap_testcase.py
@@ -367,7 +367,7 @@ def launch(
         cwd=None,
         env=None,
         stopOnEntry=False,
-        disableASLR=True,
+        disableASLR=False,
         disableSTDIO=False,
         shellExpandArguments=False,
         trace=False,

Copy link
Member

@ldionne ldionne left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for the prompt fix!

@Michael137 Michael137 merged commit 2d26ef0 into llvm:main Oct 25, 2024
7 checks passed
@Michael137 Michael137 deleted the lldb-dap-disable-aslr-tests branch October 25, 2024 11:07
Michael137 added a commit to Michael137/llvm-project that referenced this pull request Oct 28, 2024
More context can be found in
llvm#110303

For DAP tests running in constrained environments (e.g., Docker
containers), disabling ASLR isn't allowed. So we set `disableASLR=False`
(since llvm#113593).

However, the `dap_server.py` will currently only forward the value
of `disableASLR` to the DAP executable if it's set to `True`. If the
DAP executable wasn't provided a `disableASLR` field it defaults to
`true` too
(https://github.com/llvm/llvm-project/blob/f14743794587db102c6d1b20f9c87a1ac20decfd/lldb/tools/lldb-dap/lldb-dap.cpp#L2103-L2104).

This means that passing `disableASLR=False` from the tests is currently
not possible.

This is also true for many of the other boolean arguments of
`request_launch`. But this patch only addresses `disableASLR` for now
since it's blocking a libc++ patch.
Michael137 added a commit to Michael137/llvm-project that referenced this pull request Oct 28, 2024
More context can be found in
llvm#110303

For DAP tests running in constrained environments (e.g., Docker
containers), disabling ASLR isn't allowed. So we set `disableASLR=False`
(since llvm#113593).

However, the `dap_server.py` will currently only forward the value
of `disableASLR` to the DAP executable if it's set to `True`. If the
DAP executable wasn't provided a `disableASLR` field it defaults to
`true` too
(https://github.com/llvm/llvm-project/blob/f14743794587db102c6d1b20f9c87a1ac20decfd/lldb/tools/lldb-dap/lldb-dap.cpp#L2103-L2104).

This means that passing `disableASLR=False` from the tests is currently
not possible.

This is also true for many of the other boolean arguments of
`request_launch`. But this patch only addresses `disableASLR` for now
since it's blocking a libc++ patch.
Michael137 added a commit that referenced this pull request Oct 29, 2024
More context can be found in
#110303

For DAP tests running in constrained environments (e.g., Docker
containers), disabling ASLR isn't allowed. So we set `disableASLR=False`
(since #113593).

However, the `dap_server.py` will currently only forward the value
of `disableASLR` to the DAP executable if it's set to `True`. If the
DAP executable wasn't provided a `disableASLR` field it defaults to
`true` too:
https://github.com/llvm/llvm-project/blob/f14743794587db102c6d1b20f9c87a1ac20decfd/lldb/tools/lldb-dap/lldb-dap.cpp#L2103-L2104

This means that passing `disableASLR=False` from the tests is currently
not possible.

This is also true for many of the other boolean arguments of
`request_launch`. But this patch only addresses `disableASLR` for now
since it's blocking a libc++ patch.
NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this pull request Nov 4, 2024
When running in constrained environments like docker, disabling ASLR
might fail with errors like:
```
AssertionError: False is not true : launch failed (Cannot launch
'/__w/.../lldb-dap/stackTrace/subtleFrames/TestDAP_subtleFrames.test_subtleFrames/a.out':
personality set failed: Operation not permitted)
```
E.g., llvm#110303

Hence we already run `settings set target.disable-aslr false` as part of
the init-commands for the non-DAP tests (see
llvm#88312 and
https://discourse.llvm.org/t/running-lldb-in-a-container/76801).

But we never adjusted it for the DAP tests. As a result we get
conflicting test logs like:
```
 {
    "arguments": {
      "commandEscapePrefix": null,
      "disableASLR": true,
     ....
      "initCommands": [
        ...
        "settings set target.disable-aslr false",
```

Disabling ASLR by default in tests isn't useulf (it's only really a
debugging aid for users). So this patch sets `disableASLR=False` by
default.
NoumanAmir657 pushed a commit to NoumanAmir657/llvm-project that referenced this pull request Nov 4, 2024
More context can be found in
llvm#110303

For DAP tests running in constrained environments (e.g., Docker
containers), disabling ASLR isn't allowed. So we set `disableASLR=False`
(since llvm#113593).

However, the `dap_server.py` will currently only forward the value
of `disableASLR` to the DAP executable if it's set to `True`. If the
DAP executable wasn't provided a `disableASLR` field it defaults to
`true` too:
https://github.com/llvm/llvm-project/blob/f14743794587db102c6d1b20f9c87a1ac20decfd/lldb/tools/lldb-dap/lldb-dap.cpp#L2103-L2104

This means that passing `disableASLR=False` from the tests is currently
not possible.

This is also true for many of the other boolean arguments of
`request_launch`. But this patch only addresses `disableASLR` for now
since it's blocking a libc++ patch.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

5 participants