On 05/29/2017 09:56 AM, Sérgio Basto wrote:
On Fri, 2017-05-19 at 13:43 -0500, Larry Finger wrote:
On 05/19/2017 04:57 AM, Frank Mehnert wrote:
On Mittwoch, 17. Mai 2017 20:49:42 CEST Frank Mehnert wrote:
Hi Larry,
On Montag, 15. Mai 2017 16:35:30 CEST Larry Finger wrote:
Has anyone found the magic elixir to allow VB to run with
kernel 4.12-rc1?
Adding #include <asm/set_memory.h> to
vboxdrv/r0drv/linux/alloc-r0drv-linux.c is
trivial; however, I'm having trouble with changes in the page
table walk code in
vboxdrv/r0drv/linux/memobj-r0drv-linux.c. I followed the
changes in the kernel
and I have code that compiles cleanly, but as soon as I try to
start a VM, the
system locks up and panics a few seconds later. At this point,
I have no
diagnostics concerning where the fault happened.
we are working on a fix. The obvious fixes can be found in
r66927, r66928
and r66930. These changes make the modules compile against Linux
4.12-rc1
but as you noticed, the kernel panics when starting a VM. We are
debugging
this issue.
quick fix for the remaining issue (freeze on VM start) is the
following:
--- src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c (revision
115504)
+++ src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c (working
copy)
@@ -1397,7 +1397,7 @@
SUPR0DECL(uint32_t) SUPR0GetKernelFeatures(void)
{
uint32_t fFlags = 0;
-#ifdef CONFIG_PAX_KERNEXEC
+#if defined(CONFIG_PAX_KERNEXEC) || LINUX_VERSION_CODE >=
KERNEL_VERSION(4, 12, 0)
fFlags |= SUPKERNELFEATURES_GDT_READ_ONLY;
#endif
#if defined(VBOX_STRICT) ||
defined(VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV)
The reason is that the GDT is mapped read-only as of Linux 4.12. We
have
not yet decided if this will be the final fix for the moment or if
an
alternative fix (which requires changes to the VMM part as well) is
the
better choice.
Thanks for this update. At least the current set of patches will
allow VB to
build on my kernel, and when the Kernel:HEAD project at openSUSE
switches to
4.12.0-rcX.
Hi , Larry
I expect to see yours patches in
https://build.opensuse.org/package/show/Virtualization/virtualbox
but patches for 4.12.0-rcX still not published , could you send it to
us ? , to apply on my VirtualBox package in RPMFusion ...
Attached are my patches for the 4.12 kernel. This patch file is used to modify
the tar file used to create the openSUSE RPM. The paths may need to be adjusted.
Larry
Index: VirtualBox-5.1.22/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
===================================================================
--- VirtualBox-5.1.22.orig/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
+++ VirtualBox-5.1.22/src/VBox/HostDrivers/Support/linux/SUPDrv-linux.c
@@ -1397,7 +1397,7 @@ RTDECL(int) SUPR0Printf(const char *pszF
SUPR0DECL(uint32_t) SUPR0GetKernelFeatures(void)
{
uint32_t fFlags = 0;
-#ifdef CONFIG_PAX_KERNEXEC
+#if defined(CONFIG_PAX_KERNEXEC) || LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
fFlags |= SUPKERNELFEATURES_GDT_READ_ONLY;
#endif
#if defined(VBOX_STRICT) || defined(VBOX_WITH_EFLAGS_AC_SET_IN_VBOXDRV)
Index: VirtualBox-5.1.22/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
===================================================================
--- VirtualBox-5.1.22.orig/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
+++ VirtualBox-5.1.22/src/VBox/Runtime/r0drv/linux/alloc-r0drv-linux.c
@@ -36,6 +36,9 @@
#include <iprt/err.h>
#include "r0drv/alloc-r0drv.h"
#include <linux/kmemleak.h>
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+#include <asm/set_memory.h>
+#endif
#if (defined(RT_ARCH_AMD64) || defined(DOXYGEN_RUNNING)) && !defined(RTMEMALLOC_EXEC_HEAP)
# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 23)
Index: VirtualBox-5.1.22/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
===================================================================
--- VirtualBox-5.1.22.orig/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
+++ VirtualBox-5.1.22/src/VBox/Runtime/r0drv/linux/memobj-r0drv-linux.c
@@ -899,6 +899,9 @@ static struct page *rtR0MemObjLinuxVirtT
unsigned long pfn;
struct page *pPage;
pte_t *pEntry;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ p4d_t p4d;
+#endif
union
{
pgd_t Global;
@@ -917,9 +920,18 @@ static struct page *rtR0MemObjLinuxVirtT
u.Global = *pgd_offset(current->active_mm, ulAddr);
if (RT_UNLIKELY(pgd_none(u.Global)))
return NULL;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ p4d = *p4d_offset(&u.Global, ulAddr);
+ if (RT_UNLIKELY(p4d_none(p4d) || p4d_large(p4d) || !p4d_present(p4d)))
+ return NULL;
+#endif
#if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 11)
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ u.Upper = *pud_offset(&p4d, ulAddr);
+#else
u.Upper = *pud_offset(&u.Global, ulAddr);
+#endif
if (RT_UNLIKELY(pud_none(u.Upper)))
return NULL;
# if LINUX_VERSION_CODE >= KERNEL_VERSION(2, 6, 25)
@@ -1463,13 +1475,23 @@ static int rtR0MemObjLinuxFixPte(struct
{
int rc = -ENOMEM;
pgd_t *pgd;
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ p4d_t *p4d;
+#endif
spin_lock(&mm->page_table_lock);
pgd = pgd_offset(mm, ulAddr);
if (!pgd_none(*pgd) && !pgd_bad(*pgd))
{
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+ p4d = p4d_offset(*pgd, ulAddr);
+ if (p4d_none(*p4d))
+ goto exit;
+ pmd_t *pmd = pmd_offset(p4d, ulAddr);
+#else
pmd_t *pmd = pmd_offset(pgd, ulAddr);
+#endif
if (!pmd_none(*pmd))
{
pte_t *ptep = pte_offset_map(pmd, ulAddr);
@@ -1487,6 +1509,9 @@ static int rtR0MemObjLinuxFixPte(struct
}
}
+#if LINUX_VERSION_CODE >= KERNEL_VERSION(4, 12, 0)
+exit:
+#endif
spin_unlock(&mm->page_table_lock);
return rc;
}
_______________________________________________
vbox-dev mailing list
[email protected]
https://www.virtualbox.org/mailman/listinfo/vbox-dev