arch/arc/kernel/signal.c:77:31: sparse: sparse: incorrect type in argument 1 (different address spaces)
From: kernel test robot
Date: Fri Dec 08 2023 - 10:41:07 EST
tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
head: 5e3f5b81de80c98338bcb47c233aebefee5a4801
commit: 96f1b00138cb8f04c742c82d0a7c460b2202e887 ARCv2: save ABI registers across signal handling
date: 2 years, 6 months ago
config: arc-randconfig-r111-20231107 (https://download.01.org/0day-ci/archive/20231208/202312082320.VDN5A9hb-lkp@xxxxxxxxx/config)
compiler: arceb-elf-gcc (GCC) 13.2.0
reproduce: (https://download.01.org/0day-ci/archive/20231208/202312082320.VDN5A9hb-lkp@xxxxxxxxx/reproduce)
If you fix the issue in a separate patch/commit (i.e. not just a new version of
the same patch/commit), kindly add following tags
| Reported-by: kernel test robot <lkp@xxxxxxxxx>
| Closes: https://lore.kernel.org/oe-kbuild-all/202312082320.VDN5A9hb-lkp@xxxxxxxxx/
sparse warnings: (new ones prefixed by >>)
>> arch/arc/kernel/signal.c:77:31: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected void [noderef] __user *to @@ got struct user_regs_arcv2 * @@
arch/arc/kernel/signal.c:77:31: sparse: expected void [noderef] __user *to
arch/arc/kernel/signal.c:77:31: sparse: got struct user_regs_arcv2 *
>> arch/arc/kernel/signal.c:88:41: sparse: sparse: incorrect type in argument 2 (different address spaces) @@ expected void const [noderef] __user *from @@ got struct user_regs_arcv2 * @@
arch/arc/kernel/signal.c:88:41: sparse: expected void const [noderef] __user *from
arch/arc/kernel/signal.c:88:41: sparse: got struct user_regs_arcv2 *
>> arch/arc/kernel/signal.c:134:42: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct sigcontext *mctx @@ got struct sigcontext [noderef] __user * @@
arch/arc/kernel/signal.c:134:42: sparse: expected struct sigcontext *mctx
arch/arc/kernel/signal.c:134:42: sparse: got struct sigcontext [noderef] __user *
arch/arc/kernel/signal.c:153:45: sparse: sparse: incorrect type in argument 1 (different address spaces) @@ expected struct sigcontext *mctx @@ got struct sigcontext [noderef] __user * @@
arch/arc/kernel/signal.c:153:45: sparse: expected struct sigcontext *mctx
arch/arc/kernel/signal.c:153:45: sparse: got struct sigcontext [noderef] __user *
vim +77 arch/arc/kernel/signal.c
63
64 static int save_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
65 {
66 int err = 0;
67 #ifndef CONFIG_ISA_ARCOMPACT
68 struct user_regs_arcv2 v2abi;
69
70 v2abi.r30 = regs->r30;
71 #ifdef CONFIG_ARC_HAS_ACCL_REGS
72 v2abi.r58 = regs->r58;
73 v2abi.r59 = regs->r59;
74 #else
75 v2abi.r58 = v2abi.r59 = 0;
76 #endif
> 77 err = __copy_to_user(&mctx->v2abi, &v2abi, sizeof(v2abi));
78 #endif
79 return err;
80 }
81
82 static int restore_arcv2_regs(struct sigcontext *mctx, struct pt_regs *regs)
83 {
84 int err = 0;
85 #ifndef CONFIG_ISA_ARCOMPACT
86 struct user_regs_arcv2 v2abi;
87
> 88 err = __copy_from_user(&v2abi, &mctx->v2abi, sizeof(v2abi));
89
90 regs->r30 = v2abi.r30;
91 #ifdef CONFIG_ARC_HAS_ACCL_REGS
92 regs->r58 = v2abi.r58;
93 regs->r59 = v2abi.r59;
94 #endif
95 #endif
96 return err;
97 }
98
99 static int
100 stash_usr_regs(struct rt_sigframe __user *sf, struct pt_regs *regs,
101 sigset_t *set)
102 {
103 int err;
104 struct user_regs_struct uregs;
105
106 uregs.scratch.bta = regs->bta;
107 uregs.scratch.lp_start = regs->lp_start;
108 uregs.scratch.lp_end = regs->lp_end;
109 uregs.scratch.lp_count = regs->lp_count;
110 uregs.scratch.status32 = regs->status32;
111 uregs.scratch.ret = regs->ret;
112 uregs.scratch.blink = regs->blink;
113 uregs.scratch.fp = regs->fp;
114 uregs.scratch.gp = regs->r26;
115 uregs.scratch.r12 = regs->r12;
116 uregs.scratch.r11 = regs->r11;
117 uregs.scratch.r10 = regs->r10;
118 uregs.scratch.r9 = regs->r9;
119 uregs.scratch.r8 = regs->r8;
120 uregs.scratch.r7 = regs->r7;
121 uregs.scratch.r6 = regs->r6;
122 uregs.scratch.r5 = regs->r5;
123 uregs.scratch.r4 = regs->r4;
124 uregs.scratch.r3 = regs->r3;
125 uregs.scratch.r2 = regs->r2;
126 uregs.scratch.r1 = regs->r1;
127 uregs.scratch.r0 = regs->r0;
128 uregs.scratch.sp = regs->sp;
129
130 err = __copy_to_user(&(sf->uc.uc_mcontext.regs.scratch), &uregs.scratch,
131 sizeof(sf->uc.uc_mcontext.regs.scratch));
132
133 if (is_isa_arcv2())
> 134 err |= save_arcv2_regs(&(sf->uc.uc_mcontext), regs);
135
136 err |= __copy_to_user(&sf->uc.uc_sigmask, set, sizeof(sigset_t));
137
138 return err ? -EFAULT : 0;
139 }
140
--
0-DAY CI Kernel Test Service
https://github.com/intel/lkp-tests/wiki