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)
Mon, Nov 11, 3:42 PM
Unknown Object (File)
Mon, Nov 11, 3:38 PM
Unknown Object (File)
Mon, Nov 11, 3:33 PM
Unknown Object (File)
Mon, Nov 11, 1:18 PM
Unknown Object (File)
Sat, Nov 2, 7:32 PM
Unknown Object (File)
Oct 11 2024, 9:06 AM
Unknown Object (File)
Oct 5 2024, 6:00 PM
Unknown Object (File)
Oct 3 2024, 1:02 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
rS FreeBSD src repository - subversion
Lint
Lint Passed
Unit
No Test Coverage
Build Status
Buildable 42439
Build 39327: arc lint + arc unit

Event Timeline

sys/kern/subr_syscall.c
273

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.

274

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.