tech-kern archive

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index][Old Index]

LWP resume and suspend ptrace(2) API



I'm proposing an API to restore the functionality to resume or suspend a
specified thread from execution.

This interface was implemented in the past in user-space inside
pthread(3) with the M:N thread model (with help from removed pthread_dbg).

http://netbsd.org/~kamil/patch-00028-pt_suspend-pt_resume.txt

This code is close to FreeBSD and shares the same request names
(PT_RESUME and PT_SUSPEND), however on NetBSD we pass the full pair of
tracee's pid_t and thread's lwpid_t. FreeBSD specifies just thread ID,
which is insufficient on NetBSD, as a single tracer can control multiple
tracees and face duplicated lwpid_t.

I've added an interface to detect if a specific LWP has been suspended
(or not) with extending the PT_LWPINFO interface with a new pl_event
value PL_EVENT_SUSPENDED (next to PL_EVENT_NONE and PL_EVENT_SIGNAL).

There is a new check preventing deadlocks and ptrace(2) can set with
this patch new errno EDEADLK. I haven't checked the existing code but it
appears that we can deadlock tracee with current PT_CONTINUE and friends.


Home | Main Index | Thread Index | Old Index