signal: add print_fatal_signals_src_dst sysctl to switch dump fatal signals from sender side

the print_fatal_signals sysctl can only dump fatal signals from receiver's side,
cannot find who and why send these fatal signals, so add a new sysctl
print_fatal_signals_src_dst to switch dump fatal signals from sender side.

Signed-off-by: Xiaoming Gao <newtongao@tencent.com>
This commit is contained in:
Xiaoming Gao 2019-02-19 15:25:47 +08:00
parent 3dd54ca17c
commit 34bbe3bcb8
3 changed files with 19 additions and 0 deletions

View File

@ -10,6 +10,7 @@ struct task_struct;
/* for sysctl */
extern int print_fatal_signals;
extern int print_fatal_signals_src_dst;
static inline void copy_siginfo(struct siginfo *to, struct siginfo *from)
{

View File

@ -58,6 +58,7 @@
static struct kmem_cache *sigqueue_cachep;
int print_fatal_signals __read_mostly;
int print_fatal_signals_src_dst __read_mostly;
static void __user *sig_handler(struct task_struct *t, int sig)
{
@ -1041,6 +1042,16 @@ static int __send_signal(int sig, struct siginfo *info, struct task_struct *t,
int override_rlimit;
int ret = 0, result;
if (print_fatal_signals_src_dst && sig_kernel_coredump(sig)) {
printk(KERN_INFO "pid: %d, comm: %s try to send fatal sig: %d to pid: %d, comm: %s\n",
current->pid,
current->comm,
sig,
t->pid,
t->comm);
dump_stack();
}
assert_spin_locked(&t->sighand->siglock);
result = TRACE_SIGNAL_IGNORED;

View File

@ -344,6 +344,13 @@ static struct ctl_table kern_table[] = {
.proc_handler = proc_dointvec,
},
#endif
{
.procname = "print-fatal-signals-src-dst",
.data = &print_fatal_signals_src_dst,
.maxlen = sizeof(int),
.mode = 0644,
.proc_handler = proc_dointvec,
},
#ifdef CONFIG_SCHED_DEBUG
{
.procname = "sched_min_granularity_ns",