Re: [PATCH] i386: actively synchronize vmalloc area when registering certain callbacks

From: Andi Kleen
Date: Wed Feb 22 2006 - 12:24:17 EST


Jan Beulich <jbeulich@xxxxxxxxxx> writes:

> 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.
>
> Signed-Off-By: Jan Beulich <jbeulich@xxxxxxxxxx>

The patch is relatively complicated, but it's such a nasty corner case
(thanks Jan for discovering that one) that could easily hit in kernel
users like kprobes too so I think it's it's good fix it. I did the corresponding
change on x86-64 too.

Actually I tried to simplify it, but failed.

Acked-by: Andi Kleen <ak@xxxxxxx>
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/