lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Tue, 7 Sep 2021 11:45:32 +0200
From:   David Hildenbrand <david@...hat.com>
To:     kernel test robot <lkp@...el.com>
Cc:     kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: Re: kernel/fork.c:1205:24: sparse: sparse: incorrect type in
 initializer (different address spaces)

On 07.09.21 01:50, kernel test robot wrote:
> tree:   https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head:   4b93c544e90e2b28326182d31ee008eb80e02074
> commit: 35d7bdc86031a2c1ae05ac27dfa93b2acdcbaecc kernel/fork: factor out replacing the current MM exe_file
> date:   3 days ago
> config: i386-randconfig-s001-20210906 (attached as .config)
> compiler: gcc-9 (Debian 9.3.0-22) 9.3.0
> reproduce:
>          # 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
>          make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386
> 
> If you fix the issue, kindly add following tag as appropriate
> Reported-by: kernel test robot <lkp@...el.com>
> 
> 
> sparse warnings: (new ones prefixed by >>)
>     kernel/fork.c:1005:19: sparse: sparse: incorrect type in assignment (different address spaces) @@     expected struct task_struct [noderef] __rcu *owner @@     got struct task_struct *p @@
>     kernel/fork.c:1005:19: sparse:     expected struct task_struct [noderef] __rcu *owner
>     kernel/fork.c:1005:19: sparse:     got struct task_struct *p
>>> kernel/fork.c:1205:24: sparse: sparse: incorrect type in initializer (different address spaces) @@     expected struct file [noderef] __rcu *__ret @@     got struct file *new_exe_file @@
>     kernel/fork.c:1205:24: sparse:     expected struct file [noderef] __rcu *__ret
>     kernel/fork.c:1205:24: sparse:     got struct file *new_exe_file
>     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] __ret @@
>     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] __ret
>     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 * @@
>     kernel/fork.c:2287:32: sparse:     expected struct task_struct [noderef] __rcu *real_parent
>     kernel/fork.c:2287:32: sparse:     got struct task_struct *
>     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: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/x86/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
>     kernel/fork.c:997:23: sparse: sparse: incompatible types in comparison expression (different address spaces):
>     kernel/fork.c:997:23: sparse:    struct task_struct [noderef] __rcu *
>     kernel/fork.c:997:23: sparse:    struct task_struct *
> 
> 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	

Looks like we can happily ignore this report.


-- 
Thanks,

David / dhildenb

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ