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

From: kernel test robot
Date: Fri Aug 28 2020 - 11:13:06 EST


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: i386-randconfig-s002-20200828 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-15) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.2-191-g10164920-dirty
# save the attached .config to linux build tree
make W=1 C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=i386

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

# 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 +338 arch/x86/kernel/signal.c

75779f05264b996 arch/x86/kernel/signal.c Hiroshi Shimamoto 2009-02-27 303
7e907f48980d666 arch/x86/kernel/signal_32.c Ingo Molnar 2008-03-06 304 static int
235b80226b986da arch/x86/kernel/signal.c Al Viro 2012-11-09 305 __setup_frame(int sig, struct ksignal *ksig, sigset_t *set,
7e907f48980d666 arch/x86/kernel/signal_32.c Ingo Molnar 2008-03-06 306 struct pt_regs *regs)
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 307 {
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 308 struct sigframe __user *frame;
7e907f48980d666 arch/x86/kernel/signal_32.c Ingo Molnar 2008-03-06 309 void __user *restorer;
b00d8f8f0b2b392 arch/x86/kernel/signal.c Al Viro 2020-02-15 310 void __user *fp = NULL;
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 311
b00d8f8f0b2b392 arch/x86/kernel/signal.c Al Viro 2020-02-15 312 frame = get_sigframe(&ksig->ka, regs, sizeof(*frame), &fp);
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 313
5c1f178094631e8 arch/x86/kernel/signal.c Al Viro 2020-02-15 314 if (!user_access_begin(frame, sizeof(*frame)))
3d0aedd9538e6be arch/x86/kernel/signal_32.c Hiroshi Shimamoto 2008-09-12 315 return -EFAULT;
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 316
5c1f178094631e8 arch/x86/kernel/signal.c Al Viro 2020-02-15 317 unsafe_put_user(sig, &frame->sig, Efault);
b00d8f8f0b2b392 arch/x86/kernel/signal.c Al Viro 2020-02-15 318 unsafe_put_sigcontext(&frame->sc, fp, regs, set, Efault);
5c1f178094631e8 arch/x86/kernel/signal.c Al Viro 2020-02-15 319 unsafe_put_user(set->sig[1], &frame->extramask[0], Efault);
1a3e4ca41c5a389 arch/x86/kernel/signal_32.c Roland McGrath 2008-04-09 320 if (current->mm->context.vdso)
6f121e548f83674 arch/x86/kernel/signal.c Andy Lutomirski 2014-05-05 321 restorer = current->mm->context.vdso +
0a6d1fa0d2b48fb arch/x86/kernel/signal.c Andy Lutomirski 2015-10-05 322 vdso_image_32.sym___kernel_sigreturn;
9fbbd4dd17d0712 arch/i386/kernel/signal.c Andi Kleen 2007-02-13 323 else
ade1af77129dea6 arch/x86/kernel/signal_32.c Jan Engelhardt 2008-01-30 324 restorer = &frame->retcode;
235b80226b986da arch/x86/kernel/signal.c Al Viro 2012-11-09 325 if (ksig->ka.sa.sa_flags & SA_RESTORER)
235b80226b986da arch/x86/kernel/signal.c Al Viro 2012-11-09 326 restorer = ksig->ka.sa.sa_restorer;
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 327
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 328 /* Set up to return from userspace. */
5c1f178094631e8 arch/x86/kernel/signal.c Al Viro 2020-02-15 329 unsafe_put_user(restorer, &frame->pretcode, Efault);
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 330
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 331 /*
7e907f48980d666 arch/x86/kernel/signal_32.c Ingo Molnar 2008-03-06 332 * This is popl %eax ; movl $__NR_sigreturn, %eax ; int $0x80
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 333 *
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 334 * 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 335 * reasons and because gdb uses it as a signature to notice
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 336 * signal handler stack frames.
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 337 */
5c1f178094631e8 arch/x86/kernel/signal.c Al Viro 2020-02-15 @338 unsafe_put_user(*((u64 *)&retcode), (u64 *)frame->retcode, Efault);
5c1f178094631e8 arch/x86/kernel/signal.c Al Viro 2020-02-15 339 user_access_end();
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 340
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 341 /* Set up registers for signal handler */
65ea5b034990358 arch/x86/kernel/signal_32.c H. Peter Anvin 2008-01-30 342 regs->sp = (unsigned long)frame;
235b80226b986da arch/x86/kernel/signal.c Al Viro 2012-11-09 343 regs->ip = (unsigned long)ksig->ka.sa.sa_handler;
65ea5b034990358 arch/x86/kernel/signal_32.c H. Peter Anvin 2008-01-30 344 regs->ax = (unsigned long)sig;
92bc2056855b325 arch/x86/kernel/signal_32.c Harvey Harrison 2008-02-08 345 regs->dx = 0;
92bc2056855b325 arch/x86/kernel/signal_32.c Harvey Harrison 2008-02-08 346 regs->cx = 0;
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 347
65ea5b034990358 arch/x86/kernel/signal_32.c H. Peter Anvin 2008-01-30 348 regs->ds = __USER_DS;
65ea5b034990358 arch/x86/kernel/signal_32.c H. Peter Anvin 2008-01-30 349 regs->es = __USER_DS;
65ea5b034990358 arch/x86/kernel/signal_32.c H. Peter Anvin 2008-01-30 350 regs->ss = __USER_DS;
65ea5b034990358 arch/x86/kernel/signal_32.c H. Peter Anvin 2008-01-30 351 regs->cs = __USER_CS;
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 352
283828f3c19ceb3 arch/i386/kernel/signal.c David Howells 2006-01-18 353 return 0;
b00d8f8f0b2b392 arch/x86/kernel/signal.c Al Viro 2020-02-15 354
b00d8f8f0b2b392 arch/x86/kernel/signal.c Al Viro 2020-02-15 355 Efault:
b00d8f8f0b2b392 arch/x86/kernel/signal.c Al Viro 2020-02-15 356 user_access_end();
b00d8f8f0b2b392 arch/x86/kernel/signal.c Al Viro 2020-02-15 357 return -EFAULT;
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 358 }
^1da177e4c3f415 arch/i386/kernel/signal.c Linus Torvalds 2005-04-16 359

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

Attachment: .config.gz
Description: application/gzip