提交 913292c9 编写于 作者: M Madhuparna Bhowmik 提交者: Christian Brauner

sched.h: Annotate sighand_struct with __rcu

This patch fixes the following sparse errors by annotating the
sighand_struct with __rcu

kernel/fork.c:1511:9: error: incompatible types in comparison expression
kernel/exit.c:100:19: error: incompatible types in comparison expression
kernel/signal.c:1370:27: error: incompatible types in comparison expression

This fix introduces the following sparse error in signal.c due to
checking the sighand pointer without rcu primitives:

kernel/signal.c:1386:21: error: incompatible types in comparison expression

This new sparse error is also fixed in this patch.
Signed-off-by: NMadhuparna Bhowmik <madhuparnabhowmik10@gmail.com>
Acked-by: NPaul E. McKenney <paulmck@kernel.org>
Link: https://lore.kernel.org/r/20200124045908.26389-1-madhuparnabhowmik10@gmail.comSigned-off-by: NChristian Brauner <christian.brauner@ubuntu.com>
上级 873dfd78
...@@ -917,7 +917,7 @@ struct task_struct { ...@@ -917,7 +917,7 @@ struct task_struct {
/* Signal handlers: */ /* Signal handlers: */
struct signal_struct *signal; struct signal_struct *signal;
struct sighand_struct *sighand; struct sighand_struct __rcu *sighand;
sigset_t blocked; sigset_t blocked;
sigset_t real_blocked; sigset_t real_blocked;
/* Restored if set_restore_sigmask() was used: */ /* Restored if set_restore_sigmask() was used: */
......
...@@ -1383,7 +1383,7 @@ struct sighand_struct *__lock_task_sighand(struct task_struct *tsk, ...@@ -1383,7 +1383,7 @@ struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
* must see ->sighand == NULL. * must see ->sighand == NULL.
*/ */
spin_lock_irqsave(&sighand->siglock, *flags); spin_lock_irqsave(&sighand->siglock, *flags);
if (likely(sighand == tsk->sighand)) if (likely(sighand == rcu_access_pointer(tsk->sighand)))
break; break;
spin_unlock_irqrestore(&sighand->siglock, *flags); spin_unlock_irqrestore(&sighand->siglock, *flags);
} }
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册