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: <20250509132211.GA3618294@ax162>
Date: Fri, 9 May 2025 14:22:11 +0100
From: Nathan Chancellor <nathan@...nel.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: LKML <linux-kernel@...r.kernel.org>, Jiri Slaby <jirislaby@...nel.org>,
	Peter Zijlstra <peterz@...radead.org>
Subject: Re: [patch V2 26/45] genirq/chip: Rework irq_set_handler() variants

Hi Thomas,

On Tue, Apr 29, 2025 at 08:55:26AM +0200, Thomas Gleixner wrote:
> Use the new guards to get and lock the interrupt descriptor and tidy up the
> code.
> 
> Fixup the kernel doc comment while at it.
> 
> No functional change.
> 
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> 
> ---
>  kernel/irq/chip.c |   34 +++++++++++-----------------------
>  1 file changed, 11 insertions(+), 23 deletions(-)
> 
> --- a/kernel/irq/chip.c
> +++ b/kernel/irq/chip.c
> @@ -973,35 +973,23 @@ static void
>  	}
>  }
>  
> -void
> -__irq_set_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
> -		  const char *name)
> +void __irq_set_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
> +		       const char *name)
>  {
> -	unsigned long flags;
> -	struct irq_desc *desc = irq_get_desc_buslock(irq, &flags, 0);
> -
> -	if (!desc)
> -		return;
> -
> -	__irq_do_set_handler(desc, handle, is_chained, name);
> -	irq_put_desc_busunlock(desc, flags);
> +	scoped_irqdesc_get_and_lock(irq, 0)

I am investigating some cases where

  WARN(!irqs_disabled(), "Interrupts were enabled early\n");

in start_kernel() in init/main.c is triggered in certain builds with
clang after patch 23 of this series (very bizarre since the conversion
seems to be correct) and I happened to notice that this conversion seems
to be incorrect? Should this be scoped_irqdesc_get_and_buslock() like
below?

> +		__irq_do_set_handler(scoped_irqdesc, handle, is_chained, name);
>  }
>  EXPORT_SYMBOL_GPL(__irq_set_handler);
>  
> -void
> -irq_set_chained_handler_and_data(unsigned int irq, irq_flow_handler_t handle,
> -				 void *data)
> +void irq_set_chained_handler_and_data(unsigned int irq, irq_flow_handler_t handle,
> +				      void *data)
>  {
> -	unsigned long flags;
> -	struct irq_desc *desc = irq_get_desc_buslock(irq, &flags, 0);
> -
> -	if (!desc)
> -		return;
> +	scoped_irqdesc_get_and_buslock(irq, 0) {
> +		struct irq_desc *desc = scoped_irqdesc;
>  
> -	desc->irq_common_data.handler_data = data;
> -	__irq_do_set_handler(desc, handle, 1, NULL);
> -
> -	irq_put_desc_busunlock(desc, flags);
> +		desc->irq_common_data.handler_data = data;
> +		__irq_do_set_handler(desc, handle, 1, NULL);
> +	}
>  }
>  EXPORT_SYMBOL_GPL(irq_set_chained_handler_and_data);
>  
> 
> 
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ