forked from ~ljy/RK356X_SDK_RELEASE

hc
2023-12-08 01573e231f18eb2d99162747186f59511f56b64d
kernel/arch/arm/kernel/signal.c
....@@ -1,11 +1,8 @@
1
+// SPDX-License-Identifier: GPL-2.0-only
12 /*
23 * linux/arch/arm/kernel/signal.c
34 *
45 * Copyright (C) 1995-2009 Russell King
5
- *
6
- * This program is free software; you can redistribute it and/or modify
7
- * it under the terms of the GNU General Public License version 2 as
8
- * published by the Free Software Foundation.
96 */
107 #include <linux/errno.h>
118 #include <linux/random.h>
....@@ -241,7 +238,7 @@
241238
242239 frame = (struct sigframe __user *)regs->ARM_sp;
243240
244
- if (!access_ok(VERIFY_READ, frame, sizeof (*frame)))
241
+ if (!access_ok(frame, sizeof (*frame)))
245242 goto badframe;
246243
247244 if (restore_sigframe(regs, frame))
....@@ -250,7 +247,7 @@
250247 return regs->ARM_r0;
251248
252249 badframe:
253
- force_sig(SIGSEGV, current);
250
+ force_sig(SIGSEGV);
254251 return 0;
255252 }
256253
....@@ -271,7 +268,7 @@
271268
272269 frame = (struct rt_sigframe __user *)regs->ARM_sp;
273270
274
- if (!access_ok(VERIFY_READ, frame, sizeof (*frame)))
271
+ if (!access_ok(frame, sizeof (*frame)))
275272 goto badframe;
276273
277274 if (restore_sigframe(regs, &frame->sig))
....@@ -283,7 +280,7 @@
283280 return regs->ARM_r0;
284281
285282 badframe:
286
- force_sig(SIGSEGV, current);
283
+ force_sig(SIGSEGV);
287284 return 0;
288285 }
289286
....@@ -355,7 +352,7 @@
355352 /*
356353 * Check that we can actually write to the signal frame.
357354 */
358
- if (!access_ok(VERIFY_WRITE, frame, framesize))
355
+ if (!access_ok(frame, framesize))
359356 frame = NULL;
360357
361358 return frame;
....@@ -549,8 +546,7 @@
549546 int ret;
550547
551548 /*
552
- * Increment event counter and perform fixup for the pre-signal
553
- * frame.
549
+ * Perform fixup for the pre-signal frame.
554550 */
555551 rseq_signal_deliver(ksig, regs);
556552
....@@ -600,6 +596,7 @@
600596 switch (retval) {
601597 case -ERESTART_RESTARTBLOCK:
602598 restart -= 2;
599
+ fallthrough;
603600 case -ERESTARTNOHAND:
604601 case -ERESTARTSYS:
605602 case -ERESTARTNOINTR:
....@@ -659,7 +656,7 @@
659656 if (unlikely(!user_mode(regs)))
660657 return 0;
661658 local_irq_enable();
662
- if (thread_flags & _TIF_SIGPENDING) {
659
+ if (thread_flags & (_TIF_SIGPENDING | _TIF_NOTIFY_SIGNAL)) {
663660 int restart = do_signal(regs, syscall);
664661 if (unlikely(restart)) {
665662 /*
....@@ -673,7 +670,6 @@
673670 } else if (thread_flags & _TIF_UPROBE) {
674671 uprobe_notify_resume(regs);
675672 } else {
676
- clear_thread_flag(TIF_NOTIFY_RESUME);
677673 tracehook_notify_resume(regs);
678674 rseq_handle_notify_resume(NULL, regs);
679675 }
....@@ -719,7 +715,9 @@
719715 /* Defer to generic check */
720716 asmlinkage void addr_limit_check_failed(void)
721717 {
718
+#ifdef CONFIG_MMU
722719 addr_limit_user_check();
720
+#endif
723721 }
724722
725723 #ifdef CONFIG_DEBUG_RSEQ