Skip to contentSkip to conversation

[PATCH[ Export __PAGE_KERNEL_EXEC for modules (vmmon)

PATCH Petr Vandrovec 3 participants 5 messages Oct 28, 2004 – Oct 29, 2004

lore
Share & tools
lore
#0 lore raw

Hello Ingo,
recently support for NX on i386 arrived to 2.6.x kernel, and I have
some problems building code which uses vmap since then - PAGE_KERNEL_EXEC expands to __PAGE_KERNEL_EXEC, and this one is not accessible to modules.

Or should I just use __pgprot(__PAGE_KERNEL & ~_PAGE_NX) or
__pgprot(_PAGE_KERNEL_EXEC) instead as pgprot argument to vmap?
Thanks,
Petr Vandrovec

arch/i386/kernel/i386_ksyms.c +1 -0
@@ -179,6 +179,7 @@
 #endif
 
 EXPORT_SYMBOL(__PAGE_KERNEL);
+EXPORT_SYMBOL(__PAGE_KERNEL_EXEC);
 
 #ifdef CONFIG_HIGHMEM
 EXPORT_SYMBOL(kmap);
#1 lore raw
Quoted 3 lines · Petr Vandrovec

Hello Ingo,
recently support for NX on i386 arrived to 2.6.x kernel, and I have
some problems building code which uses vmap since then - PAGE_KERNEL_EXEC

why are you vmap'ing *executable* kernel memory?
That sounds very wrong.... very very wrong. The module loader needs it, sure, but that's not modular. What on earth are you doing ????

#2 lore raw
Quoted 8 lines · Arjan van de Ven
Quoted 3 lines · Petr Vandrovec

Hello Ingo,
recently support for NX on i386 arrived to 2.6.x kernel, and I have
some problems building code which uses vmap since then - PAGE_KERNEL_EXEC

why are you vmap'ing *executable* kernel memory?
That sounds very wrong.... very very wrong. The module loader needs it, sure, but that's not modular. What on earth are you doing ????

Due to rule that not everything should be in kernel, userspace picks one of codes needed to switch processor from currently used mode & address space to mode VMware needs (ia32 => long, long => ia32, PAE <=> non-PAE + cr3 + gdt + idt) maps it into kernel space, and then run it as needed. And for running it it must be executable.

OK, I think that I understand message. __pgprot(__PAGE_KERNEL & ~_PAGE_NX) is my friend.
Petr Vandrovec

#3 lore raw
Quoted 7 lines · Petr Vandrovec

????

Due to rule that not everything should be in kernel, userspace picks one of codes needed to switch processor from currently used mode & address space to mode VMware needs (ia32 => long, long => ia32, PAE <=> non-PAE + cr3 + gdt + idt) maps it into kernel space, and then run it as needed. And for running it it must be executable.

so effectively vmware has it's own module loader. quite interesting ;)

#4 lore raw
In reply to Petr Vandrovec
Quoted 4 lines · Petr Vandrovec

Hello Ingo,
recently support for NX on i386 arrived to 2.6.x kernel, and I have
some problems building code which uses vmap since then - PAGE_KERNEL_EXEC expands to __PAGE_KERNEL_EXEC, and this one is not accessible to modules.

The right thing is not to mark kernel virtual memory executable from modules at all.