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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <871q3cfl0b.fsf@jogness.linutronix.de>
Date: Mon, 29 Jul 2024 14:25:48 +0206
From: John Ogness <john.ogness@...utronix.de>
To: takakura@...inux.co.jp, pmladek@...e.com
Cc: rostedt@...dmis.org, senozhatsky@...omium.org,
 akpm@...ux-foundation.org, bhe@...hat.com, lukas@...ner.de,
 wangkefeng.wang@...wei.com, ubizjak@...il.com, feng.tang@...el.com,
 j.granados@...sung.com, stephen.s.brennan@...cle.com,
 linux-kernel@...r.kernel.org, nishimura@...inux.co.jp, taka@...inux.co.jp
Subject: Re: [PATCH] printk: CPU backtrace not printing on panic

Sorry, missed an important negation...

On 2024-07-29, John Ogness <john.ogness@...utronix.de> wrote:
> Hi Ryo,
>
> On 2024-07-29, takakura@...inux.co.jp wrote:
>> Or can we use cpu_sync for checking wheather non-panicked CPUs can
>> write to ringbuffer and let nbcon_atomic_flush_pending() do the
>> printing
>
> Yes, I like this. Let the non-panic CPUs write their messages, but keep
> the actual printing to the panic CPU.
>
> Right after the call to panic_other_cpus_shutdown() we plan [0] on
> calling printk_legacy_allow_panic_sync(), which will handle flushing the
> legacy consoles.
>
>> something like:
>>
>> ----- BEGIN -----
>> diff --git a/kernel/panic.c b/kernel/panic.c
>> index 7e207092576b..eed76e3e061b 100644
>> --- a/kernel/panic.c
>> +++ b/kernel/panic.c
>> @@ -252,8 +252,10 @@ void check_panic_on_warn(const char *origin)
>>   */
>>  static void panic_other_cpus_shutdown(bool crash_kexec)
>>  {
>> -	if (panic_print & PANIC_PRINT_ALL_CPU_BT)
>> +	if (panic_print & PANIC_PRINT_ALL_CPU_BT) {
>>  		trigger_all_cpu_backtrace();
>> +		nbcon_atomic_flush_pending();
>> +	}
>>
>> diff --git a/kernel/printk/printk.c b/kernel/printk/printk.c
>> index d0bff0b0abfd..b8132801ea07 100644
>> --- a/kernel/printk/printk.c
>> +++ b/kernel/printk/printk.c
>> @@ -2354,7 +2354,7 @@ asmlinkage int vprintk_emit(int facility, int level,
>>  	 * non-panic CPUs are generating any messages, they will be
>>  	 * silently dropped.
>>  	 */
>> -	if (other_cpu_in_panic())
>> +	if (other_cpu_in_panic() && !__printk_cpu_sync_owner())
>>  		return 0;
>>  
>>  	if (level == LOGLEVEL_SCHED) {
>> @@ -4511,6 +4511,11 @@ void __printk_cpu_sync_wait(void)
>>  }
>>  EXPORT_SYMBOL(__printk_cpu_sync_wait);
>>  
>> +bool __printk_cpu_sync_owner(void)
>> +{
>> +	return (atomic_read(&printk_cpu_sync_owner) == raw_smp_processor_id());
>> +}
>> +
>> ----- END -----
>
> Note that printing on the non-panic CPUs is guaranteed for nbcon

Note that _preventing_ printing on the non-panic CPUs...

> consoles because of the other_cpu_in_panic() in
> nbcon_context_try_acquire_direct() and for the legacy consoles because
> the cpu_sync holder must defer printing [1].
>
> I am curious what Petr has to say.
>
> John
>
> [0] https://lore.kernel.org/lkml/20240527063749.391035-26-john.ogness@linutronix.de
>
> [1] https://lore.kernel.org/lkml/87plrcqyii.fsf@jogness.linutronix.de

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ