From: Oleg Nesterov <oleg@redhat.com>
To: Andrew Morton <akpm@linux-foundation.org>
Cc: "Eric W. Biederman" <ebiederm@xmission.com>,
Christian Brauner <brauner@kernel.org>,
Wen Yang <wenyang.linux@foxmail.com>,
linux-kernel@vger.kernel.org
Subject: [PATCH] get_signal: simplify/cleanup the the usage of ksig->info
Date: Fri, 23 Feb 2024 11:50:25 +0100 [thread overview]
Message-ID: <20240223105025.GA4542@redhat.com> (raw)
get_signal() uses signr or ksig->info.si_signo in a chaotic way, this
looks confusing. Change it to always use signr.
This allows us to simplify the SIGNAL_GROUP_EXIT/group_exec_task branch,
it no longer needs to touch ksig at all.
Signed-off-by: Oleg Nesterov <oleg@redhat.com>
---
kernel/signal.c | 15 +++++++++------
1 file changed, 9 insertions(+), 6 deletions(-)
diff --git a/kernel/signal.c b/kernel/signal.c
index c9c57d053ce4..690982e6595e 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2727,12 +2727,15 @@ bool get_signal(struct ksignal *ksig)
/* Has this task already been marked for death? */
if ((signal->flags & SIGNAL_GROUP_EXIT) ||
signal->group_exec_task) {
- clear_siginfo(&ksig->info);
- ksig->info.si_signo = signr = SIGKILL;
+ signr = SIGKILL;
sigdelset(¤t->pending.signal, SIGKILL);
trace_signal_deliver(SIGKILL, SEND_SIG_NOINFO,
- &sighand->action[SIGKILL - 1]);
+ &sighand->action[SIGKILL - 1]);
recalc_sigpending();
+ /*
+ * implies do_group_exit(), no need to initialize
+ * ksig->info
+ */
goto fatal;
}
@@ -2842,7 +2845,7 @@ bool get_signal(struct ksignal *ksig)
spin_lock_irq(&sighand->siglock);
}
- if (likely(do_signal_stop(ksig->info.si_signo))) {
+ if (likely(do_signal_stop(signr))) {
/* It released the siglock. */
goto relock;
}
@@ -2866,7 +2869,7 @@ bool get_signal(struct ksignal *ksig)
if (sig_kernel_coredump(signr)) {
if (print_fatal_signals)
- print_fatal_signal(ksig->info.si_signo);
+ print_fatal_signal(signr);
proc_coredump_connector(current);
/*
* If it was able to dump core, this kills all
@@ -2890,7 +2893,7 @@ bool get_signal(struct ksignal *ksig)
/*
* Death signals, no core dump.
*/
- do_group_exit(ksig->info.si_signo);
+ do_group_exit(signr);
/* NOTREACHED */
}
spin_unlock_irq(&sighand->siglock);
--
2.25.1.362.g51ebf55
next reply other threads:[~2024-02-23 10:51 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-23 10:50 Oleg Nesterov [this message]
2024-02-23 13:41 ` [PATCH] get_signal: simplify/cleanup the the usage of ksig->info Wen Yang
2024-02-23 14:19 ` Oleg Nesterov
2024-02-23 14:31 ` Oleg Nesterov
2024-02-23 14:44 ` Oleg Nesterov
2024-02-26 9:52 ` Oleg Nesterov
2024-02-26 15:06 ` Wen Yang
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20240223105025.GA4542@redhat.com \
--to=oleg@redhat.com \
--cc=akpm@linux-foundation.org \
--cc=brauner@kernel.org \
--cc=ebiederm@xmission.com \
--cc=linux-kernel@vger.kernel.org \
--cc=wenyang.linux@foxmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.