Skip to content

Commit 3c52fed

Browse files
committed
Add warning if syscall patches exist already for a ptraced process
1 parent 62cb91e commit 3c52fed

File tree

1 file changed

+7
-3
lines changed

1 file changed

+7
-3
lines changed

pkg/sentry/platform/systrap/usertrap/usertrap_amd64.go

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -198,10 +198,14 @@ func (s *State) PatchSyscall(ctx context.Context, ac *arch.Context64, mm memoryM
198198
// the "syshandler" routine used to handle patched syscalls (see
199199
// syshandler_amd64.S). This incompatibility can result in inconsistent
200200
// process states and failures (e.g. SIGSEGV).
201-
// TODO: for a full fix we'd need to roll back existing patched
202-
// syscalls, in case the traced program was patched before being
203-
// traced (e.g. PTRACE_ATTACH on an already running process).
201+
// TODO(gvisor.dev/issue/11649): for a full fix we'd need to roll back
202+
// existing patched syscalls, in case the traced program was patched
203+
// before being traced (e.g. PTRACE_ATTACH on an already running
204+
// process).
204205
if task.Tracer() != nil {
206+
if s.nextTrap > 0 {
207+
ctx.Warningf("LIKELY ERROR: Attached tracer to process with patched syscalls (traps %d)! Systrap is not fully compatible with ptrace/debuggers, program may die unexpectedly soon!", s.nextTrap)
208+
}
205209
return nil
206210
}
207211

0 commit comments

Comments
 (0)