kernel/fork.c:1205:22: sparse: sparse: incorrect type in assignment (different address spaces)
From: kernel test robot
Date: Thu Sep 09 2021 - 02:20:48 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: a3fa7a101dcff93791d1b1bdb3affcad1410c8c1
commit: 35d7bdc86031a2c1ae05ac27dfa93b2acdcbaecc kernel/fork: factor out replacing the current MM exe_file
date: 6 days ago
config: mips-randconfig-s032-20210908 (attached as .config)
compiler: mips64el-linux-gcc (GCC) 11.2.0
reproduce:
wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
chmod +x ~/bin/make.cross
# apt-get install sparse
# sparse version: v0.6.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=35d7bdc86031a2c1ae05ac27dfa93b2acdcbaecc
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 35d7bdc86031a2c1ae05ac27dfa93b2acdcbaecc
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=mips
If you fix the issue, kindly add following tag as appropriate
Reported-by: kernel test robot <lkp@xxxxxxxxx>
sparse warnings: (new ones prefixed by >>)
command-line: note: in included file:
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQUIRE redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_SEQ_CST redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_ACQ_REL redefined
builtin:0:0: sparse: this was the original definition
builtin:1:9: sparse: sparse: preprocessor token __ATOMIC_RELEASE redefined
builtin:0:0: sparse: this was the original definition
>> kernel/fork.c:1205:22: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct file *[assigned] old_exe_file @@ got struct file [noderef] __rcu *[assigned] __res @@
kernel/fork.c:1205:22: sparse: expected struct file *[assigned] old_exe_file
kernel/fork.c:1205:22: sparse: got struct file [noderef] __rcu *[assigned] __res
kernel/fork.c:1557:38: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct refcount_struct [usertype] *r @@ got struct refcount_struct [noderef] __rcu * @@
kernel/fork.c:1557:38: sparse: expected struct refcount_struct [usertype] *r
kernel/fork.c:1557:38: sparse: got struct refcount_struct [noderef] __rcu *
kernel/fork.c:1566:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/fork.c:1566:31: sparse: expected struct spinlock [usertype] *lock
kernel/fork.c:1566:31: sparse: got struct spinlock [noderef] __rcu *
kernel/fork.c:1567:36: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *q @@ got struct k_sigaction [noderef] __rcu * @@
kernel/fork.c:1567:36: sparse: expected void const *q
kernel/fork.c:1567:36: sparse: got struct k_sigaction [noderef] __rcu *
kernel/fork.c:1568:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/fork.c:1568:33: sparse: expected struct spinlock [usertype] *lock
kernel/fork.c:1568:33: sparse: got struct spinlock [noderef] __rcu *
kernel/fork.c:1980:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/fork.c:1980:31: sparse: expected struct spinlock [usertype] *lock
kernel/fork.c:1980:31: sparse: got struct spinlock [noderef] __rcu *
kernel/fork.c:1984:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/fork.c:1984:33: sparse: expected struct spinlock [usertype] *lock
kernel/fork.c:1984:33: sparse: got struct spinlock [noderef] __rcu *
kernel/fork.c:2287:32: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct task_struct [noderef] __rcu *real_parent @@ got struct task_struct *task @@
kernel/fork.c:2287:32: sparse: expected struct task_struct [noderef] __rcu *real_parent
kernel/fork.c:2287:32: sparse: got struct task_struct *task
kernel/fork.c:2296:27: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/fork.c:2296:27: sparse: expected struct spinlock [usertype] *lock
kernel/fork.c:2296:27: sparse: got struct spinlock [noderef] __rcu *
kernel/fork.c:2345:54: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected struct list_head *head @@ got struct list_head [noderef] __rcu * @@
kernel/fork.c:2345:54: sparse: expected struct list_head *head
kernel/fork.c:2345:54: sparse: got struct list_head [noderef] __rcu *
kernel/fork.c:2366:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/fork.c:2366:29: sparse: expected struct spinlock [usertype] *lock
kernel/fork.c:2366:29: sparse: got struct spinlock [noderef] __rcu *
kernel/fork.c:2384:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/fork.c:2384:29: sparse: expected struct spinlock [usertype] *lock
kernel/fork.c:2384:29: sparse: got struct spinlock [noderef] __rcu *
kernel/fork.c:2411:28: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct sighand_struct *sighand @@ got struct sighand_struct [noderef] __rcu *sighand @@
kernel/fork.c:2411:28: sparse: expected struct sighand_struct *sighand
kernel/fork.c:2411:28: sparse: got struct sighand_struct [noderef] __rcu *sighand
kernel/fork.c:2439:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/fork.c:2439:31: sparse: expected struct spinlock [usertype] *lock
kernel/fork.c:2439:31: sparse: got struct spinlock [noderef] __rcu *
kernel/fork.c:2441:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@
kernel/fork.c:2441:33: sparse: expected struct spinlock [usertype] *lock
kernel/fork.c:2441:33: sparse: got struct spinlock [noderef] __rcu *
kernel/fork.c:2850:24: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct task_struct *[assigned] parent @@ got struct task_struct [noderef] __rcu *real_parent @@
kernel/fork.c:2850:24: sparse: expected struct task_struct *[assigned] parent
kernel/fork.c:2850:24: sparse: got struct task_struct [noderef] __rcu *real_parent
kernel/fork.c:2931:43: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct refcount_struct const [usertype] *r @@ got struct refcount_struct [noderef] __rcu * @@
kernel/fork.c:2931:43: sparse: expected struct refcount_struct const [usertype] *r
kernel/fork.c:2931:43: sparse: got struct refcount_struct [noderef] __rcu *
kernel/fork.c:1661:9: sparse: sparse: dereference of noderef expression
kernel/fork.c:1661:9: sparse: sparse: dereference of noderef expression
kernel/fork.c:2024:22: sparse: sparse: dereference of noderef expression
kernel/fork.c: note: in included file (through include/uapi/asm-generic/bpf_perf_event.h, arch/mips/include/generated/uapi/asm/bpf_perf_event.h, ...):
include/linux/ptrace.h:218:45: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected struct task_struct *new_parent @@ got struct task_struct [noderef] __rcu *parent @@
include/linux/ptrace.h:218:45: sparse: expected struct task_struct *new_parent
include/linux/ptrace.h:218:45: sparse: got struct task_struct [noderef] __rcu *parent
include/linux/ptrace.h:218:62: sparse: sparse: incorrect type in argument 3 (different address spaces) @@ expected struct cred const *ptracer_cred @@ got struct cred const [noderef] __rcu *ptracer_cred @@
include/linux/ptrace.h:218:62: sparse: expected struct cred const *ptracer_cred
include/linux/ptrace.h:218:62: sparse: got struct cred const [noderef] __rcu *ptracer_cred
kernel/fork.c:2343:59: sparse: sparse: dereference of noderef expression
kernel/fork.c:2344:59: sparse: sparse: dereference of noderef expression
vim +1205 kernel/fork.c
1170
1171 /**
1172 * replace_mm_exe_file - replace a reference to the mm's executable file
1173 *
1174 * This changes mm's executable file (shown as symlink /proc/[pid]/exe),
1175 * dealing with concurrent invocation and without grabbing the mmap lock in
1176 * write mode.
1177 *
1178 * Main user is sys_prctl(PR_SET_MM_MAP/EXE_FILE).
1179 */
1180 int replace_mm_exe_file(struct mm_struct *mm, struct file *new_exe_file)
1181 {
1182 struct vm_area_struct *vma;
1183 struct file *old_exe_file;
1184 int ret = 0;
1185
1186 /* Forbid mm->exe_file change if old file still mapped. */
1187 old_exe_file = get_mm_exe_file(mm);
1188 if (old_exe_file) {
1189 mmap_read_lock(mm);
1190 for (vma = mm->mmap; vma && !ret; vma = vma->vm_next) {
1191 if (!vma->vm_file)
1192 continue;
1193 if (path_equal(&vma->vm_file->f_path,
1194 &old_exe_file->f_path))
1195 ret = -EBUSY;
1196 }
1197 mmap_read_unlock(mm);
1198 fput(old_exe_file);
1199 if (ret)
1200 return ret;
1201 }
1202
1203 /* set the new file, lockless */
1204 get_file(new_exe_file);
> 1205 old_exe_file = xchg(&mm->exe_file, new_exe_file);
1206 if (old_exe_file)
1207 fput(old_exe_file);
1208 return 0;
1209 }
1210
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx
Attachment:
.config.gz
Description: application/gzip