[<prev] [next>] [day] [month] [year] [list]
Message-ID: <202111210147.PPOYp8wD-lkp@intel.com>
Date: Sun, 21 Nov 2021 01:47:51 +0800
From: kernel test robot <lkp@...el.com>
To: Mark Rutland <mark.rutland@....com>
Cc: kbuild-all@...ts.01.org, linux-kernel@...r.kernel.org
Subject: [mark:treewide/thread-flags 9/11]
arch/powerpc/kernel/interrupt.c:151:64: sparse: sparse: incorrect type in
argument 2 (different base types)
tree: https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git treewide/thread-flags
head: d5fcb79b14c4566888a8a85004a261a740260a02
commit: db22de8cb00a64b2dc2d24bed04b8b0aef40b015 [9/11] powerpc: avoid discarding flags in system_call_exception()
config: powerpc-randconfig-s031-20211118 (attached as .config)
compiler: powerpc-linux-gcc (GCC) 11.2.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.4-dirty
# https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git/commit/?id=db22de8cb00a64b2dc2d24bed04b8b0aef40b015
git remote add mark https://git.kernel.org/pub/scm/linux/kernel/git/mark/linux.git
git fetch --no-tags mark treewide/thread-flags
git checkout db22de8cb00a64b2dc2d24bed04b8b0aef40b015
# save the attached .config to linux build tree
COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-11.2.0 make.cross C=1 CF='-fdiagnostic-prefix -D__CHECK_ENDIAN__' ARCH=powerpc
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/powerpc/kernel/interrupt.c:151:64: sparse: sparse: incorrect type in argument 2 (different base types) @@ expected unsigned long volatile *_p @@ got unsigned long flags @@
arch/powerpc/kernel/interrupt.c:151:64: sparse: expected unsigned long volatile *_p
arch/powerpc/kernel/interrupt.c:151:64: sparse: got unsigned long flags
vim +151 arch/powerpc/kernel/interrupt.c
76
77 /* Has to run notrace because it is entered not completely "reconciled" */
78 notrace long system_call_exception(long r3, long r4, long r5,
79 long r6, long r7, long r8,
80 unsigned long r0, struct pt_regs *regs)
81 {
82 syscall_fn f;
83
84 kuep_lock();
85
86 regs->orig_gpr3 = r3;
87
88 if (IS_ENABLED(CONFIG_PPC_IRQ_SOFT_MASK_DEBUG))
89 BUG_ON(irq_soft_mask_return() != IRQS_ALL_DISABLED);
90
91 trace_hardirqs_off(); /* finish reconciling */
92
93 CT_WARN_ON(ct_state() == CONTEXT_KERNEL);
94 user_exit_irqoff();
95
96 BUG_ON(regs_is_unrecoverable(regs));
97 BUG_ON(!(regs->msr & MSR_PR));
98 BUG_ON(arch_irq_disabled_regs(regs));
99
100 #ifdef CONFIG_PPC_PKEY
101 if (mmu_has_feature(MMU_FTR_PKEY)) {
102 unsigned long amr, iamr;
103 bool flush_needed = false;
104 /*
105 * When entering from userspace we mostly have the AMR/IAMR
106 * different from kernel default values. Hence don't compare.
107 */
108 amr = mfspr(SPRN_AMR);
109 iamr = mfspr(SPRN_IAMR);
110 regs->amr = amr;
111 regs->iamr = iamr;
112 if (mmu_has_feature(MMU_FTR_BOOK3S_KUAP)) {
113 mtspr(SPRN_AMR, AMR_KUAP_BLOCKED);
114 flush_needed = true;
115 }
116 if (mmu_has_feature(MMU_FTR_BOOK3S_KUEP)) {
117 mtspr(SPRN_IAMR, AMR_KUEP_BLOCKED);
118 flush_needed = true;
119 }
120 if (flush_needed)
121 isync();
122 } else
123 #endif
124 kuap_assert_locked();
125
126 booke_restore_dbcr0();
127
128 account_cpu_user_entry();
129
130 account_stolen_time();
131
132 /*
133 * This is not required for the syscall exit path, but makes the
134 * stack frame look nicer. If this was initialised in the first stack
135 * frame, or if the unwinder was taught the first stack frame always
136 * returns to user with IRQS_ENABLED, this store could be avoided!
137 */
138 irq_soft_mask_regs_set_state(regs, IRQS_ENABLED);
139
140 /*
141 * If system call is called with TM active, set _TIF_RESTOREALL to
142 * prevent RFSCV being used to return to userspace, because POWER9
143 * TM implementation has problems with this instruction returning to
144 * transactional state. Final register values are not relevant because
145 * the transaction will be aborted upon return anyway. Or in the case
146 * of unsupported_scv SIGILL fault, the return state does not much
147 * matter because it's an edge case.
148 */
149 if (IS_ENABLED(CONFIG_PPC_TRANSACTIONAL_MEM) &&
150 unlikely(MSR_TM_TRANSACTIONAL(regs->msr)))
> 151 set_bits(_TIF_RESTOREALL, current_thread_info()->flags);
152
153 /*
154 * If the system call was made with a transaction active, doom it and
155 * return without performing the system call. Unless it was an
156 * unsupported scv vector, in which case it's treated like an illegal
157 * instruction.
158 */
159 #ifdef CONFIG_PPC_TRANSACTIONAL_MEM
160 if (unlikely(MSR_TM_TRANSACTIONAL(regs->msr)) &&
161 !trap_is_unsupported_scv(regs)) {
162 /* Enable TM in the kernel, and disable EE (for scv) */
163 hard_irq_disable();
164 mtmsr(mfmsr() | MSR_TM);
165
166 /* tabort, this dooms the transaction, nothing else */
167 asm volatile(".long 0x7c00071d | ((%0) << 16)"
168 :: "r"(TM_CAUSE_SYSCALL|TM_CAUSE_PERSISTENT));
169
170 /*
171 * Userspace will never see the return value. Execution will
172 * resume after the tbegin. of the aborted transaction with the
173 * checkpointed register state. A context switch could occur
174 * or signal delivered to the process before resuming the
175 * doomed transaction context, but that should all be handled
176 * as expected.
177 */
178 return -ENOSYS;
179 }
180 #endif // CONFIG_PPC_TRANSACTIONAL_MEM
181
182 local_irq_enable();
183
184 if (unlikely(current_thread_info()->flags & _TIF_SYSCALL_DOTRACE)) {
185 if (unlikely(trap_is_unsupported_scv(regs))) {
186 /* Unsupported scv vector */
187 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
188 return regs->gpr[3];
189 }
190 /*
191 * We use the return value of do_syscall_trace_enter() as the
192 * syscall number. If the syscall was rejected for any reason
193 * do_syscall_trace_enter() returns an invalid syscall number
194 * and the test against NR_syscalls will fail and the return
195 * value to be used is in regs->gpr[3].
196 */
197 r0 = do_syscall_trace_enter(regs);
198 if (unlikely(r0 >= NR_syscalls))
199 return regs->gpr[3];
200 r3 = regs->gpr[3];
201 r4 = regs->gpr[4];
202 r5 = regs->gpr[5];
203 r6 = regs->gpr[6];
204 r7 = regs->gpr[7];
205 r8 = regs->gpr[8];
206
207 } else if (unlikely(r0 >= NR_syscalls)) {
208 if (unlikely(trap_is_unsupported_scv(regs))) {
209 /* Unsupported scv vector */
210 _exception(SIGILL, regs, ILL_ILLOPC, regs->nip);
211 return regs->gpr[3];
212 }
213 return -ENOSYS;
214 }
215
216 /* May be faster to do array_index_nospec? */
217 barrier_nospec();
218
219 if (unlikely(is_compat_task())) {
220 f = (void *)compat_sys_call_table[r0];
221
222 r3 &= 0x00000000ffffffffULL;
223 r4 &= 0x00000000ffffffffULL;
224 r5 &= 0x00000000ffffffffULL;
225 r6 &= 0x00000000ffffffffULL;
226 r7 &= 0x00000000ffffffffULL;
227 r8 &= 0x00000000ffffffffULL;
228
229 } else {
230 f = (void *)sys_call_table[r0];
231 }
232
233 return f(r3, r4, r5, r6, r7, r8);
234 }
235
---
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" (34696 bytes)
Powered by blists - more mailing lists