File tree Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Expand file tree Collapse file tree 2 files changed +18
-9
lines changed Original file line number Diff line number Diff line change 4
4
*/
5
5
#include <linux/interrupt.h>
6
6
7
+ #include <asm/cpu_entry_area.h>
7
8
#include <asm/traps.h>
8
9
#include <asm/proto.h>
9
10
#include <asm/desc.h>
@@ -281,6 +282,19 @@ void __init idt_setup_ist_traps(void)
281
282
}
282
283
#endif
283
284
285
+ static void __init idt_map_in_cea (void )
286
+ {
287
+ /*
288
+ * Set the IDT descriptor to a fixed read-only location in the cpu
289
+ * entry area, so that the "sidt" instruction will not leak the
290
+ * location of the kernel, and to defend the IDT against arbitrary
291
+ * memory write vulnerabilities.
292
+ */
293
+ cea_set_pte (CPU_ENTRY_AREA_RO_IDT_VADDR , __pa_symbol (idt_table ),
294
+ PAGE_KERNEL_RO );
295
+ idt_descr .address = CPU_ENTRY_AREA_RO_IDT ;
296
+ }
297
+
284
298
/**
285
299
* idt_setup_apic_and_irq_gates - Setup APIC/SMP and normal interrupt gates
286
300
*/
@@ -307,6 +321,10 @@ void __init idt_setup_apic_and_irq_gates(void)
307
321
set_intr_gate (i , entry );
308
322
}
309
323
#endif
324
+ /* Map IDT into CPU entry area and reload it. */
325
+ idt_map_in_cea ();
326
+ load_idt (& idt_descr );
327
+
310
328
idt_setup_done = true;
311
329
}
312
330
Original file line number Diff line number Diff line change @@ -1055,15 +1055,6 @@ void __init trap_init(void)
1055
1055
1056
1056
idt_setup_traps ();
1057
1057
1058
- /*
1059
- * Set the IDT descriptor to a fixed read-only location, so that the
1060
- * "sidt" instruction will not leak the location of the kernel, and
1061
- * to defend the IDT against arbitrary memory write vulnerabilities.
1062
- * It will be reloaded in cpu_init() */
1063
- cea_set_pte (CPU_ENTRY_AREA_RO_IDT_VADDR , __pa_symbol (idt_table ),
1064
- PAGE_KERNEL_RO );
1065
- idt_descr .address = CPU_ENTRY_AREA_RO_IDT ;
1066
-
1067
1058
/*
1068
1059
* Should be a barrier for any external CPU state:
1069
1060
*/
You can’t perform that action at this time.
0 commit comments