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 18:56:14 +0200
From:	Oleg Nesterov <>
To:	Kirill Tkhai <>
	Peter Zijlstra <>,
	Ingo Molnar <>,
	Vladimir Davydov <>,
	Kirill Tkhai <>
Subject: Re: [PATCH v3] sched/numa: fix unsafe get_task_struct() in

On 10/20, Oleg Nesterov wrote:
> Again, perhaps we will need to change the lifetime rules for task_struct
> anyway, if we have more problems like this. But until then this looks like
> an overkill to me. Plus rq_curr_if_not_put() looks too subtle, and it is
> not generic.

Yes... otoh, perhaps we can do something more generic? Something like

	struct task_struct *xxx(struct task_struct **ptask)
		struct task_struct *task;
		void *sighand;
		task = ACCESS_ONCE(*ptask);
		if (!task)
			return NULL;

			if (probe_kernel_read(&sighand, &task->sighand, sizeof(sighand)))
				goto retry;
		} else {
			sighand = task->sighand;

		if (!sighand)
			return NULL;
		 * Pairs with atomic_dec_and_test() in put_task_struct(task).
		 * If we have read the freed/reused memory, we must see that
		 * the pointer was updated.
		if (task != ACCESS_ONCE(*ptask))
			goto retry;

		return task;

task_numa_compare() can do cur = xxx(&rc->curr), but this helper can work
with any "task_struct *" pointer assuming that somehow this pointer is
cleared or changed before the final put_task_struct().

What do you think? Peter?


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