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  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]
Date:   Tue, 22 Dec 2020 02:37:11 +0100
From:   Frederic Weisbecker <>
To:     LKML <>
Cc:     Frederic Weisbecker <>,
        "Rafael J . Wysocki" <>,
        Peter Zijlstra <>,
        Ingo Molnar <>,
        Fabio Estevam <>,,
        Thomas Gleixner <>,
        "Paul E . McKenney" <>,
        Len Brown <>,
        Pengutronix Kernel Team <>,
        NXP Linux Team <>,
        Daniel Lezcano <>,
        Shawn Guo <>,
        Sascha Hauer <>
Subject: [PATCH 3/4] ARM: imx6q: Fix missing need_resched() check after rcu_idle_enter()

Entering RCU idle mode may cause a deferred wake up of an RCU NOCB_GP
kthread (rcuog) to be serviced.

Usually a wake up happening while running the idle task is spotted in
one of the need_resched() checks carefully placed within the idle loop
that can break to the scheduler.

Unfortunately imx6q_enter_wait() is beyond the last generic
need_resched() check and it performs a wfi right away after the call to
rcu_idle_enter(). We may halt the CPU with a resched request unhandled,
leaving the task hanging.

Fix this with performing a last minute need_resched() check after
calling rcu_idle_enter().

Reported-by: Paul E. McKenney <>
Fixes: 1a67b9263e06 (ARM: imx6q: Fixup RCU usage for cpuidle)
Cc: Shawn Guo <>
Cc: Sascha Hauer <>
Cc: Pengutronix Kernel Team <>
Cc: Fabio Estevam <>
Cc: NXP Linux Team <>
Cc: Peter Zijlstra <>
Cc: Rafael J. Wysocki <>
Cc: Thomas Gleixner <>
Cc: Ingo Molnar <>
Signed-off-by: Frederic Weisbecker <>
 arch/arm/mach-imx/cpuidle-imx6q.c | 7 ++++++-
 1 file changed, 6 insertions(+), 1 deletion(-)

diff --git a/arch/arm/mach-imx/cpuidle-imx6q.c b/arch/arm/mach-imx/cpuidle-imx6q.c
index 094337dc1bc7..31a60d257d3d 100644
--- a/arch/arm/mach-imx/cpuidle-imx6q.c
+++ b/arch/arm/mach-imx/cpuidle-imx6q.c
@@ -25,7 +25,12 @@ static int imx6q_enter_wait(struct cpuidle_device *dev,
-	cpu_do_idle();
+	/*
+	 * Last need_resched() check must come after rcu_idle_enter()
+	 * which may wake up RCU internal tasks.
+	 */
+	if (!need_resched())
+		cpu_do_idle();

Powered by blists - more mailing lists