Re: [RESEND PATCH] sparse: use static inline for __chk_{user,io}_ptr()

From: kernel test robot
Date: Thu Aug 06 2020 - 18:39:20 EST


Hi Luc,

I love your patch! Perhaps something to improve:

[auto build test WARNING on hnaz-linux-mm/master]
[also build test WARNING on next-20200806]
[cannot apply to linux/master linus/master v5.8]
[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/0day-ci/linux/commits/Luc-Van-Oostenryck/sparse-use-static-inline-for-__chk_-user-io-_ptr/20200807-034410
base: https://github.com/hnaz/linux-mm master
config: x86_64-randconfig-s022-20200805 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-117-g8c7aee71-dirty
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=x86_64

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


sparse warnings: (new ones prefixed by >>)

arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
>> arch/x86/ia32/ia32_signal.c:350: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/ia32/ia32_signal.c:350:9: sparse: expected void const volatile [noderef] __user *ptr
arch/x86/ia32/ia32_signal.c:350:9: sparse: got unsigned long long [usertype] *
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression
arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: cast removes address space '__user' of expression

vim +350 arch/x86/ia32/ia32_signal.c

^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds 2005-04-16 299
235b80226b986d arch/x86/ia32/ia32_signal.c Al Viro 2012-11-09 300 int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds 2005-04-16 301 compat_sigset_t *set, struct pt_regs *regs)
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds 2005-04-16 302 {
3b0d29ee1c73b6 arch/x86/ia32/ia32_signal.c Hiroshi Shimamoto 2008-12-17 303 struct rt_sigframe_ia32 __user *frame;
af65d64845a90c arch/x86/ia32/ia32_signal.c Roland McGrath 2008-01-30 304 void __user *restorer;
44a1d996325982 arch/x86/ia32/ia32_signal.c Al Viro 2020-02-15 305 void __user *fp = NULL;
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds 2005-04-16 306
57d563c8292569 arch/x86/ia32/ia32_signal.c Al Viro 2020-02-15 307 /* unsafe_put_user optimizes that into a single 8 byte store */
99b9cdf758af70 arch/x86/ia32/ia32_signal.c Thomas Gleixner 2008-01-30 308 static const struct {
99b9cdf758af70 arch/x86/ia32/ia32_signal.c Thomas Gleixner 2008-01-30 309 u8 movl;
99b9cdf758af70 arch/x86/ia32/ia32_signal.c Thomas Gleixner 2008-01-30 310 u32 val;
99b9cdf758af70 arch/x86/ia32/ia32_signal.c Thomas Gleixner 2008-01-30 311 u16 int80;
9cc3c49ed1b1db arch/x86/ia32/ia32_signal.c Hiroshi Shimamoto 2008-11-11 312 u8 pad;
99b9cdf758af70 arch/x86/ia32/ia32_signal.c Thomas Gleixner 2008-01-30 313 } __attribute__((packed)) code = {
99b9cdf758af70 arch/x86/ia32/ia32_signal.c Thomas Gleixner 2008-01-30 314 0xb8,
99b9cdf758af70 arch/x86/ia32/ia32_signal.c Thomas Gleixner 2008-01-30 315 __NR_ia32_rt_sigreturn,
99b9cdf758af70 arch/x86/ia32/ia32_signal.c Thomas Gleixner 2008-01-30 316 0x80cd,
99b9cdf758af70 arch/x86/ia32/ia32_signal.c Thomas Gleixner 2008-01-30 317 0,
99b9cdf758af70 arch/x86/ia32/ia32_signal.c Thomas Gleixner 2008-01-30 318 };
99b9cdf758af70 arch/x86/ia32/ia32_signal.c Thomas Gleixner 2008-01-30 319
44a1d996325982 arch/x86/ia32/ia32_signal.c Al Viro 2020-02-15 320 frame = get_sigframe(ksig, regs, sizeof(*frame), &fp);
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds 2005-04-16 321
39f16c1c0f14e9 arch/x86/ia32/ia32_signal.c Al Viro 2020-02-15 322 if (!user_access_begin(frame, sizeof(*frame)))
3d0aedd9538e6b arch/x86/ia32/ia32_signal.c Hiroshi Shimamoto 2008-09-12 323 return -EFAULT;
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds 2005-04-16 324
39f16c1c0f14e9 arch/x86/ia32/ia32_signal.c Al Viro 2020-02-15 325 unsafe_put_user(sig, &frame->sig, Efault);
39f16c1c0f14e9 arch/x86/ia32/ia32_signal.c Al Viro 2020-02-15 326 unsafe_put_user(ptr_to_compat(&frame->info), &frame->pinfo, Efault);
39f16c1c0f14e9 arch/x86/ia32/ia32_signal.c Al Viro 2020-02-15 327 unsafe_put_user(ptr_to_compat(&frame->uc), &frame->puc, Efault);
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds 2005-04-16 328
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds 2005-04-16 329 /* Create the ucontext. */
ff661350157266 arch/x86/ia32/ia32_signal.c Marco Elver 2019-07-11 330 if (static_cpu_has(X86_FEATURE_XSAVE))
39f16c1c0f14e9 arch/x86/ia32/ia32_signal.c Al Viro 2020-02-15 331 unsafe_put_user(UC_FP_XSTATE, &frame->uc.uc_flags, Efault);
c37b5efea43f9e arch/x86/ia32/ia32_signal.c Suresh Siddha 2008-07-29 332 else
39f16c1c0f14e9 arch/x86/ia32/ia32_signal.c Al Viro 2020-02-15 333 unsafe_put_user(0, &frame->uc.uc_flags, Efault);
39f16c1c0f14e9 arch/x86/ia32/ia32_signal.c Al Viro 2020-02-15 334 unsafe_put_user(0, &frame->uc.uc_link, Efault);
39f16c1c0f14e9 arch/x86/ia32/ia32_signal.c Al Viro 2020-02-15 335 unsafe_compat_save_altstack(&frame->uc.uc_stack, regs->sp, Efault);
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds 2005-04-16 336
235b80226b986d arch/x86/ia32/ia32_signal.c Al Viro 2012-11-09 337 if (ksig->ka.sa.sa_flags & SA_RESTORER)
235b80226b986d arch/x86/ia32/ia32_signal.c Al Viro 2012-11-09 338 restorer = ksig->ka.sa.sa_restorer;
af65d64845a90c arch/x86/ia32/ia32_signal.c Roland McGrath 2008-01-30 339 else
6f121e548f8367 arch/x86/ia32/ia32_signal.c Andy Lutomirski 2014-05-05 340 restorer = current->mm->context.vdso +
0a6d1fa0d2b48f arch/x86/ia32/ia32_signal.c Andy Lutomirski 2015-10-05 341 vdso_image_32.sym___kernel_rt_sigreturn;
39f16c1c0f14e9 arch/x86/ia32/ia32_signal.c Al Viro 2020-02-15 342 unsafe_put_user(ptr_to_compat(restorer), &frame->pretcode, Efault);
^1da177e4c3f41 arch/x86_64/ia32/ia32_signal.c Linus Torvalds 2005-04-16 343
99b9cdf758af70 arch/x86/ia32/ia32_signal.c Thomas Gleixner 2008-01-30 344 /*
99b9cdf758af70 arch/x86/ia32/ia32_signal.c Thomas Gleixner 2008-01-30 345 * Not actually used anymore, but left because some gdb
99b9cdf758af70 arch/x86/ia32/ia32_signal.c Thomas Gleixner 2008-01-30 346 * versions need it.
99b9cdf758af70 arch/x86/ia32/ia32_signal.c Thomas Gleixner 2008-01-30 347 */
39f16c1c0f14e9 arch/x86/ia32/ia32_signal.c Al Viro 2020-02-15 348 unsafe_put_user(*((u64 *)&code), (u64 __user *)frame->retcode, Efault);
44a1d996325982 arch/x86/ia32/ia32_signal.c Al Viro 2020-02-15 349 unsafe_put_sigcontext32(&frame->uc.uc_mcontext, fp, regs, set, Efault);
57d563c8292569 arch/x86/ia32/ia32_signal.c Al Viro 2020-02-15 @350 unsafe_put_user(*(__u64 *)set, (__u64 *)&frame->uc.uc_sigmask, Efault);

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@xxxxxxxxxxxx

Attachment: .config.gz
Description: application/gzip