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>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Thu, 11 Nov 2010 13:39:29 +0100
From:	Jens Axboe <axboe@...nel.dk>
To:	Oleg Nesterov <oleg@...hat.com>
CC:	"Paul E. McKenney" <paulmck@...ux.vnet.ibm.com>,
	Greg Thelen <gthelen@...gle.com>, linux-kernel@...r.kernel.org,
	linux-mm@...ck.org
Subject: Re: INFO: suspicious rcu_dereference_check() usage -  kernel/pid.c:419
 invoked rcu_dereference_check() without protection!

On 2010-11-11 13:30, Oleg Nesterov wrote:
> On 11/11, Jens Axboe wrote:
>>
>> On 2010-11-10 17:02, Oleg Nesterov wrote:
>>>
>>> But wait. Whatever we do, isn't this code racy? I do not see why, say,
>>> sys_ioprio_set(IOPRIO_WHO_PROCESS) can't install ->io_context after
>>> this task has already passed exit_io_context().
>>>
>>> Jens, am I missed something?
>>
>> Not sure, I think the original intent was for the tasklist_lock to
>> protect from a concurrent exit, but that looks like nonsense and it was
>> just there to protect the task lookup.
> 
> Probably. After that (perhaps) there was another reason, see
> 
> 	5b160f5e "copy_process: cosmetic ->ioprio tweak"
> 	cf342e52 "Don't need to disable interrupts for tasklist_lock"
> 
> But this was dismissed by
> 
> 	fd0928df "ioprio: move io priority from task_struct to io_context"
> 
>> How about moving the ->io_context check and exit_io_context() in
>> do_exit() under the task lock? Coupled with a check for PF_EXITING in
>> set_task_ioprio().
> 
> Yes, I thought about this too. The only drawback is that we should
> take task_lock() unconditionally in exit_io_context().

Sure, not a big problem.

> Btw, in theory get_task_ioprio() is racy too. "ret = p->io_context->ioprio"
> can lead to use-after-free. Probably needs task_lock() as well.

Indeed...

> Hmm. And copy_io_context() has no callers ;)

Good find. It was previously used by the AS io scheduler, seems there
are no users left anymore. I queued up a patch to kill it.


-- 
Jens Axboe

--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ