lkml.org 
[lkml]   [2023]   [Mar]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH] pstore: Revert pmsg_lock back to a normal mutex
On Thu, 2 Mar 2023 16:32:53 -0500
Steven Rostedt <rostedt@goodmis.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 ***

\
 
 \ /
  Last update: 2023-03-27 00:42    [W:0.753 / U:0.032 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site