Added:
ptrace(2): Add new si_code value of SIGTRAP: TRAP_EXEC [kamil 20170107]
ptrace(2): Add signal information accessors API:
PT_GET_SIGINFO and PT_SET_SIGINFO [kamil 20170107]
Sponsored by <The NetBSD Foundation>
Explain:
- execve(2) handling and behavior, SIGTRAP & TRAP_EXEC
- reference PaX MPROTECT restrictions for debuggers
- software breakpoints handling and behavior, SIGTRAP & TRAP_BKPT
- single step behavior, SIGTRAP & TRAP_TRACE
- list predefined MI symbols for help debuggers in port specific headers
- explain that PT_TRACE_ME does not send a SIGSTOP signal
Sponsored by <The NetBSD Foundation>
PT_SET_SIGINFO - fake signal information emitted to tracee
PT_GET_SIGINFO - read signal information routed to tracee
Sponsored by <The NetBSD Foundation>
The PT_GET_PROCESS_STATE call in ptrace(2) has the following usage of addr
and data:
A pointer to this structure is passed in addr. The data
argument should be set to sizeof(struct ptrace_event).
Sponsored by <The NetBSD Foundation>
Kernel bump for PT_GET_SIGINFO and PT_SET_SIGINFO in ptrace(2) and new
si_code value TRAP_EXEC in <sys/siginfo.h> for the SIGTRAP signal.
Sponsored by <The NetBSD Foundation>
This interface is designed to read signal information emited to tracee and
fake this signal with new value.
This functionality is required to distinguish types of events that occured
in the tracee and intercepted by a debugger.
These accessors introduce a new structure type ptrace_siginfo:
/*
* Signal Information structure
*/
typedef struct ptrace_siginfo {
siginfo_t psi_siginfo; /* signal information structure */
lwpid_t psi_lwpid; /* destination LWP of the signal
* value 0 means the whole process
* (route signal to all LWPs) */
} ptrace_siginfo_t;
Include <sys/siginfo.h> in <sys/ptrace.h> in order to not break existing
software due to unknown symbol siginfo_t.
This interface has been proposed to the tech-kern@ mailing list.
Sponsored by <The NetBSD Foundation>
On exec() events under a debugger generate the SIGTRAP signal with
TRAP_EXEC property. This allows tracer to distinguish exec() events easily.
Sponsored by <The NetBSD Foundation>
siginfo4:
Detect SIGTRAP TRAP_EXEC from tracee
This test is currently disabled and it will be enabled once
PT_[SG]ET_SIGINFO will land the sources.
Sponsored by <The NetBSD Foundation>
attachment-specific detach functions. Returns EBUSY if the
device instance is busy, based on whether or not a sc->sc_inbuf
is allocated. The buffer is malloc()d at spkropen time, and is
free()d in spkrclose().
Now we can actually implement the MODULE_CMD_FINI command and
unload the driver at will.
Addresses my PR kern/51785