On Wed, Jan 24, 2024 at 5:05 AM kernel test robot <lkp@xxxxxxxxx> wrote: > > tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git master > head: 8bf1262c53f50fa91fe15d01e5ef5629db55313c > commit: 12600c77ca2b2be6af4e00f83d250f54f9c81496 [1198/1678] mm: make vm_area_struct anon_name field RCU-safe > config: x86_64-randconfig-122-20240124 (https://download.01.org/0day-ci/archive/20240124/202401242108.sR7fhT8J-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/20240124/202401242108.sR7fhT8J-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/202401242108.sR7fhT8J-lkp@xxxxxxxxx/ > > sparse warnings: (new ones prefixed by >>) > kernel/fork.c:1240: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:1240:19: sparse: expected struct task_struct [noderef] __rcu *owner > kernel/fork.c:1240:19: sparse: got struct task_struct *p > kernel/fork.c:1803: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:1803:38: sparse: expected struct refcount_struct [usertype] *r > kernel/fork.c:1803:38: sparse: got struct refcount_struct [noderef] __rcu * > kernel/fork.c:1812:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@ > kernel/fork.c:1812:31: sparse: expected struct spinlock [usertype] *lock > kernel/fork.c:1812:31: sparse: got struct spinlock [noderef] __rcu * > kernel/fork.c:1813:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got struct k_sigaction [noderef] __rcu * @@ > kernel/fork.c:1813:9: sparse: expected void const * > kernel/fork.c:1813:9: sparse: got struct k_sigaction [noderef] __rcu * > kernel/fork.c:1813:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const * @@ got struct k_sigaction [noderef] __rcu * @@ > kernel/fork.c:1813:9: sparse: expected void const * > kernel/fork.c:1813:9: sparse: got struct k_sigaction [noderef] __rcu * > kernel/fork.c:1813:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *q @@ got struct k_sigaction [noderef] __rcu * @@ > kernel/fork.c:1813:9: sparse: expected void const *q > kernel/fork.c:1813:9: sparse: got struct k_sigaction [noderef] __rcu * > kernel/fork.c:1814:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@ > kernel/fork.c:1814:33: sparse: expected struct spinlock [usertype] *lock > kernel/fork.c:1814:33: sparse: got struct spinlock [noderef] __rcu * > kernel/fork.c:2316:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@ > kernel/fork.c:2316:31: sparse: expected struct spinlock [usertype] *lock > kernel/fork.c:2316:31: sparse: got struct spinlock [noderef] __rcu * > kernel/fork.c:2320:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@ > kernel/fork.c:2320:33: sparse: expected struct spinlock [usertype] *lock > kernel/fork.c:2320:33: sparse: got struct spinlock [noderef] __rcu * > kernel/fork.c:2631: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:2631:32: sparse: expected struct task_struct [noderef] __rcu *real_parent > kernel/fork.c:2631:32: sparse: got struct task_struct * > kernel/fork.c:2640:27: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@ > kernel/fork.c:2640:27: sparse: expected struct spinlock [usertype] *lock > kernel/fork.c:2640:27: sparse: got struct spinlock [noderef] __rcu * > kernel/fork.c:2689: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:2689:54: sparse: expected struct list_head *head > kernel/fork.c:2689:54: sparse: got struct list_head [noderef] __rcu * > kernel/fork.c:2709:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@ > kernel/fork.c:2709:29: sparse: expected struct spinlock [usertype] *lock > kernel/fork.c:2709:29: sparse: got struct spinlock [noderef] __rcu * > kernel/fork.c:2731:29: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@ > kernel/fork.c:2731:29: sparse: expected struct spinlock [usertype] *lock > kernel/fork.c:2731:29: sparse: got struct spinlock [noderef] __rcu * > kernel/fork.c:2758: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:2758:28: sparse: expected struct sighand_struct *sighand > kernel/fork.c:2758:28: sparse: got struct sighand_struct [noderef] __rcu *sighand > kernel/fork.c:2787:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@ > kernel/fork.c:2787:31: sparse: expected struct spinlock [usertype] *lock > kernel/fork.c:2787:31: sparse: got struct spinlock [noderef] __rcu * > kernel/fork.c:2789:33: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct spinlock [usertype] *lock @@ got struct spinlock [noderef] __rcu * @@ > kernel/fork.c:2789:33: sparse: expected struct spinlock [usertype] *lock > kernel/fork.c:2789:33: sparse: got struct spinlock [noderef] __rcu * > kernel/fork.c:3230: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:3230:24: sparse: expected struct task_struct *[assigned] parent > kernel/fork.c:3230:24: sparse: got struct task_struct [noderef] __rcu *real_parent > kernel/fork.c:3318: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:3318:43: sparse: expected struct refcount_struct const [usertype] *r > kernel/fork.c:3318:43: sparse: got struct refcount_struct [noderef] __rcu * > kernel/fork.c: note: in included file: > >> include/linux/mm_inline.h:401:30: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct anon_vma_name *anon_name @@ got struct anon_vma_name [noderef] __rcu *anon_name @@ > include/linux/mm_inline.h:401:30: sparse: expected struct anon_vma_name *anon_name > include/linux/mm_inline.h:401:30: sparse: got struct anon_vma_name [noderef] __rcu *anon_name > kernel/fork.c:1908:9: sparse: sparse: dereference of noderef expression > kernel/fork.c:2366: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:210: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:210:45: sparse: expected struct task_struct *new_parent > include/linux/ptrace.h:210:45: sparse: got struct task_struct [noderef] __rcu *parent > include/linux/ptrace.h:210: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:210:62: sparse: expected struct cred const *ptracer_cred > include/linux/ptrace.h:210:62: sparse: got struct cred const [noderef] __rcu *ptracer_cred > kernel/fork.c:2687:59: sparse: sparse: dereference of noderef expression > kernel/fork.c:2688:59: sparse: sparse: dereference of noderef expression > kernel/fork.c:1232:23: sparse: sparse: incompatible types in comparison expression (different address spaces): > kernel/fork.c:1232:23: sparse: struct task_struct [noderef] __rcu * > kernel/fork.c:1232:23: sparse: struct task_struct * > -- > >> mm/madvise.c:133:19: sparse: sparse: incorrect type in assignment (different address spaces) @@ expected struct anon_vma_name [noderef] __rcu *anon_name @@ got struct anon_vma_name * @@ > mm/madvise.c:133:19: sparse: expected struct anon_vma_name [noderef] __rcu *anon_name > mm/madvise.c:133:19: sparse: got struct anon_vma_name * > >> mm/madvise.c:137:13: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct kref *kref @@ got struct kref [noderef] __rcu * @@ > mm/madvise.c:137:13: sparse: expected struct kref *kref > mm/madvise.c:137:13: sparse: got struct kref [noderef] __rcu * > >> mm/madvise.c:140:16: sparse: sparse: incorrect type in return expression (different address spaces) @@ expected struct anon_vma_name * @@ got struct anon_vma_name [noderef] __rcu *anon_name @@ Ah, I should use rcu_assign_pointer/rcu_access_pointer/rcu_dereference with vma->anon_name now. Will fix it in the next version. > mm/madvise.c:140:16: sparse: expected struct anon_vma_name * > mm/madvise.c:140:16: sparse: got struct anon_vma_name [noderef] __rcu *anon_name > mm/madvise.c: note: in included file (through include/linux/smp.h, include/linux/lockdep.h, include/linux/spinlock.h, ...): > include/linux/list.h:83:21: sparse: sparse: self-comparison always evaluates to true > mm/madvise.c: note: in included file (through include/linux/rbtree.h, include/linux/mm_types.h, include/linux/mmzone.h, ...): > include/linux/rcupdate.h:781:9: sparse: sparse: context imbalance in 'madvise_cold_or_pageout_pte_range' - unexpected unlock > include/linux/rcupdate.h:781:9: sparse: sparse: context imbalance in 'madvise_free_pte_range' - unexpected unlock > > vim +401 include/linux/mm_inline.h > > 17fca131cee217 Arnd Bergmann 2022-01-14 394 > 5c26f6ac9416b6 Suren Baghdasaryan 2022-03-04 395 static inline void free_anon_vma_name(struct vm_area_struct *vma) > 5c26f6ac9416b6 Suren Baghdasaryan 2022-03-04 396 { > 17fca131cee217 Arnd Bergmann 2022-01-14 397 /* > 5c26f6ac9416b6 Suren Baghdasaryan 2022-03-04 398 * Not using anon_vma_name because it generates a warning if mmap_lock > 5c26f6ac9416b6 Suren Baghdasaryan 2022-03-04 399 * is not held, which might be the case here. > 17fca131cee217 Arnd Bergmann 2022-01-14 400 */ > 5c26f6ac9416b6 Suren Baghdasaryan 2022-03-04 @401 anon_vma_name_put(vma->anon_name); > 5c26f6ac9416b6 Suren Baghdasaryan 2022-03-04 402 } > 17fca131cee217 Arnd Bergmann 2022-01-14 403 > > :::::: The code at line 401 was first introduced by commit > :::::: 5c26f6ac9416b63d093e29c30e79b3297e425472 mm: refactor vm_area_struct::anon_vma_name usage code > > :::::: TO: Suren Baghdasaryan <surenb@xxxxxxxxxx> > :::::: CC: Linus Torvalds <torvalds@xxxxxxxxxxxxxxxxxxxx> > > -- > 0-DAY CI Kernel Test Service > https://github.com/intel/lkp-tests/wiki