lkml.org 
[lkml]   [2017]   [Apr]   [10]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
Date
From
SubjectRe: [PATCH -v6 13/13] futex: futex_lock_pi() vs PREEMPT_RT_FULL
On Fri, Apr 07, 2017 at 07:26:10PM -0700, Darren Hart wrote:
> Peter, I presume there will be a v7 with the u32 change and hopefully a couple
> text updates?

Well, tglx already committed these here patches, so no -v7. What I can
do however is do a follow up patch that fixes some of the in-code things
you mentioned.

Something like the below is what I had lying about from your earlier
emails; I've not looked to see if there's anything else from your later
emails.

---
Subject: futex: Small misc fixes..
From: Peter Zijlstra <peterz@infradead.org>
Date: Fri Apr 7 09:04:07 CEST 2017

Feedback from Darren's review.

Reported-by: Darren Hart (VMWare) <dvhart@infradead.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
---
kernel/futex.c | 11 +++++++----
1 file changed, 7 insertions(+), 4 deletions(-)

--- a/kernel/futex.c
+++ b/kernel/futex.c
@@ -1025,7 +1025,8 @@ static int attach_to_pi_state(u32 __user
struct futex_pi_state **ps)
{
pid_t pid = uval & FUTEX_TID_MASK;
- int ret, uval2;
+ u32 uval2;
+ int ret;

/*
* Userspace might have messed up non-PI and PI futexes [3]
@@ -1441,6 +1442,11 @@ static int wake_futex_pi(u32 __user *uad
if (ret)
goto out_unlock;

+ /*
+ * This is a point of no return; once we modify the uval there is no
+ * going back and subsequent operations must not fail.
+ */
+
raw_spin_lock(&pi_state->owner->pi_lock);
WARN_ON(list_empty(&pi_state->list));
list_del_init(&pi_state->list);
@@ -1452,9 +1458,6 @@ static int wake_futex_pi(u32 __user *uad
pi_state->owner = new_owner;
raw_spin_unlock(&new_owner->pi_lock);

- /*
- * We've updated the uservalue, this unlock cannot fail.
- */
postunlock = __rt_mutex_futex_unlock(&pi_state->pi_mutex, &wake_q);

out_unlock:
\
 
 \ /
  Last update: 2017-04-10 11:08    [W:0.681 / U:0.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site