Repository navigation
Description
How to reproduce:
1. lldb /bin/ls
2. type "run"
Result:
1. LLDB reports error 8 [presumably ENOEXEC]
2. strace reports failed call to PTRACE_ME [possibly not relevant]
Log:
lldb /bin/ls
...
Current executable set to '/bin/ls' (x86_64).
(lldb) r
error: process launch failed: 'A' packet returned an error: 8
strace -f log:
[pid 4052] clone(strace: Process 4057 attached
child_stack=0, flags=CLONE_CHILD_CLEARTID|CLONE_CHILD_SETTID|SIGCHLD, chi
ld_tidptr=0x7f677a120a10) = 4057
[pid 4057] set_robust_list(0x7f677a120a20, 24) = 0
[pid 4052] wait4(4057, <unfinished ...>
[pid 4057] setsid() = 4057
[pid 4057] ioctl(6, TCGETS, {B38400 opost isig icanon echo ...}) = 0
[pid 4057] ioctl(6, TIOCGPTN, [5]) = 0
[pid 4057] stat("/dev/pts/5", {st_mode=S_IFCHR|0620, st_rdev=makedev(136
, 5), ...}) = 0
[pid 4057] open("/dev/pts/5", O_RDWR) = 7
[pid 4057] close(6) = 0
[pid 4057] dup2(7, 0) = 0
[pid 4057] dup2(7, 1) = 1
[pid 4057] dup2(7, 2) = 2
[pid 4057] ptrace(PTRACE_TRACEME, 0, NULL, NULL) = -1 EPERM (Operation n
ot permitted)
[pid 4057] write(1, "using the default platform: host"..., 80) = 80
[pid 4057] exit_group(1) = ?
[pid 4057] +++ exited with 1 +++
[pid 4052] <... wait4 resumed> [{WIFEXITED(s) && WEXITSTATUS(s) == 1}],
0, NULL) = 4057
[pid 4052] close(6) = 0
[pid 4052] rt_sigaction(SIGCHLD, {SIG_DFL, [CHLD], SA_RESTORER|SA_RESTAR
T, 0x7f6779341390}, NULL, 8) = 0
[pid 4052] rt_sigprocmask(SIG_BLOCK, [CHLD], NULL, 8) = 0
[pid 4052] write(2, "LaunchProcess: failed to launch "..., 50) = 50
[pid 4052] sendto(5, "$E08#ad", 7, 0, NULL, 0) = 7
[pid 4030] <... select resumed> ) = 1 (in [10], left {9, 980081})
[pid 4052] gettid( <unfinished ...>
[pid 4030] recvfrom(10, <unfinished ...>
[pid 4052] <... gettid resumed> ) = 4052
[pid 4030] <... recvfrom resumed> "$E08#ad", 8192, 0, NULL, NULL) = 7
[pid 4052] select(6, [3 5], NULL, NULL, {0, 0} <unfinished ...>
[pid 4030] gettid() = 4030
[pid 4052] <... select resumed> ) = 0 (Timeout)
[pid 4030] close(10 <unfinished ...>
[pid 4052] rt_sigprocmask(SIG_SETMASK, NULL, [HUP CHLD], 8) = 0
[pid 4030] <... close resumed> ) = 0
[pid 4052] pselect6(6, [5], NULL, NULL, NULL, {[CHLD], 8} <unfinished ..
.>
[pid 4030] close(6 <unfinished ...>
[pid 4052] <... pselect6 resumed> ) = 1 (in [5])
[pid 4030] <... close resumed> ) = 0
[pid 4052] select(6, [3 5], NULL, NULL, {0, 0} <unfinished ...>
[pid 4030] close(7 <unfinished ...>
[pid 4052] <... select resumed> ) = 1 (in [5], left {0, 0})
[pid 4030] <... close resumed> ) = 0
[pid 4052] recvfrom(5, <unfinished ...>
[pid 4030] kill(4052, SIGINT <unfinished ...>
[pid 4052] <... recvfrom resumed> "", 8192, 0, NULL, NULL) = 0
[pid 4030] <... kill resumed> ) = 0
[pid 4052] --- SIGINT {si_signo=SIGINT, si_code=SI_USER, si_pid=4030, si
_uid=1000} ---
[pid 4030] write(2, "error: process launch failed: 'A"..., 62error: proc
Windows build number: 10.0.15063
Activity
therealkenc commentedon Apr 28, 2017
Relevant. Critical, even. #555 #688 (message) #1692. This is what takes down Swift, because Apple is all about the
clangthese days.danmoseley commentedon Jan 21, 2018
Ben Hillis (@benhillis) is this something you're likely to fix? it breaks, in my case, debugging .NET Core on WSL - since it is not possible to debug C# using gdb as the SOS plugin is for lldb.
cc Mike McLaughlin (@mikem8361)
danmoseley commentedon Jan 21, 2018
This seems to prevent me even stopping at a breakpoint in gdb. This is on insider build 17074.
Am I missing something ? From looking at other issues, etc, it seems gdb should work.
therealkenc commentedon Jan 21, 2018
@danmosemsft - No that's new. Wish github had a sad emoji to go with the others. Wonder what changed. It's either a WSL regression, or a
gdbmodification. I am going to place my Internet nickle on the latter, given your very helpfulstrace grep(appreciated, we don't get that a lot around here). Or we are both missing something obvious.If anyone is out there on FCU 16299 and can give it a quick go it would be appreciated. Make sure you are running
gdb 7.11.1.[edit] That
PTRACE_TRACEME EPERMis "normal" in the scenario; same behaviour Real Linux. Nickle withdrawn. We'll have to see how this plays out.danmoseley commentedon Jan 21, 2018
therealkenc so you confirm you get the same result, you cannot debug hello world with gdb?
therealkenc commentedon Jan 21, 2018
That's correct. Unless we are both missing something obvious. Which is always a nonzero possibility. I hadn't actually run
gdbon WSL for a little while but it worked previously natch, or people's heads would explode. If there is something to this, the me2s will roll in. I don't have a FCU handy or I'd have something more concrete to offer. If it is a regression this is probably the wrong issue for that though.Brian-Perkins commentedon Jan 22, 2018
This may be related to the memory management issued mentioned here. You can confirm by retaining ASLR behavior (set disable-randomization off).
therealkenc commentedon Jan 22, 2018
Thanks; if I was more on the ball I would have connected that.
sudo sh -c "echo '0' >> /proc/sys/kernel/randomize_va_space"results in badness here on 17074. The tty seems live but shell commands don't execute. After closing thecmdwindow, attempting to startubuntu.exeagain just returns with no error. Best to sit tight for the fix probably.danmoseley commentedon Jan 22, 2018
I just tried 16299.192 and it works fine.
therealkenc I interpreted Brian Perkins (@Brian-Perkins) to mean just do
set disable-randomization offbeforerunin gdb, rather than globally. I'll try that when I get back to my 17074 box.danmoseley commentedon Jan 22, 2018
I've opened a new issue for this GDB issue since apparently it's different to the LLDB issue.
#2870
Brian-Perkins commentedon Jan 22, 2018
Apologies -- I did mean only for GDB, but randomize_va_space is not persisted so it should eventually recover (probably a background process keeping the WSL instance active). The GDB setting is to turn ASLR on -- it is just done in the easy to follow double negative form: disable* off
luser commentedon Mar 16, 2018
FYI I opened a new issue specifically for
PTRACE_SEIZE: #3031roozbehid commentedon May 15, 2018
I noticed the same issue with LLDB in docker which you can solve by adding "--privileged" to docker.
firewave commentedon Jul 10, 2018
Using lldb-6.0 I have a different behavior on Kali:
After that it appears to be stuck and is not doing anything (i.e. breakpoints are not hit). If I hit CTRL-C the process exits
When I start it in strace I sometimes get the same error as in the initial report
I checked the strace output and saw a few things but they all occurred before the process was even launched
Complete strace out:
strace.log
I am using 17134.137
mokonzi131 commentedon Jul 27, 2018
I'm having the exact same issue as Oliver Stöneberg (@firewave) on Ubuntu on Windows 17134
DnOberon commentedon Aug 7, 2018
Running into the same issues, specifically with the delve debugger for Go an issue which therealkenc referenced.
JCMais commentedon Apr 2, 2019
I'm having the same issue, has anyone found a workaround?
ikulagin commentedon May 27, 2019
Is there any news on this issue?
ikulagin commentedon Jun 14, 2019
In WSL2 this issue is fixed.
JCMais commentedon Jun 15, 2019
Ivan Kulagin (@ikulagin) is WSL2 already available? How were you able to test it? Insiders build?
devsnek commentedon Jun 15, 2019
build 18917 has wsl2. once you have it you can follow these instructions: https://docs.microsoft.com/en-gb/windows/wsl/wsl2-install
(i can also confirm that wsl2 fixes this issue, has been great)
Qix- commentedon Aug 6, 2020
Unless I'm mistaken and am not on WSL2, this still seems to be an issue for me on lldb even with WSL2.
However,
gdbworks as expected.therealkenc commentedon Aug 6, 2020
Thanks for the report, Josh Junon (@Qix-).
This does not.
PTRACE_TRACEMEis okay for sure. #3031PTRACE_SEIZEis okay these days too. But do feel encouraged to open a new issue under a different cover if you think there is some diverge. There might be; if so I'll take a close look. You can verify you're on WSL2 with cat/proc/version. It'll look something like mine (with kernel 4.19.x and lower-casemicrosoft) if you are.jdknox commentedon Sep 13, 2020
This doesn't seem fixed for me on WSL2. It can run in
gdbeven though it won't load debug symbols. But it gets a permission error onPTRACE_TRACEMEinlldb. Running withsudogives the same 'A' packet error.$ cat /proc/versionLinux version 4.19.104-microsoft-standard (oe-user@oe-host) (gcc version 8.2.0 (GCC)) #1 SMP Wed Feb 19 06:37:35 UTC 2020$ cmd.exe /c verMicrosoft Windows [Version 10.0.19041.508]--
$ lldb a.exestrace -flog:3347 ptrace(PTRACE_TRACEME) = -1 EPERM (Operation not permitted)
3347 lseek(6, 0, SEEK_CUR) = -1 ESPIPE (Illegal seek)
3347 fstat(6, {st_mode=S_IFIFO|0600, st_size=0, ...}) = 0
3347 write(6, "ptrace failed: Operation not per"..., 38) = 38
3342 <... read resumed>"ptrace failed: Operation not per"..., 1000) = 38
3347 exit_group(1 <unfinished ...>
3342 wait4(3347, <unfinished ...>
3347 <... exit_group resumed>) = ?
3347 +++ exited with 1 +++
3342 <... wait4 resumed>NULL, 0, NULL) = 3347
3342 --- SIGCHLD {si_signo=SIGCHLD, si_code=CLD_EXITED, si_pid=3347, si_uid=1000, si_status=1, si_utime=0, si_stime=5} ---
3342 close(5) = 0
3342 write(7, "$E08#ad", 7 <unfinished ...>
3337 <... select resumed>) = 1 (in [6], left {tv_sec=9, tv_usec=288501})
3342 <... write resumed>) = 7
3337 read(6, <unfinished ...>
3342 gettid( <unfinished ...>
3337 <... read resumed>"$E08#ad", 8192) = 7
3342 <... gettid resumed>) = 3342
3337 gettid( <unfinished ...>
3342 select(8, [3 7], NULL, NULL, {tv_sec=0, tv_usec=0} <unfinished ...>
3337 <... gettid resumed>) = 3337
3342 <... select resumed>) = 0 (Timeout)
3337 close(6 <unfinished ...>
3342 rt_sigprocmask(SIG_SETMASK, NULL, <unfinished ...>
3337 <... close resumed>) = 0
3342 <... rt_sigprocmask resumed>[HUP], 8) = 0
3337 close(8 <unfinished ...>
3342 ppoll([{fd=7, events=POLLIN}], 1, NULL, [], 8 <unfinished ...>
3337 <... close resumed>) = 0
3342 <... ppoll resumed>) = 1 ([{fd=7, revents=POLLIN|POLLHUP}])
3337 close(9 <unfinished ...>
3342 select(8, [3 7], NULL, NULL, {tv_sec=0, tv_usec=0} <unfinished ...>
3337 <... close resumed>) = 0
3342 <... select resumed>) = 1 (in [7], left {tv_sec=0, tv_usec=0})
3337 kill(3342, SIGINT <unfinished ...>
3342 read(7, <unfinished ...>
3337 <... kill resumed>) = 0
3342 <... read resumed>"", 8192) = 0
3337 write(2, "error: process launch failed: 'A"..., 62 <unfinished ...>
3342 --- SIGINT {si_signo=SIGINT, si_code=SI_USER, si_pid=3337, si_uid=1000} ---
zklim commentedon Sep 14, 2022
same problem here