On 5/28/21 7:20 PM, Vitaly Chikunov wrote:
Hi,
Possible ptrace related bug in tools/testing/selftests/ptrace/vmaccess.c - it timeout every time I run it on any kernel I try, in vm or bare metal.
Does it run correctly for anybody?
No, that is an open issue, I wrote the test case in anticipation that all of my patch series got accepted, but the last patch was not picked up for inclusion in the linux kernel.
Well, actually I still have the patch, see attached patch file. This makes the test case pass.
The idea is that PTRACE_ATTACH returns EAGAIN in this case, and the tracer calls waitpid if that return value is received, which makes the zombie process die, and then PTRACE_ATTACH will succeed.
Eric wanted to propose a different solution though. Eric, have you meanwhile been able to come up with a better solution?
Thanks, Bernd.
Example vmaccess from v5.12 source tree run on 5.13.0+rc2 on bare metal Supermicro server (AMD EPYC):
5.10.35-rt-alt1.rt39:~# /usr/lib/kselftests/ptrace/vmaccess TAP version 13 1..2 # Starting 2 tests from 1 test cases. # RUN global.vmaccess ... # OK global.vmaccess ok 1 global.vmaccess # RUN global.attach ... # attach: Test terminated by timeout # FAIL global.attach not ok 2 global.attach # FAILED: 1 / 2 tests passed. # Totals: pass:1 fail:1 xfail:0 xpass:0 skip:0 error:0
Just to confirm for the latest kernel, it behaves the same [for drm-tip based] on 5.13rc2. Also, just tested on 5.11.21 with the same failure.
Other ptrace tests pass.
Thanks,