make register_die_notifier() usable for modules
PATCH 1/1 make register_die_notifier() usable for modules
From: Jan Beulich <[email protected]>
Registering a callback handler through register_die_notifier() is obviously primarily intended for use by modules. However, the way these currently get called it is basically impossible for them to actually be used by modules, as there is, on non-PAE configurationes, a good chance (the larger the module, the better) for the system to crash as a result. This is because the callback gets invoked
(a) in the page fault path before the top level page table propagation gets carried out (hence a fault to propagate the top level page table entry/entries mapping to module's code/data would nest infinitly) and
(b) in the NMI path, where nested faults must absolutely not happen, since otherwise the IRET from the nested fault re-enables NMIs, potentially resulting in nested NMI occurences.
Besides the modular aspect, similar problems would even arise for in- kernel consumers of the API if they touched ioremap()ed or vmalloc()ed memory inside their handlers.
From: Jan Beulich <[email protected]>
Registering a callback handler through register_die_notifier() is obviously primarily intended for use by modules. However, the way these currently get called it is basically impossible for them to actually be used by modules, as there is, on non-PAE configurationes, a good chance (the larger the module, the better) for the system to crash as a result. This is because the callback gets invoked
(a) in the page fault path before the top level page table propagation gets carried out (hence a fault to propagate the top level page table entry/entries mapping to module's code/data would nest infinitly) and
(b) in the NMI path, where nested faults must absolutely not happen, since otherwise the IRET from the nested fault re-enables NMIs, potentially resulting in nested NMI occurences.
Besides the modular aspect, similar problems would even arise for in- kernel consumers of the API if they touched ioremap()ed or vmalloc()ed memory inside their handlers.
arch/i386/kernel/traps.c renamed from home/jbeulich/tmp/linux-2.6.16-rc1/arch/i386/kernel/traps.c +3 -0
@@ -99,6 +99,8 @@ int register_die_notifier(struct notifie {int err =0 ;unsigned long flags; + +vmalloc_sync_all ();spin_lock_irqsave (&die_notifier_lock, flags); err =notifier_chain_register (&i386die_chain, nb);spin_unlock_irqrestore (&die_notifier_lock, flags);
@@ -691,6 +693,7 @@ fastcall void do_nmi(struct pt_regs * revoid set_nmi_callback (nmi_callback_t callback) { +vmalloc_sync_all ();rcu_assign_pointer (nmi_callback, callback); }EXPORT_SYMBOL_GPL (set_nmi_callback);
arch/i386/mm/fault.c renamed from home/jbeulich/tmp/linux-2.6.16-rc1/arch/i386/mm/fault.c +114 -59
207 lines not on this page · raw message
include/asm-i386/pgtable-2level.h renamed from home/jbeulich/tmp/linux-2.6.16-rc1/include/asm-i386/pgtable-2level.h +2 -0
@@ -61,4 +61,6 @@ static inline int pte_exec_kernel(pte_t#define __pte_to_swp_entry (pte) ((swp_entry_t) { (pte).pte_low })#define __swp_entry_to_pte (x) ((pte_t) { (x).val }) +void vmalloc_sync_all (void ); +#endif /* _I386_PGTABLE_2LEVEL_H */
include/asm-i386/pgtable-3level.h renamed from home/jbeulich/tmp/linux-2.6.16-rc1/include/asm-i386/pgtable-3level.h +2 -0
@@ -152,4 +152,6 @@ static inline pmd_t pfn_pmd(unsigned lon#define __pmd_free_tlb (tlb, x) do { } while (0) +#define vmalloc_sync_all () ((void)0) +#endif /* _I386_PGTABLE_3LEVEL_H */