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>] [day] [month] [year] [list]
Date: Tue, 25 Jun 2024 15:01:23 -0000
From: "tip-bot2 for Phil Chang" <tip-bot2@...utronix.de>
To: linux-tip-commits@...r.kernel.org
Cc: Phil Chang <phil.chang@...iatek.com>,
 "Anna-Maria Behnsen" <anna-maria@...utronix.de>,
 Thomas Gleixner <tglx@...utronix.de>, x86@...nel.org,
 linux-kernel@...r.kernel.org
Subject: [tip: timers/urgent] hrtimer: Prevent queuing of hrtimer without a
 function callback

The following commit has been merged into the timers/urgent branch of tip:

Commit-ID:     5a830bbce3af16833fe0092dec47b6dd30279825
Gitweb:        https://git.kernel.org/tip/5a830bbce3af16833fe0092dec47b6dd30279825
Author:        Phil Chang <phil.chang@...iatek.com>
AuthorDate:    Mon, 10 Jun 2024 21:31:36 +08:00
Committer:     Thomas Gleixner <tglx@...utronix.de>
CommitterDate: Tue, 25 Jun 2024 16:54:27 +02:00

hrtimer: Prevent queuing of hrtimer without a function callback

The hrtimer function callback must not be NULL. It has to be specified by
the call side but it is not validated by the hrtimer code. When a hrtimer
is queued without a function callback, the kernel crashes with a null
pointer dereference when trying to execute the callback in __run_hrtimer().

Introduce a validation before queuing the hrtimer in
hrtimer_start_range_ns().

[anna-maria: Rephrase commit message]

Signed-off-by: Phil Chang <phil.chang@...iatek.com>
Signed-off-by: Anna-Maria Behnsen <anna-maria@...utronix.de>
Signed-off-by: Thomas Gleixner <tglx@...utronix.de>
Reviewed-by: Anna-Maria Behnsen <anna-maria@...utronix.de>
---
 kernel/time/hrtimer.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/kernel/time/hrtimer.c b/kernel/time/hrtimer.c
index 492c14a..b8ee320 100644
--- a/kernel/time/hrtimer.c
+++ b/kernel/time/hrtimer.c
@@ -1285,6 +1285,8 @@ void hrtimer_start_range_ns(struct hrtimer *timer, ktime_t tim,
 	struct hrtimer_clock_base *base;
 	unsigned long flags;
 
+	if (WARN_ON_ONCE(!timer->function))
+		return;
 	/*
 	 * Check whether the HRTIMER_MODE_SOFT bit and hrtimer.is_soft
 	 * match on CONFIG_PREEMPT_RT = n. With PREEMPT_RT check the hard

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ