ptrace: add ability to get/set signal-blocked mask (v2)
PATCH 1/1 ptrace: add ability to get/set signal-blocked mask (v2)
crtools uses a parasite code for dumping processes. The parasite code is injected into a process with help PTRACE_SEIZE.
Currently crtools blocks signals from a parasite code. If a process has pending signals, crtools wait while a process handles these signals.
This method is not suitable for stopped tasks. A stopped task can have a few pending signals, when we will try to execute a parasite code, we will need to drop SIGSTOP, but all other signals must remain pending, because a state of processes must not be changed during checkpointing.
This patch adds two ptrace commands to set/get signal-blocked mask.
I think gdb can use this commands too.
v2: Don't use __set_task_blocked with tsk != current. recalc_sigpending() is not called here, because it will be called after resume. retarget_shared_pending() are not called, because we suppose, that other threads are stopped too.
--- include/uapi/linux/ptrace.h | 3 +++ kernel/ptrace.c | 42 ++++++++++++++++++++++++++++++++++++++++++ 2 files changed, 45 insertions(+)
include/uapi/linux/ptrace.h +3 -0
@@ -61,6 +61,9 @@ struct ptrace_peeksiginfo_args {__s32 nr;/* how may siginfos to take */ }; +#define PTRACE_GETSIGMASK 0x420a +#define PTRACE_SETSIGMASK 0x420b +/* Read signals from a shared (process wide) queue */ #define PTRACE_PEEKSIGINFO_SHARED (1 << 0)
kernel/ptrace.c +42 -0
48 lines not on this page · raw message
Signature · 1 line
1.8.1.4