Page MenuHomeFreeBSD

linux: Add additional ptracestop only if the debugger is Linux
ClosedPublic

Authored by trasz on Oct 29 2021, 10:33 AM.
Tags
None
Referenced Files
Unknown Object (File)
Tue, Apr 16, 7:10 AM
Unknown Object (File)
Tue, Apr 16, 7:10 AM
Unknown Object (File)
Feb 11 2024, 9:08 AM
Unknown Object (File)
Feb 11 2024, 9:08 AM
Unknown Object (File)
Feb 10 2024, 1:44 PM
Unknown Object (File)
Jan 4 2024, 9:11 PM
Unknown Object (File)
Dec 25 2023, 2:27 AM
Unknown Object (File)
Dec 20 2023, 6:01 AM
Subscribers

Details

Summary

In 6e66030c4c0, additional ptracestop was added in order
to implement PTRACE_EVENT_EXEC. Make it only apply to cases where the debugger is a Linux processes;
native FreeBSD debuggers can trace Linux processes too,
but they don't expect that additonal ptracestop.

Fixes: 6e66030c4c0
Reported By: kib
Sponsord By: EPSRC

Diff Detail

Repository
rG FreeBSD src repository
Lint
Lint Not Applicable
Unit
Tests Not Applicable

Event Timeline

sys/kern/subr_syscall.c
274

I am not sure of the check for ABI(p) is needed. Or rather, I think that it is not needed, and I do not see arguments that would support keeping this check.

275

Note that p->p_pptr cannot change while p is locked. ABI of p_pptr can, but I think it does not matter if we loose the race that way.

In other words, I think that locking debugger is not needed there (but a comment why we skip the locking is needed).

Fix issues pointed out by kib@.

kib added inline comments.
sys/kern/subr_syscall.c
267

I would formulate it differently. If debugger changes its ABI while we are returning from syscall, factually execs, then there is a race which is not handled anyway. We might win this race, or debugger might, outcome is not deterministic, and our choice to add pptr lock does not solve the race.

This revision is now accepted and ready to land.Oct 29 2021, 8:28 PM
This revision now requires review to proceed.Oct 30 2021, 8:53 AM
This revision was not accepted when it landed; it landed in state Needs Review.Oct 30 2021, 9:13 AM
This revision was automatically updated to reflect the committed changes.