arch/x86/ia32/ia32_signal.c:350:9: sparse: sparse: incorrect type in argument 1 (different address spaces)

From: kbuild test robot
Date: Thu May 28 2020 - 03:26:36 EST


tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: b0c3ba31be3e45a130e13b278cf3b90f69bda6f6
commit: 57d563c8292569f2849569853e846bf740df5032 x86: ia32_setup_rt_frame(): consolidate uaccess areas
date: 9 weeks ago
config: x86_64-randconfig-s022-20200528 (attached as .config)
compiler: gcc-9 (Debian 9.3.0-13) 9.3.0
reproduce:
# apt-get install sparse
# sparse version: v0.6.1-240-gf0fe1cd9-dirty
git checkout 57d563c8292569f2849569853e846bf740df5032
# save the attached .config to linux build tree
make W=1 C=1 ARCH=x86_64 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__'

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


sparse warnings: (new ones prefixed by >>)

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

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

299
300 int ia32_setup_rt_frame(int sig, struct ksignal *ksig,
301 compat_sigset_t *set, struct pt_regs *regs)
302 {
303 struct rt_sigframe_ia32 __user *frame;
304 void __user *restorer;
305 void __user *fp = NULL;
306
307 /* unsafe_put_user optimizes that into a single 8 byte store */
308 static const struct {
309 u8 movl;
310 u32 val;
311 u16 int80;
312 u8 pad;
313 } __attribute__((packed)) code = {
314 0xb8,
315 __NR_ia32_rt_sigreturn,
316 0x80cd,
317 0,
318 };
319
320 frame = get_sigframe(ksig, regs, sizeof(*frame), &fp);
321
322 if (!user_access_begin(frame, sizeof(*frame)))
323 return -EFAULT;
324
325 unsafe_put_user(sig, &frame->sig, Efault);
326 unsafe_put_user(ptr_to_compat(&frame->info), &frame->pinfo, Efault);
327 unsafe_put_user(ptr_to_compat(&frame->uc), &frame->puc, Efault);
328
329 /* Create the ucontext. */
330 if (static_cpu_has(X86_FEATURE_XSAVE))
331 unsafe_put_user(UC_FP_XSTATE, &frame->uc.uc_flags, Efault);
332 else
333 unsafe_put_user(0, &frame->uc.uc_flags, Efault);
334 unsafe_put_user(0, &frame->uc.uc_link, Efault);
335 unsafe_compat_save_altstack(&frame->uc.uc_stack, regs->sp, Efault);
336
337 if (ksig->ka.sa.sa_flags & SA_RESTORER)
338 restorer = ksig->ka.sa.sa_restorer;
339 else
340 restorer = current->mm->context.vdso +
341 vdso_image_32.sym___kernel_rt_sigreturn;
342 unsafe_put_user(ptr_to_compat(restorer), &frame->pretcode, Efault);
343
344 /*
345 * Not actually used anymore, but left because some gdb
346 * versions need it.
347 */
348 unsafe_put_user(*((u64 *)&code), (u64 __user *)frame->retcode, Efault);
349 unsafe_put_sigcontext32(&frame->uc.uc_mcontext, fp, regs, set, Efault);
> 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