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>] [day] [month] [year] [list]
Message-ID:
 <BYAPR12MB3205BCE06EA38DC33B84F402D5C42@BYAPR12MB3205.namprd12.prod.outlook.com>
Date: Fri, 21 Feb 2025 04:36:39 +0000
From: stephen eta zhou <stephen.eta.zhou@...look.com>
To: "linux@...linux.org.uk" <linux@...linux.org.uk>
CC: "linux-arm-kernel@...ts.infradead.org"
	<linux-arm-kernel@...ts.infradead.org>, "linux-kernel@...r.kernel.org"
	<linux-kernel@...r.kernel.org>
Subject: [PATCH] arch/arm/lib/delay.c: Add warning for unregistered
  delay_timer in read_current_timer()

Hi Russell

While debugging Linux, I found that the kernel relies on the read_current_timer function when inserting canary values into the interrupt stack or generating entropy. However, if the current clock source has not called register_current_timer_delay for proper registration, read_current_timer will return an incorrect timer value. This issue is somewhat subtle, as even if read_current_timer doesn't work properly, the function that wraps it may still return 0 without triggering any warning or error.
For example, when generating entropy, rdseed might incorrectly be set to 0. Since no obvious warning or error occurs, this problem may go unnoticed, leading to calculated values that do not meet the ideal pseudorandom number requirements.
To make it easier to debug and trace this issue, I added a WARN warning in the relevant conditional checks. This helps developers more easily trace the stack, quickly locate the issue, and significantly reduce debugging time.

=======================================

From 3b3b2cc22ad9e1af0d3321aac27e09b263797c52 Mon Sep 17 00:00:00 2001
From: Stephen Eta Zhou <stephen.eta.zhou@...look.com>
Date: Fri, 21 Feb 2025 11:55:18 +0800
Subject: [PATCH] arch/arm/lib/delay.c: Add warning for unregistered
 delay_timer in read_current_timer()

Added a WARN to track when delay_timer is NULL in read_current_timer.

Signed-off-by: Stephen Eta Zhou <stephen.eta.zhou@...look.com>
---
 arch/arm/lib/delay.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/arch/arm/lib/delay.c b/arch/arm/lib/delay.c
index b7fe84f68bf1..a15015861d25 100644
--- a/arch/arm/lib/delay.c
+++ b/arch/arm/lib/delay.c
@@ -29,8 +29,10 @@ static u64 delay_res;
 
 int read_current_timer(unsigned long *timer_val)
 {
-     if (!delay_timer)
+     if (!delay_timer) {
+           WARN(1, "Delay timer is NULL\n");
            return -ENXIO;
+     }
 
      *timer_val = delay_timer->read_current_timer();
      return 0;
-- 
2.25.1

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ