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] [day] [month] [year] [list]
Message-ID: <e75d0e92-1e6e-43c2-1935-00f22df5579d@codethink.co.uk>
Date:   Mon, 24 Jul 2023 14:42:50 +0100
From:   Ben Dooks <ben.dooks@...ethink.co.uk>
To:     "luxu.kernel" <luxujoy@...il.com>, paul.walmsley@...ive.com,
        palmer@...belt.com, aou@...s.berkeley.edu
Cc:     linux-riscv@...ts.infradead.org, linux-kernel@...r.kernel.org,
        luxu.kernel@...edance.com
Subject: Re: [PATCH] riscv: Fix local irq restore when flags indicates irq
 disabled

On 24/07/2023 14:27, luxu.kernel wrote:
> When arch_local_irq_restore() is called with flags indicating irqs
> disabled, we need to clear SR_IE bit in CSR_STATUS, whereas current
> implementation based on csr_set() function only sets SR_IE bit of
> CSR_STATUS when SR_IE bit of flags is high and does nothing when
> SR_IE bit of flags is low.
> 
> This commit supplies csr clear operation when calling irq restore
> function with flags indicating irq disabled.
> 
> Signed-off-by: luxu.kernel <luxu.kernel@...edance.com>

real-names are required for signoff

> ---
>   arch/riscv/include/asm/irqflags.h | 5 ++++-
>   1 file changed, 4 insertions(+), 1 deletion(-)
> 
> diff --git a/arch/riscv/include/asm/irqflags.h b/arch/riscv/include/asm/irqflags.h
> index 08d4d6a5b7e9..7c31fc3c3559 100644
> --- a/arch/riscv/include/asm/irqflags.h
> +++ b/arch/riscv/include/asm/irqflags.h
> @@ -49,7 +49,10 @@ static inline int arch_irqs_disabled(void)
>   /* set interrupt enabled status */
>   static inline void arch_local_irq_restore(unsigned long flags)
>   {
> -	csr_set(CSR_STATUS, flags & SR_IE);
> +	if (flags & SR_IE)
> +		csr_set(CSR_STATUS, SR_IE);
> +	else
> +		csr_clear(CSR_STATUS, SR_IE);
>   }
>   
>   #endif /* _ASM_RISCV_IRQFLAGS_H */

I think this is correct, I wonder how long this has been going on
without anyone noticing?

-- 
Ben Dooks				http://www.codethink.co.uk/
Senior Engineer				Codethink - Providing Genius

https://www.codethink.co.uk/privacy.html

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ