Messages in this thread | | | Date | Fri, 30 Aug 2019 18:44:37 +0200 | From | Oleg Nesterov <> | Subject | Re: [BUG] Use of probe_kernel_address() in task_rcu_dereference() without checking return value |
| |
On 08/30, Linus Torvalds wrote: > > But yes, your hack is I guess optimal for this particular case where > you simply can depend on "we know the pointer was valid, we just don't > know if it was freed". > > Hmm. Don't we RCU-free the task struct? Because then we don't even > need to care about CONFIG_DEBUG_PAGEALLOC. We can just always access > the pointer as long as we have the RCU read lock.
For example,
rcu_read_lock(); p = task_rcu_dereference(&cpu_rq(cpu)->curr); rcu_read_unlock();
->curr is not protected by RCU, the last schedule does put_task_struct() in finish_task_switch().
Of course we can change this and add another call_rcu (actually we can do better), and after that we do not need task_rcu_dereference() at all.
Oleg.
| |