Merge tag 'arm64-upstream' of git://git.kernel.org/pub/scm/linux/kernel/git/arm64...
[linux-2.6-microblaze.git] / arch / arm64 / kernel / signal.c
index 1a0e2b5..9fe70b1 100644 (file)
@@ -290,6 +290,11 @@ static int restore_sve_fpsimd_context(struct user_ctxs *user)
        /* From now, fpsimd_thread_switch() won't touch thread.sve_state */
 
        sve_alloc(current);
+       if (!current->thread.sve_state) {
+               clear_thread_flag(TIF_SVE);
+               return -ENOMEM;
+       }
+
        err = __copy_from_user(current->thread.sve_state,
                               (char __user const *)user->sve +
                                        SVE_SIG_REGS_OFFSET,
@@ -912,21 +917,7 @@ static void do_signal(struct pt_regs *regs)
        restore_saved_sigmask();
 }
 
-static bool cpu_affinity_invalid(struct pt_regs *regs)
-{
-       if (!compat_user_mode(regs))
-               return false;
-
-       /*
-        * We're preemptible, but a reschedule will cause us to check the
-        * affinity again.
-        */
-       return !cpumask_test_cpu(raw_smp_processor_id(),
-                                system_32bit_el0_cpumask());
-}
-
-asmlinkage void do_notify_resume(struct pt_regs *regs,
-                                unsigned long thread_flags)
+void do_notify_resume(struct pt_regs *regs, unsigned long thread_flags)
 {
        do {
                if (thread_flags & _TIF_NEED_RESCHED) {
@@ -952,19 +943,6 @@ asmlinkage void do_notify_resume(struct pt_regs *regs,
                        if (thread_flags & _TIF_NOTIFY_RESUME) {
                                tracehook_notify_resume(regs);
                                rseq_handle_notify_resume(NULL, regs);
-
-                               /*
-                                * If we reschedule after checking the affinity
-                                * then we must ensure that TIF_NOTIFY_RESUME
-                                * is set so that we check the affinity again.
-                                * Since tracehook_notify_resume() clears the
-                                * flag, ensure that the compiler doesn't move
-                                * it after the affinity check.
-                                */
-                               barrier();
-
-                               if (cpu_affinity_invalid(regs))
-                                       force_sig(SIGKILL);
                        }
 
                        if (thread_flags & _TIF_FOREIGN_FPSTATE)