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: <873b0e9a-0e71-0eaf-b057-8a118d9ccabf@huawei.com>
Date: Sun, 8 Jun 2025 20:45:44 +0800
From: Zenghui Yu <yuzenghui@...wei.com>
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 06/45] genirq/proc: Switch to lock guards

Hi Thomas,

On 2025/4/29 14:54, Thomas Gleixner wrote:
> Convert all lock/unlock pairs to guards and tidy up the code.
> 
> No functional change.
> 
> Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
> 
> ---
>  kernel/irq/proc.c |   65 +++++++++++++++++++-----------------------------------
>  1 file changed, 24 insertions(+), 41 deletions(-)
> 
> --- a/kernel/irq/proc.c
> +++ b/kernel/irq/proc.c
> @@ -81,20 +81,18 @@ static int show_irq_affinity(int type, s
>  static int irq_affinity_hint_proc_show(struct seq_file *m, void *v)
>  {
>  	struct irq_desc *desc = irq_to_desc((long)m->private);
> -	unsigned long flags;
>  	cpumask_var_t mask;
>  
>  	if (!zalloc_cpumask_var(&mask, GFP_KERNEL))
>  		return -ENOMEM;
>  
> -	raw_spin_lock_irqsave(&desc->lock, flags);
> -	if (desc->affinity_hint)
> -		cpumask_copy(mask, desc->affinity_hint);
> -	raw_spin_unlock_irqrestore(&desc->lock, flags);
> +	scoped_guard(raw_spinlock_irq, &desc->lock) {

Any reason it has been switched to a raw_spinlock_irq?

I've hit some random Oops with the backtrace looks like:

 Call trace:
  string+0x110/0x3b8 (P)
  vsnprintf+0x2f0/0xac8
  seq_printf+0x180/0x220
  show_interrupts+0x4e0/0x7e0
  seq_read_iter+0x350/0xd80
  proc_reg_read_iter+0x194/0x248
  vfs_read+0x5b0/0x940
  ksys_read+0xf0/0x1e8
  __arm64_sys_read+0x74/0xb0
  invoke_syscall+0x74/0x270
  el0_svc_common.constprop.0+0xb4/0x240
  do_el0_svc+0x48/0x68
  el0_svc+0x4c/0xe8
  el0t_64_sync_handler+0xc8/0xd0
  el0t_64_sync+0x1ac/0x1b0

I haven't dig further. But it looks to me that this patch had introduced
functional change and I'm planning to give the following diff a go on
the same box.

Thanks,
Zenghui

>From cfad0937ffb724c2c51c8656c212ccefb09c8990 Mon Sep 17 00:00:00 2001
From: Zenghui Yu <yuzenghui@...wei.com>
Date: Sun, 8 Jun 2025 19:41:41 +0800
Subject: [PATCH] fixup! genirq/proc: Switch to lock guards

Signed-off-by: Zenghui Yu <yuzenghui@...wei.com>
---
 kernel/irq/proc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/kernel/irq/proc.c b/kernel/irq/proc.c
index 29c2404e743b..5af8bd1f3ab4 100644
--- a/kernel/irq/proc.c
+++ b/kernel/irq/proc.c
@@ -86,7 +86,7 @@ static int irq_affinity_hint_proc_show(struct seq_file
*m, void *v)
 	if (!zalloc_cpumask_var(&mask, GFP_KERNEL))
 		return -ENOMEM;

-	scoped_guard(raw_spinlock_irq, &desc->lock) {
+	scoped_guard(raw_spinlock_irqsave, &desc->lock) {
 		if (desc->affinity_hint)
 			cpumask_copy(mask, desc->affinity_hint);
 	}
@@ -298,7 +298,7 @@ static bool name_unique(unsigned int irq, struct
irqaction *new_action)
 	struct irq_desc *desc = irq_to_desc(irq);
 	struct irqaction *action;

-	guard(raw_spinlock_irq)(&desc->lock);
+	guard(raw_spinlock_irqsave)(&desc->lock);
 	for_each_action_of_desc(desc, action) {
 		if ((action != new_action) && action->name &&
 		    !strcmp(new_action->name, action->name))
@@ -489,7 +489,7 @@ int show_interrupts(struct seq_file *p, void *v)
 	}
 	seq_putc(p, ' ');

-	guard(raw_spinlock_irq)(&desc->lock);
+	guard(raw_spinlock_irqsave)(&desc->lock);
 	if (desc->irq_data.chip) {
 		if (desc->irq_data.chip->irq_print_chip)
 			desc->irq_data.chip->irq_print_chip(&desc->irq_data, p);
-- 
2.33.0

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ