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  PHC 
Open Source and information security mailing list archives
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Mon, 20 Oct 2014 22:50:06 +0200
From:	Oleg Nesterov <>
To:	Kirill Tkhai <>
Cc:	Kirill Tkhai <>,,
	Peter Zijlstra <>,
	Ingo Molnar <>,
	Vladimir Davydov <>
Subject: Re: [PATCH v3] sched/numa: fix unsafe get_task_struct() in

On 10/21, Kirill Tkhai wrote:
> I think generic helper is a good idea. The prototype looks OK.
> But I'm a little doubt about retry loop. If this helper is generic and
> one day it may move to ./include directory,

Well, if we add a generic helper I think it should be exported even if
it has a single caller. But I agree this probably needs a justification

> isn't there a probability
> people will use it wrong? This loop may bring delays or something bad.

Yes, I thought about livelock too. OK, we can remove it, just
s/goto retry/return NULL/. Or, perhaps better, return ERR_PTR(-EAGAIN)
so that the caller can know that retry is possible.

I do not really mind, and we can reconsider this later. And I will not
argue if you prefer to add the rq->curr specific hack (like your patch

> And since we still depends on RCU, I'd suggest to add its lockdep assert.


Let me explain what I personally dislike in v3:

	- I think that we do not have enough reasons for
	  SLAB_DESTROY_BY_RCU. This is the serious change.

	  probe_kernel_read() looks better to me, and hopefully
	  IS_ENABLED(DEBUG_PAGEALLOC) can make it conditional.

	- PF_EXITING was fine in task_numa_compare(), but if we
	  move this logic into a helper (even if it is not exported)
	  then I think we need a more specific check. sighand == NULL
	  looks better to me because it clearly connects to
	  release_task() which makes this task_struct "rcu-unsafe".

	- Again, perhaps we should start we a simple and stupid fix.
	  We can do get_task_struct() under rq->lock or, if nothing
	  else, just

	  	cur = rq->curr;
	  	if (is_idle_task(cur) || (cur->flags & PF_EXITING))
	  		cur = NULL;

Either way, I hope you will send v4 ;)

But probably you should wait for for Peter's opinion first.


To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to
More majordomo info at
Please read the FAQ at

Powered by blists - more mailing lists