aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--include/trace/events/signal.h39
-rw-r--r--kernel/signal.c3
2 files changed, 42 insertions, 0 deletions
diff --git a/include/trace/events/signal.h b/include/trace/events/signal.h
index ef51756a801d..a6d71de0dc0d 100644
--- a/include/trace/events/signal.h
+++ b/include/trace/events/signal.h
@@ -60,6 +60,45 @@ TRACE_EVENT(signal_generate,
60 __entry->comm, __entry->pid) 60 __entry->comm, __entry->pid)
61); 61);
62 62
63/**
64 * signal_deliver - called when a signal is delivered
65 * @sig: signal number
66 * @info: pointer to struct siginfo
67 * @ka: pointer to struct k_sigaction
68 *
69 * A 'sig' signal is delivered to current process with 'info' siginfo,
70 * and it will be handled by 'ka'. ka->sa.sa_handler can be SIG_IGN or
71 * SIG_DFL.
72 * Note that some signals reported by signal_generate tracepoint can be
73 * lost, ignored or modified (by debugger) before hitting this tracepoint.
74 * This means, this can show which signals are actually delivered, but
75 * matching generated signals and delivered signals may not be correct.
76 */
77TRACE_EVENT(signal_deliver,
78
79 TP_PROTO(int sig, struct siginfo *info, struct k_sigaction *ka),
80
81 TP_ARGS(sig, info, ka),
82
83 TP_STRUCT__entry(
84 __field( int, sig )
85 __field( int, errno )
86 __field( int, code )
87 __field( unsigned long, sa_handler )
88 __field( unsigned long, sa_flags )
89 ),
90
91 TP_fast_assign(
92 __entry->sig = sig;
93 TP_STORE_SIGINFO(__entry, info);
94 __entry->sa_handler = (unsigned long)ka->sa.sa_handler;
95 __entry->sa_flags = ka->sa.sa_flags;
96 ),
97
98 TP_printk("sig=%d errno=%d code=%d sa_handler=%lx sa_flags=%lx",
99 __entry->sig, __entry->errno, __entry->code,
100 __entry->sa_handler, __entry->sa_flags)
101);
63#endif /* _TRACE_SIGNAL_H */ 102#endif /* _TRACE_SIGNAL_H */
64 103
65/* This part must be outside protection */ 104/* This part must be outside protection */
diff --git a/kernel/signal.c b/kernel/signal.c
index a1e0cc6b32c3..349d44937406 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -1840,6 +1840,9 @@ relock:
1840 ka = &sighand->action[signr-1]; 1840 ka = &sighand->action[signr-1];
1841 } 1841 }
1842 1842
1843 /* Trace actually delivered signals. */
1844 trace_signal_deliver(signr, info, ka);
1845
1843 if (ka->sa.sa_handler == SIG_IGN) /* Do nothing. */ 1846 if (ka->sa.sa_handler == SIG_IGN) /* Do nothing. */
1844 continue; 1847 continue;
1845 if (ka->sa.sa_handler != SIG_DFL) { 1848 if (ka->sa.sa_handler != SIG_DFL) {