From: Oleg Nesterov <oleg@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Greg Thelen <gthelen@google.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: INFO: suspicious rcu_dereference_check() usage - kernel/pid.c:419 invoked rcu_dereference_check() without protection!
Date: Thu, 11 Nov 2010 13:30:15 +0100 [thread overview]
Message-ID: <20101111123015.GA25991@redhat.com> (raw)
In-Reply-To: <4CDBD12C.4010807@kernel.dk>
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().
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.
Hmm. And copy_io_context() has no callers ;)
Oleg.
WARNING: multiple messages have this Message-ID (diff)
From: Oleg Nesterov <oleg@redhat.com>
To: Jens Axboe <axboe@kernel.dk>
Cc: "Paul E. McKenney" <paulmck@linux.vnet.ibm.com>,
Greg Thelen <gthelen@google.com>,
linux-kernel@vger.kernel.org, linux-mm@kvack.org
Subject: Re: INFO: suspicious rcu_dereference_check() usage - kernel/pid.c:419 invoked rcu_dereference_check() without protection!
Date: Thu, 11 Nov 2010 13:30:15 +0100 [thread overview]
Message-ID: <20101111123015.GA25991@redhat.com> (raw)
In-Reply-To: <4CDBD12C.4010807@kernel.dk>
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().
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.
Hmm. And copy_io_context() has no callers ;)
Oleg.
--
To unsubscribe, send a message with 'unsubscribe linux-mm' in
the body to majordomo@kvack.org. For more info on Linux MM,
see: http://www.linux-mm.org/ .
Fight unfair telecom policy in Canada: sign http://dissolvethecrtc.ca/
Don't email: <a href=mailto:"dont@kvack.org"> email@kvack.org </a>
next prev parent reply other threads:[~2010-11-11 12:36 UTC|newest]
Thread overview: 22+ messages / expand[flat|nested] mbox.gz Atom feed top
2010-10-12 7:08 INFO: suspicious rcu_dereference_check() usage - kernel/pid.c:419 invoked rcu_dereference_check() without protection! Greg Thelen
2010-10-12 7:08 ` Greg Thelen
2010-11-07 18:20 ` Paul E. McKenney
2010-11-07 18:20 ` Paul E. McKenney
2010-11-08 15:15 ` Oleg Nesterov
2010-11-08 15:15 ` Oleg Nesterov
2010-11-09 20:29 ` Paul E. McKenney
2010-11-09 20:29 ` Paul E. McKenney
2010-11-10 15:55 ` Oleg Nesterov
2010-11-10 15:55 ` Oleg Nesterov
2010-11-10 16:02 ` Oleg Nesterov
2010-11-10 16:02 ` Oleg Nesterov
2010-11-11 11:19 ` Jens Axboe
2010-11-11 11:19 ` Jens Axboe
2010-11-11 12:30 ` Oleg Nesterov [this message]
2010-11-11 12:30 ` Oleg Nesterov
2010-11-11 12:39 ` Jens Axboe
2010-11-11 12:39 ` Jens Axboe
2010-11-11 19:45 ` Greg Thelen
2010-11-11 19:45 ` Greg Thelen
2010-11-11 22:00 ` Oleg Nesterov
2010-11-11 22:00 ` Oleg Nesterov
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20101111123015.GA25991@redhat.com \
--to=oleg@redhat.com \
--cc=axboe@kernel.dk \
--cc=gthelen@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mm@kvack.org \
--cc=paulmck@linux.vnet.ibm.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.