lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-ID: <tencent_195B55A5521705954D5EA4873327F8E53D0A@qq.com>
Date: Fri, 23 Feb 2024 00:04:57 +0800
From: wenyang.linux@...mail.com
To: Christian Brauner <brauner@...nel.org>,
	Andrew Morton <akpm@...ux-foundation.org>,
	Oleg Nesterov <oleg@...hat.com>
Cc: Wen Yang <wenyang.linux@...mail.com>,
	Thomas Gleixner <tglx@...utronix.de>,
	Sebastian Andrzej Siewior <bigeasy@...utronix.de>,
	Luis Chamberlain <mcgrof@...nel.org>,
	Mike Christie <michael.christie@...cle.com>,
	Dmitry Vyukov <dvyukov@...gle.com>,
	Vincent Whitchurch <vincent.whitchurch@...s.com>,
	Ard Biesheuvel <ardb@...nel.org>,
	linux-kernel@...r.kernel.org
Subject: [PATCH 2/2] kernel/signal.c: explicitly initialize si_code and use ksig->info uniformly

From: Wen Yang <wenyang.linux@...mail.com>

By explicitly initializing ksig->info.si_code and uniformly using ksig->info,
get_signal() function could be slightly optimized, as folowes:

	clear_siginfo(&ksig->info);
	ksig->info.si_signo = signr = SIGKILL;          --> missed si_code
	sigdelset(&current->pending.signal, SIGKILL);
	trace_signal_deliver(SIGKILL, SEND_SIG_NOINFO,  --> unnecessary SEND_SIG_NOINFO
 			&sighand->action[SIGKILL - 1]);
			recalc_sigpending();
	goto fatal;
..

        fatal:
..
                  if (sig_kernel_coredump(signr)) {
..
                          do_coredump(&ksig->info);    --> contains si_code
                }

No functional change intended.

Signed-off-by: Wen Yang <wenyang.linux@...mail.com>
Cc: Oleg Nesterov <oleg@...hat.com>
Cc: Andrew Morton <akpm@...ux-foundation.org>
Cc: Christian Brauner <brauner@...nel.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Cc: Luis Chamberlain <mcgrof@...nel.org>
Cc: Mike Christie <michael.christie@...cle.com>
Cc: Dmitry Vyukov <dvyukov@...gle.com>
Cc: Vincent Whitchurch <vincent.whitchurch@...s.com>
Cc: Ard Biesheuvel <ardb@...nel.org>
Cc: linux-kernel@...r.kernel.org
---
 kernel/signal.c | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/kernel/signal.c b/kernel/signal.c
index 9b40109f0c56..8cab55bbec2f 100644
--- a/kernel/signal.c
+++ b/kernel/signal.c
@@ -2732,8 +2732,9 @@ bool get_signal(struct ksignal *ksig)
 		     signal->group_exec_task) {
 			clear_siginfo(&ksig->info);
 			ksig->info.si_signo = signr = SIGKILL;
+			ksig->info.si_code = SI_USER;
 			sigdelset(&current->pending.signal, SIGKILL);
-			trace_signal_deliver(SIGKILL, SEND_SIG_NOINFO,
+			trace_signal_deliver(SIGKILL, &ksig->info,
 				&sighand->action[SIGKILL - 1]);
 			recalc_sigpending();
 			goto fatal;
-- 
2.25.1


Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ