kernel/exit.c:738:45: sparse: sparse: incorrect type in initializer (different address spaces)

From: kernel test robot
Date: Tue Oct 17 2023 - 01:53:11 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 213f891525c222e8ed145ce1ce7ae1f47921cb9c
commit: d80f7d7b2c75c5954d335dffbccca62a5002c3e0 signal: Guarantee that SIGNAL_GROUP_EXIT is set on process exit
date: 1 year, 3 months ago
config: x86_64-alldefconfig (https://download.01.org/0day-ci/archive/20231017/202310171346.njuOKnlc-lkp@xxxxxxxxx/config)
compiler: gcc-12 (Debian 12.2.0-14) 12.2.0
reproduce (this is a W=1 build): (https://download.01.org/0day-ci/archive/20231017/202310171346.njuOKnlc-lkp@xxxxxxxxx/reproduce)

If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202310171346.njuOKnlc-lkp@xxxxxxxxx/

sparse warnings: (new ones prefixed by >>)
kernel/exit.c:281:37: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct task_struct *tsk @@ got struct task_struct [noderef] __rcu *real_parent @@
kernel/exit.c:281:37: sparse: expected struct task_struct *tsk
kernel/exit.c:281:37: sparse: got struct task_struct [noderef] __rcu *real_parent
kernel/exit.c:284:32: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct task_struct *task @@ got struct task_struct [noderef] __rcu *real_parent @@
kernel/exit.c:284:32: sparse: expected struct task_struct *task
kernel/exit.c:284:32: sparse: got struct task_struct [noderef] __rcu *real_parent
kernel/exit.c:285:35: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct task_struct *task @@ got struct task_struct [noderef] __rcu *real_parent @@
kernel/exit.c:285:35: sparse: expected struct task_struct *task
kernel/exit.c:285:35: sparse: got struct task_struct [noderef] __rcu *real_parent
kernel/exit.c:330:24: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct task_struct *parent @@ got struct task_struct [noderef] __rcu *real_parent @@
kernel/exit.c:330:24: sparse: expected struct task_struct *parent
kernel/exit.c:330:24: sparse: got struct task_struct [noderef] __rcu *real_parent
kernel/exit.c:357:27: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/exit.c:357:27: sparse: expected struct spinlock [usertype] *lock
kernel/exit.c:357:27: sparse: got struct spinlock [noderef] __rcu *
kernel/exit.c:360:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/exit.c:360:29: sparse: expected struct spinlock [usertype] *lock
kernel/exit.c:360:29: sparse: got struct spinlock [noderef] __rcu *
kernel/exit.c:583:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct task_struct *reaper @@ got struct task_struct [noderef] __rcu *real_parent @@
kernel/exit.c:583:29: sparse: expected struct task_struct *reaper
kernel/exit.c:583:29: sparse: got struct task_struct [noderef] __rcu *real_parent
kernel/exit.c:585:29: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct task_struct *reaper @@ got struct task_struct [noderef] __rcu *real_parent @@
kernel/exit.c:585:29: sparse: expected struct task_struct *reaper
kernel/exit.c:585:29: sparse: got struct task_struct [noderef] __rcu *real_parent
>> kernel/exit.c:738:45: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct sighand_struct *sighand @@ got struct sighand_struct [noderef] __rcu *sighand @@
kernel/exit.c:738:45: sparse: expected struct sighand_struct *sighand
kernel/exit.c:738:45: sparse: got struct sighand_struct [noderef] __rcu *sighand
kernel/exit.c:927:63: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct sighand_struct *const sighand @@ got struct sighand_struct [noderef] __rcu *sighand @@
kernel/exit.c:927:63: sparse: expected struct sighand_struct *const sighand
kernel/exit.c:927:63: sparse: got struct sighand_struct [noderef] __rcu *sighand
kernel/exit.c:1082:39: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/exit.c:1082:39: sparse: expected struct spinlock [usertype] *lock
kernel/exit.c:1082:39: sparse: got struct spinlock [noderef] __rcu *
kernel/exit.c:1107:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/exit.c:1107:41: sparse: expected struct spinlock [usertype] *lock
kernel/exit.c:1107:41: sparse: got struct spinlock [noderef] __rcu *
kernel/exit.c:1196:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/exit.c:1196:25: sparse: expected struct spinlock [usertype] *lock
kernel/exit.c:1196:25: sparse: got struct spinlock [noderef] __rcu *
kernel/exit.c:1211:27: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/exit.c:1211:27: sparse: expected struct spinlock [usertype] *lock
kernel/exit.c:1211:27: sparse: got struct spinlock [noderef] __rcu *
kernel/exit.c:1262:25: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/exit.c:1262:25: sparse: expected struct spinlock [usertype] *lock
kernel/exit.c:1262:25: sparse: got struct spinlock [noderef] __rcu *
kernel/exit.c:1265:35: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/exit.c:1265:35: sparse: expected struct spinlock [usertype] *lock
kernel/exit.c:1265:35: sparse: got struct spinlock [noderef] __rcu *
kernel/exit.c:1271:27: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/exit.c:1271:27: sparse: expected struct spinlock [usertype] *lock
kernel/exit.c:1271:27: sparse: got struct spinlock [noderef] __rcu *
kernel/exit.c:1452:59: sparse: sparse: incompatible types in comparison expression (different base types):
kernel/exit.c:1452:59: sparse: void *
kernel/exit.c:1452:59: sparse: struct task_struct [noderef] __rcu *
kernel/exit.c:1468:25: sparse: sparse: incorrect type in initializer (different address spaces) @@ expected struct task_struct *parent @@ got struct task_struct [noderef] __rcu * @@
kernel/exit.c:1468:25: sparse: expected struct task_struct *parent
kernel/exit.c:1468:25: sparse: got struct task_struct [noderef] __rcu *
kernel/exit.c: note: in included file:
include/linux/ptrace.h:92:40: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct task_struct *p1 @@ got struct task_struct [noderef] __rcu *real_parent @@
include/linux/ptrace.h:92:40: sparse: expected struct task_struct *p1
include/linux/ptrace.h:92:40: sparse: got struct task_struct [noderef] __rcu *real_parent
include/linux/ptrace.h:92:60: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected struct task_struct *p2 @@ got struct task_struct [noderef] __rcu *parent @@
include/linux/ptrace.h:92:60: sparse: expected struct task_struct *p2
include/linux/ptrace.h:92:60: sparse: got struct task_struct [noderef] __rcu *parent
include/linux/ptrace.h:92:40: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct task_struct *p1 @@ got struct task_struct [noderef] __rcu *real_parent @@
include/linux/ptrace.h:92:40: sparse: expected struct task_struct *p1
include/linux/ptrace.h:92:40: sparse: got struct task_struct [noderef] __rcu *real_parent
include/linux/ptrace.h:92:60: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected struct task_struct *p2 @@ got struct task_struct [noderef] __rcu *parent @@
include/linux/ptrace.h:92:60: sparse: expected struct task_struct *p2
include/linux/ptrace.h:92:60: sparse: got struct task_struct [noderef] __rcu *parent
kernel/exit.c: note: in included file (through include/linux/sched/signal.h, include/linux/rcuwait.h, include/linux/percpu-rwsem.h, ...):
include/linux/sched/task.h:110:21: sparse: sparse: context imbalance in 'wait_task_zombie' - unexpected unlock
include/linux/sched/task.h:110:21: sparse: sparse: context imbalance in 'wait_task_stopped' - unexpected unlock
include/linux/sched/task.h:110:21: sparse: sparse: context imbalance in 'wait_task_continued' - unexpected unlock
kernel/exit.c: note: in included file:
include/linux/ptrace.h:92:40: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct task_struct *p1 @@ got struct task_struct [noderef] __rcu *real_parent @@
include/linux/ptrace.h:92:40: sparse: expected struct task_struct *p1
include/linux/ptrace.h:92:40: sparse: got struct task_struct [noderef] __rcu *real_parent
include/linux/ptrace.h:92:60: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected struct task_struct *p2 @@ got struct task_struct [noderef] __rcu *parent @@
include/linux/ptrace.h:92:60: sparse: expected struct task_struct *p2
include/linux/ptrace.h:92:60: sparse: got struct task_struct [noderef] __rcu *parent
kernel/exit.c: note: in included file (through include/linux/thread_info.h, arch/x86/include/asm/preempt.h, include/linux/preempt.h, ...):
arch/x86/include/asm/current.h:15:16: sparse: sparse: context imbalance in 'do_wait' - wrong count at exit

vim +738 kernel/exit.c

735
736 static void synchronize_group_exit(struct task_struct *tsk, long code)
737 {
> 738 struct sighand_struct *sighand = tsk->sighand;
739 struct signal_struct *signal = tsk->signal;
740
741 spin_lock_irq(&sighand->siglock);
742 signal->quick_threads--;
743 if ((signal->quick_threads == 0) &&
744 !(signal->flags & SIGNAL_GROUP_EXIT)) {
745 signal->flags = SIGNAL_GROUP_EXIT;
746 signal->group_exit_code = code;
747 signal->group_stop_count = 0;
748 }
749 spin_unlock_irq(&sighand->siglock);
750 }
751

--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki