[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <202008281918.2rxxINLK%lkp@intel.com>
Date: Fri, 28 Aug 2020 19:37:50 +0800
From: kernel test robot <lkp@...el.com>
To: Luc Van Oostenryck <luc.vanoostenryck@...il.com>,
Miguel Ojeda <miguel.ojeda.sandonis@...il.com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org,
Luc Van Oostenryck <luc.vanoostenryck@...il.com>
Subject: Re: [PATCH] sparse: use static inline for __chk_{user,io}_ptr()
Hi Luc,
I love your patch! Perhaps something to improve:
[auto build test WARNING on 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5]
url: https://github.com/0day-ci/linux/commits/Luc-Van-Oostenryck/sparse-use-static-inline-for-__chk_-user-io-_ptr/20200828-165431
base: 9123e3a74ec7b934a4a099e98af6a61c2f80bbf5
config: arc-randconfig-s031-20200828 (attached as .config)
compiler: arceb-elf-gcc (GCC) 9.3.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.2-191-g10164920-dirty
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=arc
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 >>)
>> arch/arc/kernel/process.c:70:15: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got int *uaddr @@
>> arch/arc/kernel/process.c:70:15: sparse: expected void const volatile [noderef] __user *ptr
arch/arc/kernel/process.c:70:15: sparse: got int *uaddr
arch/arc/kernel/process.c:77:15: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void const volatile [noderef] __user *ptr @@ got int *uaddr @@
arch/arc/kernel/process.c:77:15: sparse: expected void const volatile [noderef] __user *ptr
arch/arc/kernel/process.c:77:15: sparse: got int *uaddr
# https://github.com/0day-ci/linux/commit/7d01c91ac34a64f0177bc6d058cc50e805f59102
git remote add linux-review https://github.com/0day-ci/linux
git fetch --no-tags linux-review Luc-Van-Oostenryck/sparse-use-static-inline-for-__chk_-user-io-_ptr/20200828-165431
git checkout 7d01c91ac34a64f0177bc6d058cc50e805f59102
vim +70 arch/arc/kernel/process.c
bf90e1eab682dcb Vineet Gupta 2013-01-18 45
91e040a79df73d3 Vineet Gupta 2016-10-20 46 SYSCALL_DEFINE3(arc_usr_cmpxchg, int *, uaddr, int, expected, int, new)
91e040a79df73d3 Vineet Gupta 2016-10-20 47 {
e6e335bf3a400bc Vineet Gupta 2016-11-07 48 struct pt_regs *regs = current_pt_regs();
e8708786d4fe21c Peter Zijlstra 2018-06-19 49 u32 uval;
e8708786d4fe21c Peter Zijlstra 2018-06-19 50 int ret;
91e040a79df73d3 Vineet Gupta 2016-10-20 51
91e040a79df73d3 Vineet Gupta 2016-10-20 52 /*
91e040a79df73d3 Vineet Gupta 2016-10-20 53 * This is only for old cores lacking LLOCK/SCOND, which by defintion
91e040a79df73d3 Vineet Gupta 2016-10-20 54 * can't possibly be SMP. Thus doesn't need to be SMP safe.
91e040a79df73d3 Vineet Gupta 2016-10-20 55 * And this also helps reduce the overhead for serializing in
91e040a79df73d3 Vineet Gupta 2016-10-20 56 * the UP case
91e040a79df73d3 Vineet Gupta 2016-10-20 57 */
91e040a79df73d3 Vineet Gupta 2016-10-20 58 WARN_ON_ONCE(IS_ENABLED(CONFIG_SMP));
91e040a79df73d3 Vineet Gupta 2016-10-20 59
e6e335bf3a400bc Vineet Gupta 2016-11-07 60 /* Z indicates to userspace if operation succeded */
e6e335bf3a400bc Vineet Gupta 2016-11-07 61 regs->status32 &= ~STATUS_Z_MASK;
e6e335bf3a400bc Vineet Gupta 2016-11-07 62
96d4f267e40f950 Linus Torvalds 2019-01-03 63 ret = access_ok(uaddr, sizeof(*uaddr));
e8708786d4fe21c Peter Zijlstra 2018-06-19 64 if (!ret)
e8708786d4fe21c Peter Zijlstra 2018-06-19 65 goto fail;
91e040a79df73d3 Vineet Gupta 2016-10-20 66
e8708786d4fe21c Peter Zijlstra 2018-06-19 67 again:
91e040a79df73d3 Vineet Gupta 2016-10-20 68 preempt_disable();
91e040a79df73d3 Vineet Gupta 2016-10-20 69
e8708786d4fe21c Peter Zijlstra 2018-06-19 @70 ret = __get_user(uval, uaddr);
e8708786d4fe21c Peter Zijlstra 2018-06-19 71 if (ret)
e8708786d4fe21c Peter Zijlstra 2018-06-19 72 goto fault;
e8708786d4fe21c Peter Zijlstra 2018-06-19 73
e8708786d4fe21c Peter Zijlstra 2018-06-19 74 if (uval != expected)
e8708786d4fe21c Peter Zijlstra 2018-06-19 75 goto out;
e8708786d4fe21c Peter Zijlstra 2018-06-19 76
e8708786d4fe21c Peter Zijlstra 2018-06-19 77 ret = __put_user(new, uaddr);
e8708786d4fe21c Peter Zijlstra 2018-06-19 78 if (ret)
e8708786d4fe21c Peter Zijlstra 2018-06-19 79 goto fault;
91e040a79df73d3 Vineet Gupta 2016-10-20 80
e6e335bf3a400bc Vineet Gupta 2016-11-07 81 regs->status32 |= STATUS_Z_MASK;
91e040a79df73d3 Vineet Gupta 2016-10-20 82
e8708786d4fe21c Peter Zijlstra 2018-06-19 83 out:
91e040a79df73d3 Vineet Gupta 2016-10-20 84 preempt_enable();
e6e335bf3a400bc Vineet Gupta 2016-11-07 85 return uval;
e8708786d4fe21c Peter Zijlstra 2018-06-19 86
e8708786d4fe21c Peter Zijlstra 2018-06-19 87 fault:
e8708786d4fe21c Peter Zijlstra 2018-06-19 88 preempt_enable();
e8708786d4fe21c Peter Zijlstra 2018-06-19 89
e8708786d4fe21c Peter Zijlstra 2018-06-19 90 if (unlikely(ret != -EFAULT))
e8708786d4fe21c Peter Zijlstra 2018-06-19 91 goto fail;
e8708786d4fe21c Peter Zijlstra 2018-06-19 92
d8ed45c5dcd455f Michel Lespinasse 2020-06-08 93 mmap_read_lock(current->mm);
64019a2e467a288 Peter Xu 2020-08-11 94 ret = fixup_user_fault(current->mm, (unsigned long) uaddr,
e8708786d4fe21c Peter Zijlstra 2018-06-19 95 FAULT_FLAG_WRITE, NULL);
d8ed45c5dcd455f Michel Lespinasse 2020-06-08 96 mmap_read_unlock(current->mm);
e8708786d4fe21c Peter Zijlstra 2018-06-19 97
e8708786d4fe21c Peter Zijlstra 2018-06-19 98 if (likely(!ret))
e8708786d4fe21c Peter Zijlstra 2018-06-19 99 goto again;
e8708786d4fe21c Peter Zijlstra 2018-06-19 100
e8708786d4fe21c Peter Zijlstra 2018-06-19 101 fail:
3cf5d076fb4d489 Eric W. Biederman 2019-05-23 102 force_sig(SIGSEGV);
e8708786d4fe21c Peter Zijlstra 2018-06-19 103 return ret;
91e040a79df73d3 Vineet Gupta 2016-10-20 104 }
91e040a79df73d3 Vineet Gupta 2016-10-20 105
---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Download attachment ".config.gz" of type "application/gzip" (30133 bytes)
Powered by blists - more mailing lists