lkml.org 
[lkml]   [2019]   [Sep]   [2]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [BUG] Use of probe_kernel_address() in task_rcu_dereference() without checking return value
    On Mon, Sep 02, 2019 at 03:40:03PM +0200, Oleg Nesterov wrote:
    > diff --git a/include/linux/sched.h b/include/linux/sched.h
    > index 8dc1811..1f9b021 100644
    > --- a/include/linux/sched.h
    > +++ b/include/linux/sched.h
    > @@ -1134,7 +1134,10 @@ struct task_struct {
    >
    > struct tlbflush_unmap_batch tlb_ubc;
    >
    > - struct rcu_head rcu;
    > + union {
    > + bool xxx;
    > + struct rcu_head rcu;
    > + };
    >
    > /* Cache last used pipe for splice(): */
    > struct pipe_inode_info *splice_pipe;
    > diff --git a/kernel/exit.c b/kernel/exit.c
    > index a75b6a7..baacfce 100644
    > --- a/kernel/exit.c
    > +++ b/kernel/exit.c
    > @@ -182,6 +182,11 @@ static void delayed_put_task_struct(struct rcu_head *rhp)
    > put_task_struct(tsk);
    > }
    >
    > +void call_delayed_put_task_struct(struct task_struct *p)
    > +{
    > + if (xchg(&p->xxx, 1))
    > + call_rcu(&p->rcu, delayed_put_task_struct);
    > +}

    I think this is the first usage of xchg() on _Bool, also not all archs
    implement xchg8()

    \
     
     \ /
      Last update: 2019-09-02 15:54    [W:4.100 / U:0.208 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site