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] [thread-next>] [day] [month] [year] [list]
Message-ID: <87ecyixuna.ffs@tglx>
Date: Thu, 27 Mar 2025 18:15:05 +0100
From: Thomas Gleixner <tglx@...utronix.de>
To: Fernando Fernandez Mancera <ffmancera@...eup.net>, x86@...nel.org,
 linux-kernel@...r.kernel.org
Cc: dwmw@...zon.co.uk, mhkelley@...look.com, mingo@...nel.org, Fernando
 Fernandez Mancera <ffmancera@...eup.net>
Subject: Re: [PATCH v2] x86/i8253: fix possible deadlock when turning off
 the PIT

On Thu, Mar 27 2025 at 16:22, Fernando Fernandez Mancera wrote:
> As the PIT could be disabled during the init, it can possibly cause a
> deadlock. hpet_time_init()->pit_timer_init() is called without IRQ off.
> It assumes that clockevent_i8253_disable() is IRQ-safe, which it isn't.

It assumes nothing and all the missing interrupt disable is causing is a
lockdep false positive.

Lockdep complains correctly due to the observed contexts, but in reality
there is no possible deadlock at all. Definitely not the one your
subject line is claiming to be possible.

At the point where pit_timer_init() is invoked there is no other usage
of 8253_lock possible because the system is still in the very early boot
stage.

So disabling interrupt here just prevents lockdep triggering a false
positive and not more.

Please analyze problems properly instead of assuming that the lockdep
splat is the ultimate truth.

>  bool __init pit_timer_init(void)
>  {
> +	unsigned long flags;
> +
>  	if (!use_pit()) {
>  		/*
>  		 * Don't just ignore the PIT. Ensure it's stopped, because
>  		 * VMMs otherwise steal CPU time just to pointlessly waggle
>  		 * the (masked) IRQ.
>  		 */
> +		local_irq_save(flags);

Why save()? You just established that interrupts are enabled here, so
this really wants to be:

                scoped_guard(irq)()
	              	clockevent_i8253_disable();
  		return false;

Thanks,

        tglx

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ