Merge branch 'move SYS() macro to test_progs.h and run mptcp in a dedicated netns'
[platform/kernel/linux-starfive.git] / kernel / exit.c
index 15dc2ec..f2afdb0 100644 (file)
@@ -807,6 +807,8 @@ void __noreturn do_exit(long code)
        struct task_struct *tsk = current;
        int group_dead;
 
+       WARN_ON(irqs_disabled());
+
        synchronize_group_exit(tsk, code);
 
        WARN_ON(tsk->plug);
@@ -938,6 +940,11 @@ void __noreturn make_task_dead(int signr)
        if (unlikely(!tsk->pid))
                panic("Attempted to kill the idle task!");
 
+       if (unlikely(irqs_disabled())) {
+               pr_info("note: %s[%d] exited with irqs disabled\n",
+                       current->comm, task_pid_nr(current));
+               local_irq_enable();
+       }
        if (unlikely(in_atomic())) {
                pr_info("note: %s[%d] exited with preempt_count %d\n",
                        current->comm, task_pid_nr(current),
@@ -1898,7 +1905,14 @@ bool thread_group_exited(struct pid *pid)
 }
 EXPORT_SYMBOL(thread_group_exited);
 
-__weak void abort(void)
+/*
+ * This needs to be __function_aligned as GCC implicitly makes any
+ * implementation of abort() cold and drops alignment specified by
+ * -falign-functions=N.
+ *
+ * See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=88345#c11
+ */
+__weak __function_aligned void abort(void)
 {
        BUG();