#include <linux/mm.h>
#include <linux/err.h>
#include <linux/module.h>
+#include <linux/slab.h>
#include <asm/cpufeature.h>
#include <asm/msr.h>
EXPORT_SYMBOL_GPL(vdso_enabled);
#endif
-static struct page *vdso32_pages[1];
+static struct page **vdso32_pages;
+static unsigned int vdso32_size;
#ifdef CONFIG_X86_64
int __init sysenter_setup(void)
{
- void *vdso_page = (void *)get_zeroed_page(GFP_ATOMIC);
+ void *vdso_pages;
const void *vdso;
size_t vdso_len;
-
- vdso32_pages[0] = virt_to_page(vdso_page);
+ unsigned int i;
if (vdso32_syscall()) {
vdso = &vdso32_syscall_start;
vdso_len = &vdso32_int80_end - &vdso32_int80_start;
}
- memcpy(vdso_page, vdso, vdso_len);
- patch_vdso32(vdso_page, vdso_len);
+ vdso32_size = (vdso_len + PAGE_SIZE - 1) / PAGE_SIZE;
+ vdso32_pages = kmalloc(sizeof(*vdso32_pages) * vdso32_size, GFP_ATOMIC);
+ vdso_pages = kmalloc(VDSO_OFFSET(vdso32_size), GFP_ATOMIC);
+
+ for(i = 0; i != vdso32_size; ++i)
+ vdso32_pages[i] = virt_to_page(vdso_pages + VDSO_OFFSET(i));
+
+ memcpy(vdso_pages, vdso, vdso_len);
+ patch_vdso32(vdso_pages, vdso_len);
return 0;
}
*/
ret = install_special_mapping(mm,
addr,
- VDSO_OFFSET(VDSO_PAGES - VDSO_PREV_PAGES),
+ VDSO_OFFSET(vdso32_size),
VM_READ|VM_EXEC|
VM_MAYREAD|VM_MAYWRITE|VM_MAYEXEC,
vdso32_pages);