Join GitHub today
GitHub is home to over 28 million developers working together to host and review code, manage projects, and build software together.
Sign upNew kernel API proposal (NetBSD) #207
Comments
ivmai
changed the title from
New kernel API proposal
to
New kernel API proposal (NetBSD)
Feb 19, 2018
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
This comment has been minimized.
Show comment
Hide comment
krytarowski
commented
Mar 6, 2018
|
Ping? I think I will add a ptrace wrapper for C and C++ programs. |
ivmai
added
the
feature-request
label
Mar 21, 2018
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
krytarowski commentedFeb 18, 2018
•
edited
Edited 2 times
-
krytarowski
edited Feb 19, 2018 (most recent)
-
krytarowski
edited Feb 19, 2018
I'm researching an addition of a new kernel API in NetBSD. My motivation is to support the
StopTheWorld() operation that is used in few types of G/C (including bdwgc) and in LLVM LSan.pinspect(2) - process self-introspectionOperations:
PI_ENABLE- stop the world -- suspend execution of all the (native) threads besides the calling one; the change of state of threads is invisible to the processes unless executed under a debugger (no signals sent, etc)PI_DISABLE- resume the worldPI_GETREGS- addr specifies destination buffer; data specifies (native) thread id; process must be stopped [or betterPI_GETCONTEXTto getucontext(2)]This interface resembles a little bit stripped down
ptrace(2) for self-debugging.Does this make sense? The current implementation of
StopTheWorld()in LSan for Linux is awful:vfork(2)/clone(2) +ptrace(2) + editing shared data.I would like to reuse the same interface for bdwgc as well. I expect that the kernel API will be immune to threading issues (as long as we have a correct kernel), independent from
pthread(3), invisible to the world (likeps(1),top(1)), not-conflicting with debuggers (ptrace(2)), simple to use.. and hopefully quick for multiple threads.I intend to craft something that will be maximally useful and if possible open for other use-cases (suggestions?) of process self-introspecting.
https://github.com/llvm-mirror/compiler-rt/blob/8d93d94612443a03d2e211d944e3097f66ba75d5/lib/sanitizer_common/sanitizer_stoptheworld_linux_libcdep.cc