| Summary: | PR_SET_PTRACER error with Ubuntu on WSL | ||
|---|---|---|---|
| Product: | [Developer tools] valgrind | Reporter: | Evan Hunter <evan> |
| Component: | general | Assignee: | Julian Seward <jseward> |
| Status: | RESOLVED WORKSFORME | ||
| Severity: | normal | CC: | leannap, mark, philippe.waroquiers, pjfloyd |
| Priority: | NOR | ||
| Version First Reported In: | unspecified | ||
| Target Milestone: | --- | ||
| Platform: | Microsoft Windows | ||
| OS: | Linux | ||
| Latest Commit: | Version Fixed/Implemented In: | ||
| Sentry Crash Report: | |||
| Attachments: | Possible fix by falling back to alternate PR_SET_PTRACER call | ||
|
Description
Evan Hunter
2020-04-02 22:50:42 UTC
Thanks for the proposed patch.
I do not remember the reason for the line
ret = VG_(prctl) (PR_SET_PTRACER, 1, 0, 0, 0);
prctl PR_SET_PTRACER documentation indicates that the second argument
is either PR_SET_PTRACER_ANY (to allow any process to ptrace the caller),
or a pid (to allow pid to ptrace the caller)
or 0 (to not allow anymore a process to ptrace the caller).
So, the reason of the call with the pid 1 is not clear (anymore to me.
I must have had a good reason at a time, but not commented :(.
That being said:
Does calling set_ptracer with value 1 effectively allow vgdb to
get a blocked valgrind process out of the syscall ?
In other words, before your patch:
valgrind sleep 100
in another window: vgdb help
and vgdb should block or give error msg or similar
(you might use vgdb -d -d -d -d help to get more info about what
is going on)
and after your patch, vgdb -d -d -d -d help should be able to wake up
valgrind and produce the help text.
Thanks for the pointers on testing it on vgdb. It looks like it still hangs vgdb :-( I too am not sure what the prctl(PR_SET_PTRACER, 1, 0, 0, 0) call is trying to achieve. It seems to succeed but still leaves vgdb blocked. (In reply to Evan Hunter from comment #2) > Thanks for the pointers on testing it on vgdb. > It looks like it still hangs vgdb :-( > I too am not sure what the prctl(PR_SET_PTRACER, 1, 0, 0, 0) call is trying > to achieve. It seems to succeed but still leaves vgdb blocked. Using the debug options -d -d -d of vgdb and -v -v -v -d -d -d of valgrind, it should be possible to have an idea about what does not work. *** Bug 443426 has been marked as a duplicate of this bug. *** I don't see any problem with WSL2 on Windows 11, openSUSE-Leap-15.6 (In reply to Paul Floyd from comment #5) > I don't see any problem with WSL2 on Windows 11, openSUSE-Leap-15.6 Given this was a WSL2 bug 5 years ago, but apparently fixed since, shall we close this bug? Agreed, let’s close this. |