hc
2024-11-01 2f529f9b558ca1c1bd74be7437a84e4711743404
kernel/fs/exec.c
....@@ -34,6 +34,7 @@
3434 #include <linux/swap.h>
3535 #include <linux/string.h>
3636 #include <linux/init.h>
37
+#include <linux/irq_pipeline.h>
3738 #include <linux/sched/mm.h>
3839 #include <linux/sched/coredump.h>
3940 #include <linux/sched/signal.h>
....@@ -68,6 +69,7 @@
6869 #include <linux/uaccess.h>
6970 #include <asm/mmu_context.h>
7071 #include <asm/tlb.h>
72
+#include <asm/dovetail.h>
7173
7274 #include <trace/events/task.h>
7375 #include "internal.h"
....@@ -981,6 +983,7 @@
981983 struct task_struct *tsk;
982984 struct mm_struct *old_mm, *active_mm;
983985 int ret;
986
+ unsigned long flags;
984987
985988 /* Notify parent that we're no longer interested in the old VM */
986989 tsk = current;
....@@ -1013,6 +1016,7 @@
10131016
10141017 local_irq_disable();
10151018 active_mm = tsk->active_mm;
1019
+ protect_inband_mm(flags);
10161020 tsk->active_mm = mm;
10171021 tsk->mm = mm;
10181022 /*
....@@ -1021,10 +1025,17 @@
10211025 * lazy tlb mm refcounting when these are updated by context
10221026 * switches. Not all architectures can handle irqs off over
10231027 * activate_mm yet.
1028
+ *
1029
+ * irq_pipeline: activate_mm() allowing irqs off context is a
1030
+ * requirement. e.g. TLB shootdown must not involve IPIs. We
1031
+ * make sure protect_inband_mm() is in effect while switching
1032
+ * in and activating the new mm by forcing
1033
+ * CONFIG_ARCH_WANT_IRQS_OFF_ACTIVATE_MM on.
10241034 */
10251035 if (!IS_ENABLED(CONFIG_ARCH_WANT_IRQS_OFF_ACTIVATE_MM))
10261036 local_irq_enable();
10271037 activate_mm(active_mm, mm);
1038
+ unprotect_inband_mm(flags);
10281039 if (IS_ENABLED(CONFIG_ARCH_WANT_IRQS_OFF_ACTIVATE_MM))
10291040 local_irq_enable();
10301041 tsk->mm->vmacache_seqnum = 0;
....@@ -1302,6 +1313,9 @@
13021313 if (retval)
13031314 goto out_unlock;
13041315
1316
+ /* Tell Dovetail about the ongoing exec(). */
1317
+ arch_dovetail_exec_prepare();
1318
+
13051319 /*
13061320 * Ensure that the uaccess routines can actually operate on userspace
13071321 * pointers: