Re: [PATCH rt] Fix races in ptrace

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



* Alexander Fyodorov | 2013-08-13 01:13:56 [+0400]:

>Hi Sebastian,
Hi Alexander,

>Is there a need to write a test?

It is nice to have so it can be checked if this bug is fixed "some place
else".

Now that I looked at it for a while, would this fix your trouble?

diff --git a/kernel/rtmutex.c b/kernel/rtmutex.c
--- a/kernel/rtmutex.c
+++ b/kernel/rtmutex.c
@@ -724,6 +724,7 @@ static void  noinline __sched rt_spin_lock_slowlock(struct rt_mutex *lock)
 	struct task_struct *lock_owner, *self = current;
 	struct rt_mutex_waiter waiter, *top_waiter;
 	int ret;
+	int new_state;
 
 	rt_mutex_init_waiter(&waiter, true);
 
@@ -744,8 +745,11 @@ static void  noinline __sched rt_spin_lock_slowlock(struct rt_mutex *lock)
 	 * try_to_wake_up().
 	 */
 	pi_lock(&self->pi_lock);
+	new_state = TASK_UNINTERRUPTIBLE;
+	if (task_is_traced(self))
+		new_state |= __TASK_TRACED;
 	self->saved_state = self->state;
-	__set_current_state(TASK_UNINTERRUPTIBLE);
+	__set_current_state(new_state);
 	pi_unlock(&self->pi_lock);
 
 	ret = task_blocks_on_rt_mutex(lock, &waiter, self, 0);

This should avoid that the trace state is lost while waiting on that
mutex and the checks for "is traced" may remain the same.

Sebastian
--
To unsubscribe from this list: send the line "unsubscribe linux-rt-users" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at  http://vger.kernel.org/majordomo-info.html




[Index of Archives]     [RT Stable]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Video 4 Linux]     [Device Mapper]

  Powered by Linux