Re: [PATCH v4 04/45] x86: asm: instrument usercopy in get_user() and __put_user_size()

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi Alexander,

I love your patch! Perhaps something to improve:

[auto build test WARNING on masahiroy-kbuild/for-next]
[also build test WARNING on linus/master v5.19-rc4 next-20220701]
[cannot apply to tip/x86/core tip/x86/mm]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/intel-lab-lkp/linux/commits/Alexander-Potapenko/Add-KernelMemorySanitizer-infrastructure/20220701-222712
base:   https://git.kernel.org/pub/scm/linux/kernel/git/masahiroy/linux-kbuild.git for-next
config: i386-randconfig-s002 (https://download.01.org/0day-ci/archive/20220702/202207021129.palrTLrL-lkp@xxxxxxxxx/config)
compiler: gcc-11 (Debian 11.3.0-3) 11.3.0
reproduce:
        # apt-get install sparse
        # sparse version: v0.6.4-39-gce1a6720-dirty
        # https://github.com/intel-lab-lkp/linux/commit/0ca0e4029535365a65588446ba55a952ca186079
        git remote add linux-review https://github.com/intel-lab-lkp/linux
        git fetch --no-tags linux-review Alexander-Potapenko/Add-KernelMemorySanitizer-infrastructure/20220701-222712
        git checkout 0ca0e4029535365a65588446ba55a952ca186079
        # save the config file
        mkdir build_dir && cp config build_dir/.config
        make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' O=build_dir ARCH=i386 SHELL=/bin/bash arch/x86/kernel/ mm/

If you fix the issue, kindly add following tag where applicable
Reported-by: kernel test robot <lkp@xxxxxxxxx>


sparse warnings: (new ones prefixed by >>)
   arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:360:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got unsigned long long [usertype] * @@
   arch/x86/kernel/signal.c:360:9: sparse:     expected void const volatile [noderef] __user *ptr
   arch/x86/kernel/signal.c:360:9: sparse:     got unsigned long long [usertype] *
   arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
>> arch/x86/kernel/signal.c:360:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got unsigned long long [usertype] * @@
   arch/x86/kernel/signal.c:360:9: sparse:     expected void [noderef] __user *to
   arch/x86/kernel/signal.c:360:9: sparse:     got unsigned long long [usertype] *
   arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:360:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:420:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void const volatile [noderef] __user *ptr @@     got unsigned long long [usertype] * @@
   arch/x86/kernel/signal.c:420:9: sparse:     expected void const volatile [noderef] __user *ptr
   arch/x86/kernel/signal.c:420:9: sparse:     got unsigned long long [usertype] *
   arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:420:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected void [noderef] __user *to @@     got unsigned long long [usertype] * @@
   arch/x86/kernel/signal.c:420:9: sparse:     expected void [noderef] __user *to
   arch/x86/kernel/signal.c:420:9: sparse:     got unsigned long long [usertype] *
   arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:420:9: sparse: sparse: cast removes address space '__user' of expression
   arch/x86/kernel/signal.c:953:9: sparse: sparse: incorrect type in argument 1 (different address spaces) @@     expected struct lockdep_map const *lock @@     got struct lockdep_map [noderef] __rcu * @@
   arch/x86/kernel/signal.c:953:9: sparse:     expected struct lockdep_map const *lock
   arch/x86/kernel/signal.c:953:9: sparse:     got struct lockdep_map [noderef] __rcu *

vim +360 arch/x86/kernel/signal.c

75779f05264b996 arch/x86/kernel/signal.c    Hiroshi Shimamoto 2009-02-27  325  
7e907f48980d666 arch/x86/kernel/signal_32.c Ingo Molnar       2008-03-06  326  static int
235b80226b986da arch/x86/kernel/signal.c    Al Viro           2012-11-09  327  __setup_frame(int sig, struct ksignal *ksig, sigset_t *set,
7e907f48980d666 arch/x86/kernel/signal_32.c Ingo Molnar       2008-03-06  328  	      struct pt_regs *regs)
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  329  {
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  330  	struct sigframe __user *frame;
7e907f48980d666 arch/x86/kernel/signal_32.c Ingo Molnar       2008-03-06  331  	void __user *restorer;
b00d8f8f0b2b392 arch/x86/kernel/signal.c    Al Viro           2020-02-15  332  	void __user *fp = NULL;
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  333  
b00d8f8f0b2b392 arch/x86/kernel/signal.c    Al Viro           2020-02-15  334  	frame = get_sigframe(&ksig->ka, regs, sizeof(*frame), &fp);
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  335  
5c1f178094631e8 arch/x86/kernel/signal.c    Al Viro           2020-02-15  336  	if (!user_access_begin(frame, sizeof(*frame)))
3d0aedd9538e6be arch/x86/kernel/signal_32.c Hiroshi Shimamoto 2008-09-12  337  		return -EFAULT;
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  338  
5c1f178094631e8 arch/x86/kernel/signal.c    Al Viro           2020-02-15  339  	unsafe_put_user(sig, &frame->sig, Efault);
b00d8f8f0b2b392 arch/x86/kernel/signal.c    Al Viro           2020-02-15  340  	unsafe_put_sigcontext(&frame->sc, fp, regs, set, Efault);
5c1f178094631e8 arch/x86/kernel/signal.c    Al Viro           2020-02-15  341  	unsafe_put_user(set->sig[1], &frame->extramask[0], Efault);
1a3e4ca41c5a389 arch/x86/kernel/signal_32.c Roland McGrath    2008-04-09  342  	if (current->mm->context.vdso)
6f121e548f83674 arch/x86/kernel/signal.c    Andy Lutomirski   2014-05-05  343  		restorer = current->mm->context.vdso +
0a6d1fa0d2b48fb arch/x86/kernel/signal.c    Andy Lutomirski   2015-10-05  344  			vdso_image_32.sym___kernel_sigreturn;
9fbbd4dd17d0712 arch/i386/kernel/signal.c   Andi Kleen        2007-02-13  345  	else
ade1af77129dea6 arch/x86/kernel/signal_32.c Jan Engelhardt    2008-01-30  346  		restorer = &frame->retcode;
235b80226b986da arch/x86/kernel/signal.c    Al Viro           2012-11-09  347  	if (ksig->ka.sa.sa_flags & SA_RESTORER)
235b80226b986da arch/x86/kernel/signal.c    Al Viro           2012-11-09  348  		restorer = ksig->ka.sa.sa_restorer;
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  349  
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  350  	/* Set up to return from userspace.  */
5c1f178094631e8 arch/x86/kernel/signal.c    Al Viro           2020-02-15  351  	unsafe_put_user(restorer, &frame->pretcode, Efault);
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  352  
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  353  	/*
7e907f48980d666 arch/x86/kernel/signal_32.c Ingo Molnar       2008-03-06  354  	 * This is popl %eax ; movl $__NR_sigreturn, %eax ; int $0x80
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  355  	 *
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  356  	 * WE DO NOT USE IT ANY MORE! It's only left here for historical
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  357  	 * reasons and because gdb uses it as a signature to notice
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  358  	 * signal handler stack frames.
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  359  	 */
5c1f178094631e8 arch/x86/kernel/signal.c    Al Viro           2020-02-15 @360  	unsafe_put_user(*((u64 *)&retcode), (u64 *)frame->retcode, Efault);
5c1f178094631e8 arch/x86/kernel/signal.c    Al Viro           2020-02-15  361  	user_access_end();
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  362  
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  363  	/* Set up registers for signal handler */
65ea5b034990358 arch/x86/kernel/signal_32.c H. Peter Anvin    2008-01-30  364  	regs->sp = (unsigned long)frame;
235b80226b986da arch/x86/kernel/signal.c    Al Viro           2012-11-09  365  	regs->ip = (unsigned long)ksig->ka.sa.sa_handler;
65ea5b034990358 arch/x86/kernel/signal_32.c H. Peter Anvin    2008-01-30  366  	regs->ax = (unsigned long)sig;
92bc2056855b325 arch/x86/kernel/signal_32.c Harvey Harrison   2008-02-08  367  	regs->dx = 0;
92bc2056855b325 arch/x86/kernel/signal_32.c Harvey Harrison   2008-02-08  368  	regs->cx = 0;
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  369  
65ea5b034990358 arch/x86/kernel/signal_32.c H. Peter Anvin    2008-01-30  370  	regs->ds = __USER_DS;
65ea5b034990358 arch/x86/kernel/signal_32.c H. Peter Anvin    2008-01-30  371  	regs->es = __USER_DS;
65ea5b034990358 arch/x86/kernel/signal_32.c H. Peter Anvin    2008-01-30  372  	regs->ss = __USER_DS;
65ea5b034990358 arch/x86/kernel/signal_32.c H. Peter Anvin    2008-01-30  373  	regs->cs = __USER_CS;
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  374  
283828f3c19ceb3 arch/i386/kernel/signal.c   David Howells     2006-01-18  375  	return 0;
b00d8f8f0b2b392 arch/x86/kernel/signal.c    Al Viro           2020-02-15  376  
b00d8f8f0b2b392 arch/x86/kernel/signal.c    Al Viro           2020-02-15  377  Efault:
b00d8f8f0b2b392 arch/x86/kernel/signal.c    Al Viro           2020-02-15  378  	user_access_end();
b00d8f8f0b2b392 arch/x86/kernel/signal.c    Al Viro           2020-02-15  379  	return -EFAULT;
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  380  }
^1da177e4c3f415 arch/i386/kernel/signal.c   Linus Torvalds    2005-04-16  381  

-- 
0-DAY CI Kernel Test Service
https://01.org/lkp




[Index of Archives]     [Linux ARM Kernel]     [Linux ARM]     [Linux Omap]     [Fedora ARM]     [IETF Annouce]     [Bugtraq]     [Linux OMAP]     [Linux MIPS]     [eCos]     [Asterisk Internet PBX]     [Linux API]

  Powered by Linux