Skip to content

Commit 913292c

Browse files
Madhuparna BhowmikChristian Brauner
authored andcommitted
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: Madhuparna Bhowmik <[email protected]> Acked-by: Paul E. McKenney <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Christian Brauner <[email protected]>
1 parent 873dfd7 commit 913292c

File tree

2 files changed

+2
-2
lines changed

2 files changed

+2
-2
lines changed

include/linux/sched.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -917,7 +917,7 @@ struct task_struct {
917917

918918
/* Signal handlers: */
919919
struct signal_struct *signal;
920-
struct sighand_struct *sighand;
920+
struct sighand_struct __rcu *sighand;
921921
sigset_t blocked;
922922
sigset_t real_blocked;
923923
/* Restored if set_restore_sigmask() was used: */

kernel/signal.c

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1383,7 +1383,7 @@ struct sighand_struct *__lock_task_sighand(struct task_struct *tsk,
13831383
* must see ->sighand == NULL.
13841384
*/
13851385
spin_lock_irqsave(&sighand->siglock, *flags);
1386-
if (likely(sighand == tsk->sighand))
1386+
if (likely(sighand == rcu_access_pointer(tsk->sighand)))
13871387
break;
13881388
spin_unlock_irqrestore(&sighand->siglock, *flags);
13891389
}

0 commit comments

Comments
 (0)