[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202211160913.CWTEBsKD-lkp@intel.com>
Date: Wed, 16 Nov 2022 09:08:26 +0800
From: kernel test robot <lkp@...el.com>
To: Greg Ungerer <gerg@...ux-m68k.org>
Cc: oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org
Subject: fs/binfmt_elf_fdpic.c:980:41: sparse: sparse: incorrect type in
argument 1 (different address spaces)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 81e7cfa3a9eb4ba6993a9c71772fdab21bc5d870
commit: 782f4c5c44e7d99d89740e272dc5ff84052c036a m68knommu: allow elf_fdpic loader to be selected
date: 6 months ago
config: m68k-randconfig-s043-20221115
compiler: m68k-linux-gcc (GCC) 12.1.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-39-gce1a6720-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git/commit/?id=782f4c5c44e7d99d89740e272dc5ff84052c036a
git remote add linus https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
git fetch --no-tags linus master
git checkout 782f4c5c44e7d99d89740e272dc5ff84052c036a
# save the config file
mkdir build_dir && cp config build_dir/.config
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-12.1.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=m68k SHELL=/bin/bash
If you fix the issue, kindly add following tag where applicable
| Reported-by: kernel test robot <lkp@...el.com>
sparse warnings: (new ones prefixed by >>)
fs/binfmt_elf_fdpic.c:619:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:619:9: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:619:9: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:623:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:623:17: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:623:17: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:630:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:630:17: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:630:17: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:637:17: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:637:17: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:637:17: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:642:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:642:9: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:642:9: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:646:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:646:9: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:646:9: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:647:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:647:9: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:647:9: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:648:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:648:9: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:648:9: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:649:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:649:9: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:649:9: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:650:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:650:9: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:650:9: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:651:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:651:9: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:651:9: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:654:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:654:9: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:654:9: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:655:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:655:9: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:655:9: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:656:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:656:9: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:656:9: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:657:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:657:9: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:657:9: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:658:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:658:9: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:658:9: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:659:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:659:9: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:659:9: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:660:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:660:9: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:660:9: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:661:9: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const *from @@ got struct <noident> [noderef] __user * @@
fs/binfmt_elf_fdpic.c:661:9: sparse: expected void const *from
fs/binfmt_elf_fdpic.c:661:9: sparse: got struct <noident> [noderef] __user *
fs/binfmt_elf_fdpic.c:697:21: sparse: sparse: cast removes address space '__user' of expression
>> fs/binfmt_elf_fdpic.c:980:41: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __user *to @@ got void * @@
fs/binfmt_elf_fdpic.c:980:41: sparse: expected void [noderef] __user *to
fs/binfmt_elf_fdpic.c:980:41: sparse: got void *
fs/binfmt_elf_fdpic.c:1154:55: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __user *to @@ got void * @@
fs/binfmt_elf_fdpic.c:1154:55: sparse: expected void [noderef] __user *to
fs/binfmt_elf_fdpic.c:1154:55: sparse: got void *
fs/binfmt_elf_fdpic.c:619:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:619:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:623:17: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:623:17: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:630:17: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:630:17: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:637:17: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:637:17: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:642:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:642:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:646:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:646:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:647:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:647:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:648:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:648:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:649:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:649:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:650:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:650:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:651:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:651:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:654:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:654:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:655:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:655:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:656:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:656:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:657:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:657:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:658:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:658:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:659:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:659:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:660:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:660:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:661:9: sparse: sparse: dereference of noderef expression
fs/binfmt_elf_fdpic.c:661:9: sparse: sparse: dereference of noderef expression
vim +980 fs/binfmt_elf_fdpic.c
^1da177e4c3f41 Linus Torvalds 2005-04-16 918
^1da177e4c3f41 Linus Torvalds 2005-04-16 919 /*****************************************************************************/
^1da177e4c3f41 Linus Torvalds 2005-04-16 920 /*
^1da177e4c3f41 Linus Torvalds 2005-04-16 921 * map a file with constant displacement under uClinux
^1da177e4c3f41 Linus Torvalds 2005-04-16 922 */
^1da177e4c3f41 Linus Torvalds 2005-04-16 923 #ifndef CONFIG_MMU
8a2ab7f5df76b9 David Howells 2006-07-10 924 static int elf_fdpic_map_file_constdisp_on_uclinux(
8a2ab7f5df76b9 David Howells 2006-07-10 925 struct elf_fdpic_params *params,
^1da177e4c3f41 Linus Torvalds 2005-04-16 926 struct file *file,
^1da177e4c3f41 Linus Torvalds 2005-04-16 927 struct mm_struct *mm)
^1da177e4c3f41 Linus Torvalds 2005-04-16 928 {
^1da177e4c3f41 Linus Torvalds 2005-04-16 929 struct elf32_fdpic_loadseg *seg;
^1da177e4c3f41 Linus Torvalds 2005-04-16 930 struct elf32_phdr *phdr;
a4eec6a3dfb7a6 David Hildenbrand 2021-06-28 931 unsigned long load_addr, base = ULONG_MAX, top = 0, maddr = 0;
^1da177e4c3f41 Linus Torvalds 2005-04-16 932 int loop, ret;
^1da177e4c3f41 Linus Torvalds 2005-04-16 933
^1da177e4c3f41 Linus Torvalds 2005-04-16 934 load_addr = params->load_addr;
^1da177e4c3f41 Linus Torvalds 2005-04-16 935 seg = params->loadmap->segs;
^1da177e4c3f41 Linus Torvalds 2005-04-16 936
8a2ab7f5df76b9 David Howells 2006-07-10 937 /* determine the bounds of the contiguous overall allocation we must
8a2ab7f5df76b9 David Howells 2006-07-10 938 * make */
^1da177e4c3f41 Linus Torvalds 2005-04-16 939 phdr = params->phdrs;
^1da177e4c3f41 Linus Torvalds 2005-04-16 940 for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 941 if (params->phdrs[loop].p_type != PT_LOAD)
^1da177e4c3f41 Linus Torvalds 2005-04-16 942 continue;
^1da177e4c3f41 Linus Torvalds 2005-04-16 943
^1da177e4c3f41 Linus Torvalds 2005-04-16 944 if (base > phdr->p_vaddr)
^1da177e4c3f41 Linus Torvalds 2005-04-16 945 base = phdr->p_vaddr;
^1da177e4c3f41 Linus Torvalds 2005-04-16 946 if (top < phdr->p_vaddr + phdr->p_memsz)
^1da177e4c3f41 Linus Torvalds 2005-04-16 947 top = phdr->p_vaddr + phdr->p_memsz;
^1da177e4c3f41 Linus Torvalds 2005-04-16 948 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 949
^1da177e4c3f41 Linus Torvalds 2005-04-16 950 /* allocate one big anon block for everything */
6be5ceb02e98ea Linus Torvalds 2012-04-20 951 maddr = vm_mmap(NULL, load_addr, top - base,
a4eec6a3dfb7a6 David Hildenbrand 2021-06-28 952 PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE, 0);
8a2ab7f5df76b9 David Howells 2006-07-10 953 if (IS_ERR_VALUE(maddr))
^1da177e4c3f41 Linus Torvalds 2005-04-16 954 return (int) maddr;
^1da177e4c3f41 Linus Torvalds 2005-04-16 955
^1da177e4c3f41 Linus Torvalds 2005-04-16 956 if (load_addr != 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 957 load_addr += PAGE_ALIGN(top - base);
^1da177e4c3f41 Linus Torvalds 2005-04-16 958
^1da177e4c3f41 Linus Torvalds 2005-04-16 959 /* and then load the file segments into it */
^1da177e4c3f41 Linus Torvalds 2005-04-16 960 phdr = params->phdrs;
^1da177e4c3f41 Linus Torvalds 2005-04-16 961 for (loop = 0; loop < params->hdr.e_phnum; loop++, phdr++) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 962 if (params->phdrs[loop].p_type != PT_LOAD)
^1da177e4c3f41 Linus Torvalds 2005-04-16 963 continue;
^1da177e4c3f41 Linus Torvalds 2005-04-16 964
^1da177e4c3f41 Linus Torvalds 2005-04-16 965 seg->addr = maddr + (phdr->p_vaddr - base);
^1da177e4c3f41 Linus Torvalds 2005-04-16 966 seg->p_vaddr = phdr->p_vaddr;
^1da177e4c3f41 Linus Torvalds 2005-04-16 967 seg->p_memsz = phdr->p_memsz;
^1da177e4c3f41 Linus Torvalds 2005-04-16 968
3dc20cb282ec03 Al Viro 2013-04-13 969 ret = read_code(file, seg->addr, phdr->p_offset,
3dc20cb282ec03 Al Viro 2013-04-13 970 phdr->p_filesz);
^1da177e4c3f41 Linus Torvalds 2005-04-16 971 if (ret < 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 972 return ret;
^1da177e4c3f41 Linus Torvalds 2005-04-16 973
^1da177e4c3f41 Linus Torvalds 2005-04-16 974 /* map the ELF header address if in this segment */
^1da177e4c3f41 Linus Torvalds 2005-04-16 975 if (phdr->p_offset == 0)
^1da177e4c3f41 Linus Torvalds 2005-04-16 976 params->elfhdr_addr = seg->addr;
^1da177e4c3f41 Linus Torvalds 2005-04-16 977
^1da177e4c3f41 Linus Torvalds 2005-04-16 978 /* clear any space allocated but not loaded */
ab4ad55512e95b Mike Frysinger 2009-04-02 979 if (phdr->p_filesz < phdr->p_memsz) {
e30c7c3b306312 Takuya Yoshikawa 2010-06-01 @980 if (clear_user((void *) (seg->addr + phdr->p_filesz),
e30c7c3b306312 Takuya Yoshikawa 2010-06-01 981 phdr->p_memsz - phdr->p_filesz))
e30c7c3b306312 Takuya Yoshikawa 2010-06-01 982 return -EFAULT;
ab4ad55512e95b Mike Frysinger 2009-04-02 983 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 984
^1da177e4c3f41 Linus Torvalds 2005-04-16 985 if (mm) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 986 if (phdr->p_flags & PF_X) {
aa289b47231c95 David Howells 2007-03-23 987 if (!mm->start_code) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 988 mm->start_code = seg->addr;
aa289b47231c95 David Howells 2007-03-23 989 mm->end_code = seg->addr +
aa289b47231c95 David Howells 2007-03-23 990 phdr->p_memsz;
aa289b47231c95 David Howells 2007-03-23 991 }
8a2ab7f5df76b9 David Howells 2006-07-10 992 } else if (!mm->start_data) {
^1da177e4c3f41 Linus Torvalds 2005-04-16 993 mm->start_data = seg->addr;
^1da177e4c3f41 Linus Torvalds 2005-04-16 994 mm->end_data = seg->addr + phdr->p_memsz;
^1da177e4c3f41 Linus Torvalds 2005-04-16 995 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 996 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 997
^1da177e4c3f41 Linus Torvalds 2005-04-16 998 seg++;
^1da177e4c3f41 Linus Torvalds 2005-04-16 999 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1000
^1da177e4c3f41 Linus Torvalds 2005-04-16 1001 return 0;
8a2ab7f5df76b9 David Howells 2006-07-10 1002 }
^1da177e4c3f41 Linus Torvalds 2005-04-16 1003 #endif
^1da177e4c3f41 Linus Torvalds 2005-04-16 1004
:::::: The code at line 980 was first introduced by commit
:::::: e30c7c3b306312c157d67eedd6a01920518b756c binfmt_elf_fdpic: Fix clear_user() error handling
:::::: TO: Takuya Yoshikawa <yoshikawa.takuya@....ntt.co.jp>
:::::: CC: Linus Torvalds <torvalds@...ux-foundation.org>
--
0-DAY CI Kernel Test Service
https://01.org/lkp
View attachment "config" of type "text/plain" (101957 bytes)
Powered by blists - more mailing lists