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-prev] [day] [month] [year] [list]
Message-ID: <58e87116-a8af-4c8f-b5b4-3d0540cd3333@gmail.com>
Date: Fri, 29 Aug 2025 12:39:14 +0800
From: Jinchao Wang <wangjinchao600@...il.com>
To: Qianqiang Liu <qianqiang.liu@....com>
Cc: Andrew Morton <akpm@...ux-foundation.org>, Baoquan He <bhe@...hat.com>,
 Yury Norov <yury.norov@...il.com>, Simona Vetter <simona@...ll.ch>,
 Helge Deller <deller@....de>, Petr Mladek <pmladek@...e.com>,
 Steven Rostedt <rostedt@...dmis.org>, John Ogness
 <john.ogness@...utronix.de>, Sergey Senozhatsky <senozhatsky@...omium.org>,
 Vivek Goyal <vgoyal@...hat.com>, Dave Young <dyoung@...hat.com>,
 Kees Cook <kees@...nel.org>, Tony Luck <tony.luck@...el.com>,
 "Guilherme G. Piccoli" <gpiccoli@...lia.com>,
 Thomas Zimmermann <tzimmermann@...e.de>,
 Ville Syrjälä <ville.syrjala@...ux.intel.com>,
 Shixiong Ou <oushixiong@...inos.cn>, Zsolt Kajtar <soci@....rulez.org>,
 Ingo Molnar <mingo@...nel.org>, Nam Cao <namcao@...utronix.de>,
 Jonathan Cameron <Jonathan.Cameron@...wei.com>,
 Joel Fernandes <joelagnelf@...dia.com>,
 Joel Granados <joel.granados@...nel.org>, Jason Gunthorpe <jgg@...pe.ca>,
 Sohil Mehta <sohil.mehta@...el.com>, Feng Tang
 <feng.tang@...ux.alibaba.com>, Sravan Kumar Gundu
 <sravankumarlpu@...il.com>, Douglas Anderson <dianders@...omium.org>,
 Thomas Gleixner <tglx@...utronix.de>,
 Anna Schumaker <anna.schumaker@...cle.com>,
 "Darrick J. Wong" <djwong@...nel.org>,
 Max Kellermann <max.kellermann@...os.com>,
 Yunhui Cui <cuiyunhui@...edance.com>, Tejun Heo <tj@...nel.org>,
 Luo Gengkun <luogengkun@...weicloud.com>, Li Huafei <lihuafei1@...wei.com>,
 Thorsten Blum <thorsten.blum@...ux.dev>,
 Yicong Yang <yangyicong@...ilicon.com>, linux-fbdev@...r.kernel.org,
 dri-devel@...ts.freedesktop.org, kexec@...ts.infradead.org,
 linux-hardening@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 3/9] crash_core: use panic_try_start() in crash_kexec()

On 8/29/25 10:30, Qianqiang Liu wrote:
> On Mon, Aug 25, 2025 at 10:29:31AM +0800, Jinchao Wang wrote:
>> crash_kexec() had its own code to exclude parallel execution by setting
>> panic_cpu. This is already handled by panic_try_start(). Switch to
>> panic_try_start() to remove the duplication and keep the logic consistent.
>>
>> Signed-off-by: Jinchao Wang <wangjinchao600@...il.com>
>> ---
>>   kernel/crash_core.c | 15 +++------------
>>   1 file changed, 3 insertions(+), 12 deletions(-)
>>
>> diff --git a/kernel/crash_core.c b/kernel/crash_core.c
>> index a4ef79591eb2..bb38bbaf3a26 100644
>> --- a/kernel/crash_core.c
>> +++ b/kernel/crash_core.c
>> @@ -4,6 +4,7 @@
>>    * Copyright (C) 2002-2004 Eric Biederman  <ebiederm@...ssion.com>
>>    */
>>   
>> +#include "linux/panic.h"
> 
> Can you change this line of code to #include <linux/panic.h>?
Yes, I will.
Thanks for the feedback.>
>>   #define pr_fmt(fmt) KBUILD_MODNAME ": " fmt
>>   
>>   #include <linux/buildid.h>
>> @@ -143,17 +144,7 @@ STACK_FRAME_NON_STANDARD(__crash_kexec);
>>   
>>   __bpf_kfunc void crash_kexec(struct pt_regs *regs)
>>   {
>> -	int old_cpu, this_cpu;
>> -
>> -	/*
>> -	 * Only one CPU is allowed to execute the crash_kexec() code as with
>> -	 * panic().  Otherwise parallel calls of panic() and crash_kexec()
>> -	 * may stop each other.  To exclude them, we use panic_cpu here too.
>> -	 */
>> -	old_cpu = PANIC_CPU_INVALID;
>> -	this_cpu = raw_smp_processor_id();
>> -
>> -	if (atomic_try_cmpxchg(&panic_cpu, &old_cpu, this_cpu)) {
>> +	if (panic_try_start()) {
>>   		/* This is the 1st CPU which comes here, so go ahead. */
>>   		__crash_kexec(regs);
>>   
>> @@ -161,7 +152,7 @@ __bpf_kfunc void crash_kexec(struct pt_regs *regs)
>>   		 * Reset panic_cpu to allow another panic()/crash_kexec()
>>   		 * call.
>>   		 */
>> -		atomic_set(&panic_cpu, PANIC_CPU_INVALID);
>> +		panic_reset();
>>   	}
>>   }
>>   
>> -- 
>> 2.43.0
> 


-- 
Best regards,
Jinchao

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ