$ docker run lldb
(lldb) target create "a.out"
Current executable set to '/tmp/a.out' (aarch64).
(lldb) run
error: Cannot launch '/tmp/a.out': personality set failed: Function not implemented
I can workaround it by running
$ docker run --security-opt seccomp=unconfined lldb
(lldb) target create "a.out"
Current executable set to '/tmp/a.out' (aarch64).
(lldb) run
Process 6 exited with status = 0 (0x00000000)
Process 6 launched: '/tmp/a.out' (aarch64)
But was wondering if there is another way, as in the CI environment I am not in control of the docker security policy.
If it is ASLR, settings set target.disable-aslr false should get you around it. Depending on your CI setup, one way to do it is to create a lldbinit file or if you have a test generator maybe itās a one line change there if youāre lucky.
If itās not ASLR then stracing lldb-server is one way to find out what itās asking for (though of course we should fix the error reporting eventually).
Iām trying to test the LLDB libc++ dataformatters in the libc++ precommit CI. This runs inside a Docker image here I run into the same personality set failed: Function not implemented issue.
When manually running LLDB either of these solutions solves the issue:
echo 'settings set target.disable-aslr false' >~/.lldbinit
Using lldb -O 'settings set target.disable-aslr false' a.out.
When I build the check-lldb-api-functionalities-data-formatter-data-formatter-stl-libcxx target it does not use the ~/.lldbinit.
Configuring CMake using -DLLDB_TEST_USER_ARGS="-O 'settings set target.disable-aslr false'" also does not solve the issue.
Any suggestions how to fix this when running the LLDB tests in a Docker image?
If you git grep where we do settings set target.inherit-tcc youāll find four places where we set this setting when running tests (altho Iām not sure why the one in test/API/types/AbstractBase.py isnāt inherited from the normal setup methods tbh).
Disabling ASLR is useful for a user who is debugging a binary repeatedly, to increase the chance that addresses may be the same across debug sessions. It is not adding anything when running the testsuite (beyond testing that binaries can be launched with ASLR disabled, obvi), my first impression is that we should probably disable this setting by default for the testsuite in those same setup files. @DavidSpickett what do you think?
Thanks a lot @jasonmolenda! Adding "settings set target.disable-aslr false", to lldb/packages/Python/lldbsuite/test/lldbtest.py fixes testing the libc++ data formatters.
Most tests should be fine with ALSR being on. If they were I think weād view that as something to fix as itās relying on the equivalent of C undefined behaviour.
Maybe there is a test that genuinely needs an exact layout but weād be better off marking those tests individually. In a few runs on AArch64 Linux I didnāt see any failures with ASLR on.
Let me see if my GDB colleagues have experience that contradicts this and if not, Iāll make a patch for the change.
@DavidSpickett maybe add a dotest command line option to turn disabling back on, just in case. I could see where this might cause issues on some RTOSes.
When we run the testsuite against an iOS/etc device, the ālaunch with ASLR disabledā flag to posix_spawn is ignored, weāve never seen a test failure that came down to that behavior.
I canāt think of any time logic that depended on the assumption that some library always loads at the same address run to run would be anything other than a bug. As Jason said, this is a convenience to our users that we canāt guarantee we can provide, so we shouldnāt rely on it.
I canāt think of an algorithm where itās likely we would do the right thing with ASLR off, but the wrong thing with it on, however. So itās probably not worth trying to test that modally.
My GDB colleague told me that their test suite is in theory agnostic to the setting apart from the test for the setting itself, and one specific test that must disable it. So pretty much what we also found.
Yeah Iām surprised that @mordante 's cmake change didnāt do the same thing so Iāll see what the canonical way to do this and at least get it documented.
We already have the ability to override settings, itās just poorly documented, who would have guessed
You can add --setting "target.disable-aslr=true" to a dotest command, or if you want to use LLDB_TEST_USER_ARGS you have to set it to --setting;target.disable-aslr=true. That ; is the magic separator that we donāt document.
Iāll improve the cmake docstrings and update the docs. Testing - š LLDB talks about it but Iām not sure the examples work anymore.
Well we changed the ASLR default for the entire lldb test suite (we now donāt disable it), I assumed that would carry over to libc++'s CI too. If not, yes please make the changes yourself, youāre the expert there.