[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20230302163603.223313ba@gandalf.local.home>
Date: Thu, 2 Mar 2023 16:36:03 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: John Stultz <jstultz@...gle.com>
Cc: LKML <linux-kernel@...r.kernel.org>, Wei Wang <wvw@...gle.com>,
Midas Chien <midaschieh@...gle.com>,
Kees Cook <keescook@...omium.org>,
Anton Vorontsov <anton@...msg.org>,
"Guilherme G. Piccoli" <gpiccoli@...lia.com>,
Tony Luck <tony.luck@...el.com>, kernel-team@...roid.com,
Thomas Gleixner <tglx@...utronix.de>,
Peter Zijlstra <peterz@...radead.org>,
Sebastian Andrzej Siewior <bigeasy@...utronix.de>
Subject: Re: [PATCH] pstore: Revert pmsg_lock back to a normal mutex
On Thu, 2 Mar 2023 16:32:53 -0500
Steven Rostedt <rostedt@...dmis.org> wrote:
> CPU1 CPU2
> ---- ----
> rt_mutex_slowlock_block() {
> raw_spin_lock_irq(wait_lock);
> owner = rt_mutex_owner();
> raw_spin_unlock_irq(wait_lock);
>
> rtmutex_spin_on_owner(owner) {
I just noticed there's an rcu_read_lock() here around the loop.
I'm guessing that's to keep this race from happening.
Would have been nice to have a comment there stating such.
-- Steve
> owner = rt_mutex_owner();
>
> [ task preempted! (could also be a long interrupt) ]
>
> owner releases lock and exits
> owner is freed
>
> [ task resumes ]
>
> if (!owner_on_cpu(owner)
>
> READ_ONCE(owner->on_cpu)
> *** BOOM invalid pointer dereference ***
Powered by blists - more mailing lists