• Paul E. McKenney's avatar
    rcu: Avoid rcu_print_detail_task_stall_rnp() segfault · 5fd4dc06
    Paul E. McKenney authored
    The rcu_print_detail_task_stall_rnp() function invokes
    rcu_preempt_blocked_readers_cgp() to verify that there are some preempted
    RCU readers blocking the current grace period outside of the protection
    of the rcu_node structure's ->lock.  This means that the last blocked
    reader might exit its RCU read-side critical section and remove itself
    from the ->blkd_tasks list before the ->lock is acquired, resulting in
    a segmentation fault when the subsequent code attempts to dereference
    the now-NULL gp_tasks pointer.
    
    This commit therefore moves the test under the lock.  This will not
    have measurable effect on lock contention because this code is invoked
    only when printing RCU CPU stall warnings, in other words, in the common
    case, never.
    Signed-off-by: default avatarPaul E. McKenney <paulmck@linux.vnet.ibm.com>
    5fd4dc06
rcutree_plugin.h 66.2 KB