lists.openwall.net   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  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [day] [month] [year] [list]
Date:	Tue, 16 Apr 2013 17:25:56 +1000
From:	Stephen Rothwell <sfr@...b.auug.org.au>
To:	Andrew Morton <akpm@...ux-foundation.org>
Cc:	linux-next@...r.kernel.org, linux-kernel@...r.kernel.org,
	Thomas Gleixner <tglx@...utronix.de>,
	Oleg Nesterov <oleg@...hat.com>
Subject: linux-next: manual merge of the akpm tree with Linus' tree

Hi Andrew,

Today's linux-next merge of the akpm tree got a conflict in
kernel/kthread.c between commit f2530dc71cf0 ("kthread: Prevent unpark
race which puts threads on the wrong cpu") from Linus' tree and commit
"kthread: kill task_get_live_kthread()" from the akpm tree.

I fixed it up (see below) and can carry the fix as necessary (no action
is required).

-- 
Cheers,
Stephen Rothwell                    sfr@...b.auug.org.au

diff --cc kernel/kthread.c
index e820aa6,b9db231..0000000
--- a/kernel/kthread.c
+++ b/kernel/kthread.c
@@@ -324,28 -324,6 +324,22 @@@ struct task_struct *kthread_create_on_c
  	return p;
  }
  
- static struct kthread *task_get_live_kthread(struct task_struct *k)
- {
- 	get_task_struct(k);
- 	return to_live_kthread(k);
- }
- 
 +static void __kthread_unpark(struct task_struct *k, struct kthread *kthread)
 +{
 +	clear_bit(KTHREAD_SHOULD_PARK, &kthread->flags);
 +	/*
 +	 * We clear the IS_PARKED bit here as we don't wait
 +	 * until the task has left the park code. So if we'd
 +	 * park before that happens we'd see the IS_PARKED bit
 +	 * which might be about to be cleared.
 +	 */
 +	if (test_and_clear_bit(KTHREAD_IS_PARKED, &kthread->flags)) {
 +		if (test_bit(KTHREAD_IS_PER_CPU, &kthread->flags))
 +			__kthread_bind(k, kthread->cpu, TASK_PARKED);
 +		wake_up_state(k, TASK_PARKED);
 +	}
 +}
 +
  /**
   * kthread_unpark - unpark a thread created by kthread_create().
   * @k:		thread created by kthread_create().
@@@ -356,11 -334,22 +350,10 @@@
   */
  void kthread_unpark(struct task_struct *k)
  {
- 	struct kthread *kthread = task_get_live_kthread(k);
+ 	struct kthread *kthread = to_live_kthread(k);
  
 -	if (kthread) {
 -		clear_bit(KTHREAD_SHOULD_PARK, &kthread->flags);
 -		/*
 -		 * We clear the IS_PARKED bit here as we don't wait
 -		 * until the task has left the park code. So if we'd
 -		 * park before that happens we'd see the IS_PARKED bit
 -		 * which might be about to be cleared.
 -		 */
 -		if (test_and_clear_bit(KTHREAD_IS_PARKED, &kthread->flags)) {
 -			if (test_bit(KTHREAD_IS_PER_CPU, &kthread->flags))
 -				__kthread_bind(k, kthread->cpu);
 -			wake_up_process(k);
 -		}
 -	}
 +	if (kthread)
 +		__kthread_unpark(k, kthread);
- 	put_task_struct(k);
  }
  
  /**
@@@ -415,9 -403,12 +407,12 @@@ int kthread_stop(struct task_struct *k
  	int ret;
  
  	trace_sched_kthread_stop(k);
+ 
+ 	get_task_struct(k);
+ 	kthread = to_live_kthread(k);
  	if (kthread) {
  		set_bit(KTHREAD_SHOULD_STOP, &kthread->flags);
 -		clear_bit(KTHREAD_SHOULD_PARK, &kthread->flags);
 +		__kthread_unpark(k, kthread);
  		wake_up_process(k);
  		wait_for_completion(&kthread->exited);
  	}

Content of type "application/pgp-signature" skipped

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ