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: <84ldri7vv0.fsf@jogness.linutronix.de>
Date: Tue, 29 Apr 2025 18:59:07 +0206
From: John Ogness <john.ogness@...utronix.de>
To: carlos.bilbao@...nel.org, tglx@...utronix.de, seanjc@...gle.com,
 jan.glauber@...il.com
Cc: bilbao@...edu, pmladek@...e.com, akpm@...ux-foundation.org,
 jani.nikula@...el.com, linux-kernel@...r.kernel.org,
 gregkh@...uxfoundation.org, takakura@...inux.co.jp, Carlos Bilbao
 <carlos.bilbao@...nel.org>
Subject: Re: [PATCH v2 2/2] x86/panic: Add x86_panic_handler as default
 post-panic behavior

On 2025-04-28, carlos.bilbao@...nel.org wrote:
> From: Carlos Bilbao <carlos.bilbao@...nel.org>
>
> Add function x86_panic_handler() as the default behavior for x86 for
> post-panic stage via panic_set_handling(). Instead of busy-wait loop, it
> will halt if there's no console to save CPU cycles.
>
> Signed-off-by: Carlos Bilbao (DigitalOcean) <carlos.bilbao@...nel.org>
> ---
>  arch/x86/kernel/setup.c | 12 ++++++++++++
>  1 file changed, 12 insertions(+)
>
> diff --git a/arch/x86/kernel/setup.c b/arch/x86/kernel/setup.c
> index 9d2a13b37833..3bfef55e9adb 100644
> --- a/arch/x86/kernel/setup.c
> +++ b/arch/x86/kernel/setup.c
> @@ -16,6 +16,7 @@
>  #include <linux/initrd.h>
>  #include <linux/iscsi_ibft.h>
>  #include <linux/memblock.h>
> +#include <linux/panic.h>
>  #include <linux/panic_notifier.h>
>  #include <linux/pci.h>
>  #include <linux/root_dev.h>
> @@ -837,6 +838,15 @@ static void __init x86_report_nx(void)
>  	}
>  }
>  
> +
> +static void x86_panic_handler(void)
> +{
> +	if (console_trylock()) {
> +		console_unlock();
> +		safe_halt();
> +	}

I do not understand what you are trying to accomplish with the
console_trylock(). At this point in the panic, all the messages are
already output. The console lock is totally irrelevant.

Also, the console lock is only valid for legacy consoles.

I see no reason why you don't just use safe_halt() as your panic
handler.

John Ogness

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ