.. | .. |
---|
| 1 | +// SPDX-License-Identifier: GPL-2.0-only |
---|
1 | 2 | /* |
---|
2 | 3 | * Based on arch/arm/kernel/signal.c |
---|
3 | 4 | * |
---|
4 | 5 | * Copyright (C) 1995-2009 Russell King |
---|
5 | 6 | * Copyright (C) 2012 ARM Ltd. |
---|
6 | 7 | * Modified by Will Deacon <will.deacon@arm.com> |
---|
7 | | - * |
---|
8 | | - * This program is free software; you can redistribute it and/or modify |
---|
9 | | - * it under the terms of the GNU General Public License version 2 as |
---|
10 | | - * published by the Free Software Foundation. |
---|
11 | | - * |
---|
12 | | - * This program is distributed in the hope that it will be useful, |
---|
13 | | - * but WITHOUT ANY WARRANTY; without even the implied warranty of |
---|
14 | | - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
---|
15 | | - * GNU General Public License for more details. |
---|
16 | | - * |
---|
17 | | - * You should have received a copy of the GNU General Public License |
---|
18 | | - * along with this program. If not, see <http://www.gnu.org/licenses/>. |
---|
19 | 8 | */ |
---|
20 | 9 | |
---|
21 | 10 | #include <linux/compat.h> |
---|
.. | .. |
---|
234 | 223 | err |= !valid_user_regs(®s->user_regs, current); |
---|
235 | 224 | |
---|
236 | 225 | aux = (struct compat_aux_sigframe __user *) sf->uc.uc_regspace; |
---|
237 | | - if (err == 0) |
---|
| 226 | + if (err == 0 && system_supports_fpsimd()) |
---|
238 | 227 | err |= compat_restore_vfp_context(&aux->vfp); |
---|
239 | 228 | |
---|
240 | 229 | return err; |
---|
.. | .. |
---|
258 | 247 | |
---|
259 | 248 | frame = (struct compat_sigframe __user *)regs->compat_sp; |
---|
260 | 249 | |
---|
261 | | - if (!access_ok(VERIFY_READ, frame, sizeof (*frame))) |
---|
| 250 | + if (!access_ok(frame, sizeof (*frame))) |
---|
262 | 251 | goto badframe; |
---|
263 | 252 | |
---|
264 | 253 | if (compat_restore_sigframe(regs, frame)) |
---|
.. | .. |
---|
289 | 278 | |
---|
290 | 279 | frame = (struct compat_rt_sigframe __user *)regs->compat_sp; |
---|
291 | 280 | |
---|
292 | | - if (!access_ok(VERIFY_READ, frame, sizeof (*frame))) |
---|
| 281 | + if (!access_ok(frame, sizeof (*frame))) |
---|
293 | 282 | goto badframe; |
---|
294 | 283 | |
---|
295 | 284 | if (compat_restore_sigframe(regs, &frame->sig)) |
---|
.. | .. |
---|
320 | 309 | /* |
---|
321 | 310 | * Check that we can actually write to the signal frame. |
---|
322 | 311 | */ |
---|
323 | | - if (!access_ok(VERIFY_WRITE, frame, framesize)) |
---|
| 312 | + if (!access_ok(frame, framesize)) |
---|
324 | 313 | frame = NULL; |
---|
325 | 314 | |
---|
326 | 315 | return frame; |
---|
.. | .. |
---|
353 | 342 | retcode = ptr_to_compat(ka->sa.sa_restorer); |
---|
354 | 343 | } else { |
---|
355 | 344 | /* Set up sigreturn pointer */ |
---|
356 | | -#ifdef CONFIG_COMPAT_VDSO |
---|
357 | | - void *vdso_base = current->mm->context.vdso; |
---|
358 | | - void *vdso_trampoline; |
---|
359 | | - |
---|
360 | | - if (ka->sa.sa_flags & SA_SIGINFO) { |
---|
361 | | - if (thumb) { |
---|
362 | | - vdso_trampoline = VDSO_SYMBOL(vdso_base, |
---|
363 | | - compat_rt_sigreturn_thumb); |
---|
364 | | - } else { |
---|
365 | | - vdso_trampoline = VDSO_SYMBOL(vdso_base, |
---|
366 | | - compat_rt_sigreturn_arm); |
---|
367 | | - } |
---|
368 | | - } else { |
---|
369 | | - if (thumb) { |
---|
370 | | - vdso_trampoline = VDSO_SYMBOL(vdso_base, |
---|
371 | | - compat_sigreturn_thumb); |
---|
372 | | - } else { |
---|
373 | | - vdso_trampoline = VDSO_SYMBOL(vdso_base, |
---|
374 | | - compat_sigreturn_arm); |
---|
375 | | - } |
---|
376 | | - } |
---|
377 | | - |
---|
378 | | - retcode = ptr_to_compat(vdso_trampoline) + thumb; |
---|
379 | | -#else |
---|
380 | 345 | unsigned int idx = thumb << 1; |
---|
381 | 346 | |
---|
382 | 347 | if (ka->sa.sa_flags & SA_SIGINFO) |
---|
383 | 348 | idx += 3; |
---|
384 | 349 | |
---|
385 | | - retcode = (unsigned long)current->mm->context.vdso + |
---|
| 350 | + retcode = (unsigned long)current->mm->context.sigpage + |
---|
386 | 351 | (idx << 2) + thumb; |
---|
387 | | -#endif |
---|
388 | 352 | } |
---|
389 | 353 | |
---|
390 | 354 | regs->regs[0] = usig; |
---|
.. | .. |
---|
430 | 394 | |
---|
431 | 395 | aux = (struct compat_aux_sigframe __user *) sf->uc.uc_regspace; |
---|
432 | 396 | |
---|
433 | | - if (err == 0) |
---|
| 397 | + if (err == 0 && system_supports_fpsimd()) |
---|
434 | 398 | err |= compat_preserve_vfp_context(&aux->vfp); |
---|
435 | 399 | __put_user_error(0, &aux->end_magic, err); |
---|
436 | 400 | |
---|