forked from ~ljy/RK356X_SDK_RELEASE

hc
2024-05-10 23fa18eaa71266feff7ba8d83022d9e1cc83c65a
kernel/arch/arm64/kernel/signal32.c
....@@ -1,21 +1,10 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * Based on arch/arm/kernel/signal.c
34 *
45 * Copyright (C) 1995-2009 Russell King
56 * Copyright (C) 2012 ARM Ltd.
67 * 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/>.
198 */
209
2110 #include <linux/compat.h>
....@@ -234,7 +223,7 @@
234223 err |= !valid_user_regs(&regs->user_regs, current);
235224
236225 aux = (struct compat_aux_sigframe __user *) sf->uc.uc_regspace;
237
- if (err == 0)
226
+ if (err == 0 && system_supports_fpsimd())
238227 err |= compat_restore_vfp_context(&aux->vfp);
239228
240229 return err;
....@@ -258,7 +247,7 @@
258247
259248 frame = (struct compat_sigframe __user *)regs->compat_sp;
260249
261
- if (!access_ok(VERIFY_READ, frame, sizeof (*frame)))
250
+ if (!access_ok(frame, sizeof (*frame)))
262251 goto badframe;
263252
264253 if (compat_restore_sigframe(regs, frame))
....@@ -289,7 +278,7 @@
289278
290279 frame = (struct compat_rt_sigframe __user *)regs->compat_sp;
291280
292
- if (!access_ok(VERIFY_READ, frame, sizeof (*frame)))
281
+ if (!access_ok(frame, sizeof (*frame)))
293282 goto badframe;
294283
295284 if (compat_restore_sigframe(regs, &frame->sig))
....@@ -320,7 +309,7 @@
320309 /*
321310 * Check that we can actually write to the signal frame.
322311 */
323
- if (!access_ok(VERIFY_WRITE, frame, framesize))
312
+ if (!access_ok(frame, framesize))
324313 frame = NULL;
325314
326315 return frame;
....@@ -353,38 +342,13 @@
353342 retcode = ptr_to_compat(ka->sa.sa_restorer);
354343 } else {
355344 /* 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
380345 unsigned int idx = thumb << 1;
381346
382347 if (ka->sa.sa_flags & SA_SIGINFO)
383348 idx += 3;
384349
385
- retcode = (unsigned long)current->mm->context.vdso +
350
+ retcode = (unsigned long)current->mm->context.sigpage +
386351 (idx << 2) + thumb;
387
-#endif
388352 }
389353
390354 regs->regs[0] = usig;
....@@ -430,7 +394,7 @@
430394
431395 aux = (struct compat_aux_sigframe __user *) sf->uc.uc_regspace;
432396
433
- if (err == 0)
397
+ if (err == 0 && system_supports_fpsimd())
434398 err |= compat_preserve_vfp_context(&aux->vfp);
435399 __put_user_error(0, &aux->end_magic, err);
436400