hc
2023-12-06 08f87f769b595151be1afeff53e144f543faa614
kernel/arch/m68k/kernel/signal.c
....@@ -47,7 +47,6 @@
4747
4848 #include <asm/setup.h>
4949 #include <linux/uaccess.h>
50
-#include <asm/pgtable.h>
5150 #include <asm/traps.h>
5251 #include <asm/ucontext.h>
5352 #include <asm/cacheflush.h>
....@@ -62,25 +61,25 @@
6261 #define FMT4SIZE 0
6362 #else
6463 #define FORMAT 0
65
-#define FMT4SIZE sizeof(((struct frame *)0)->un.fmt4)
64
+#define FMT4SIZE sizeof_field(struct frame, un.fmt4)
6665 #endif
6766
6867 static const int frame_size_change[16] = {
69
- [1] = -1, /* sizeof(((struct frame *)0)->un.fmt1), */
70
- [2] = sizeof(((struct frame *)0)->un.fmt2),
71
- [3] = sizeof(((struct frame *)0)->un.fmt3),
68
+ [1] = -1, /* sizeof_field(struct frame, un.fmt1), */
69
+ [2] = sizeof_field(struct frame, un.fmt2),
70
+ [3] = sizeof_field(struct frame, un.fmt3),
7271 [4] = FMT4SIZE,
73
- [5] = -1, /* sizeof(((struct frame *)0)->un.fmt5), */
74
- [6] = -1, /* sizeof(((struct frame *)0)->un.fmt6), */
75
- [7] = sizeof(((struct frame *)0)->un.fmt7),
76
- [8] = -1, /* sizeof(((struct frame *)0)->un.fmt8), */
77
- [9] = sizeof(((struct frame *)0)->un.fmt9),
78
- [10] = sizeof(((struct frame *)0)->un.fmta),
79
- [11] = sizeof(((struct frame *)0)->un.fmtb),
80
- [12] = -1, /* sizeof(((struct frame *)0)->un.fmtc), */
81
- [13] = -1, /* sizeof(((struct frame *)0)->un.fmtd), */
82
- [14] = -1, /* sizeof(((struct frame *)0)->un.fmte), */
83
- [15] = -1, /* sizeof(((struct frame *)0)->un.fmtf), */
72
+ [5] = -1, /* sizeof_field(struct frame, un.fmt5), */
73
+ [6] = -1, /* sizeof_field(struct frame, un.fmt6), */
74
+ [7] = sizeof_field(struct frame, un.fmt7),
75
+ [8] = -1, /* sizeof_field(struct frame, un.fmt8), */
76
+ [9] = sizeof_field(struct frame, un.fmt9),
77
+ [10] = sizeof_field(struct frame, un.fmta),
78
+ [11] = sizeof_field(struct frame, un.fmtb),
79
+ [12] = -1, /* sizeof_field(struct frame, un.fmtc), */
80
+ [13] = -1, /* sizeof_field(struct frame, un.fmtd), */
81
+ [14] = -1, /* sizeof_field(struct frame, un.fmte), */
82
+ [15] = -1, /* sizeof_field(struct frame, un.fmtf), */
8483 };
8584
8685 static inline int frame_extra_sizes(int f)
....@@ -651,7 +650,8 @@
651650 regs->vector = formatvec & 0xfff;
652651 } else {
653652 struct switch_stack *sw = (struct switch_stack *)regs - 1;
654
- unsigned long buf[fsize / 2]; /* yes, twice as much */
653
+ /* yes, twice as much as max(sizeof(frame.un.fmt<x>)) */
654
+ unsigned long buf[sizeof_field(struct frame, un) / 2];
655655
656656 /* that'll make sure that expansion won't crap over data */
657657 if (copy_from_user(buf + fsize / 4, fp, fsize))
....@@ -787,7 +787,7 @@
787787 struct sigframe __user *frame = (struct sigframe __user *)(usp - 4);
788788 sigset_t set;
789789
790
- if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
790
+ if (!access_ok(frame, sizeof(*frame)))
791791 goto badframe;
792792 if (__get_user(set.sig[0], &frame->sc.sc_mask) ||
793793 (_NSIG_WORDS > 1 &&
....@@ -802,7 +802,7 @@
802802 return regs->d0;
803803
804804 badframe:
805
- force_sig(SIGSEGV, current);
805
+ force_sig(SIGSEGV);
806806 return 0;
807807 }
808808
....@@ -812,7 +812,7 @@
812812 struct rt_sigframe __user *frame = (struct rt_sigframe __user *)(usp - 4);
813813 sigset_t set;
814814
815
- if (!access_ok(VERIFY_READ, frame, sizeof(*frame)))
815
+ if (!access_ok(frame, sizeof(*frame)))
816816 goto badframe;
817817 if (__copy_from_user(&set, &frame->uc.uc_sigmask, sizeof(set)))
818818 goto badframe;
....@@ -824,7 +824,7 @@
824824 return regs->d0;
825825
826826 badframe:
827
- force_sig(SIGSEGV, current);
827
+ force_sig(SIGSEGV);
828828 return 0;
829829 }
830830
....@@ -928,7 +928,8 @@
928928 err |= __put_user(0x70004e40 + (__NR_sigreturn << 16),
929929 (long __user *)(frame->retcode));
930930 #else
931
- err |= __put_user((void *) ret_from_user_signal, &frame->pretcode);
931
+ err |= __put_user((long) ret_from_user_signal,
932
+ (long __user *) &frame->pretcode);
932933 #endif
933934
934935 if (err)
....@@ -1007,7 +1008,8 @@
10071008 err |= __put_user(0x4e40, (short __user *)(frame->retcode + 4));
10081009 #endif
10091010 #else
1010
- err |= __put_user((void *) ret_from_user_rt_signal, &frame->pretcode);
1011
+ err |= __put_user((long) ret_from_user_rt_signal,
1012
+ (long __user *) &frame->pretcode);
10111013 #endif /* CONFIG_MMU */
10121014
10131015 if (err)
....@@ -1063,7 +1065,7 @@
10631065 regs->d0 = -EINTR;
10641066 break;
10651067 }
1066
- /* fallthrough */
1068
+ fallthrough;
10671069 case -ERESTARTNOINTR:
10681070 do_restart:
10691071 regs->d0 = regs->orig_d0;
....@@ -1127,9 +1129,10 @@
11271129
11281130 void do_notify_resume(struct pt_regs *regs)
11291131 {
1130
- if (test_thread_flag(TIF_SIGPENDING))
1132
+ if (test_thread_flag(TIF_NOTIFY_SIGNAL) ||
1133
+ test_thread_flag(TIF_SIGPENDING))
11311134 do_signal(regs);
11321135
1133
- if (test_and_clear_thread_flag(TIF_NOTIFY_RESUME))
1136
+ if (test_thread_flag(TIF_NOTIFY_RESUME))
11341137 tracehook_notify_resume(regs);
11351138 }