File krnl_5_15.diff of Package virtualbox52
Note: this patch is not necessary as long as the "no-vm_area" patch is applied,
but it should not hurt anyway (supposedly :-)).
--- linux-5.15.61/mm/vmalloc.c 2022-08-19 21:51:19.013958545 +0300
+++ linux-5.15.61_vb/mm/vmalloc.c 2022-08-19 22:42:39.617938061 +0300
@@ -622,6 +622,18 @@
return err;
}
+int map_vm_area(struct vm_struct *area, pgprot_t prot, struct page **pages)
+{
+ unsigned long addr = (unsigned long)area->addr;
+ unsigned long size = get_vm_area_size(area);
+ int err;
+
+ err = vmap_pages_range(addr, addr + size, prot, pages, PAGE_SHIFT);
+
+ return err > 0 ? 0 : err;
+}
+EXPORT_SYMBOL_GPL(map_vm_area);
+
int is_vmalloc_or_module_addr(const void *x)
{
/*
@@ -2433,6 +2445,14 @@
return area;
}
+struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
+ unsigned long start, unsigned long end)
+{
+ return __get_vm_area_node(size, 1, PAGE_SHIFT, flags, start, end,
+ NUMA_NO_NODE, GFP_KERNEL, __builtin_return_address(0));
+}
+EXPORT_SYMBOL_GPL(__get_vm_area);
+
struct vm_struct *__get_vm_area_caller(unsigned long size, unsigned long flags,
unsigned long start, unsigned long end,
const void *caller)
--- linux-5.15.61/include/linux/vmalloc.h 2022-08-19 22:44:36.909937281 +0300
+++ linux-5.15.61_vb/include/linux/vmalloc.h 2022-08-19 22:46:36.413936487 +0300
@@ -2,6 +2,8 @@
#ifndef _LINUX_VMALLOC_H
#define _LINUX_VMALLOC_H
+#define VBOX_COMPAT_KRNL 1
+
#include <linux/spinlock.h>
#include <linux/init.h>
#include <linux/list.h>
@@ -212,6 +214,8 @@
extern struct vm_struct *get_vm_area(unsigned long size, unsigned long flags);
extern struct vm_struct *get_vm_area_caller(unsigned long size,
unsigned long flags, const void *caller);
+extern struct vm_struct *__get_vm_area(unsigned long size, unsigned long flags,
+ unsigned long start, unsigned long end);
extern struct vm_struct *__get_vm_area_caller(unsigned long size,
unsigned long flags,
unsigned long start, unsigned long end,
@@ -220,6 +224,9 @@
extern struct vm_struct *remove_vm_area(const void *addr);
extern struct vm_struct *find_vm_area(const void *addr);
+extern int map_vm_area(struct vm_struct *area, pgprot_t prot,
+ struct page **pages);
+
static inline bool is_vm_area_hugepages(const void *addr)
{
/*