[vbox-dev] Problem with kernel 5.8

Larry Finger Larry.Finger at lwfinger.net
Fri Jun 5 21:39:08 GMT 2020


In a little over one week, Linus will release Kernel 5.8.0-rc1. Shortly 
thereafter, openSUSE Tumbleweed will start builds using that kernel. Unless I 
have patched our copy of the code for the VB kernel modules, my mailbox will be 
flooded with build failure messages.

Thus far, I have found two incompatibilities with the 5.8 APIs. The first was 
the removal of __get_vm_area(). This one can be trivially replaced with 
__get_vm_area_caller(), which has one additional argument that is always 
"__builtin_return_address(0)."

A second API change is more complicated, and above my understanding. In the 
associated patch entitled "mm: only allow page table mappings for built-in 
zsmalloc", symbols map_vm_area() and unmap_kernel_range() are no longer 
exported. The first of these are used in this snippet found in 
src/vboxdrv/r0drv/linux/alloc-r0drv-linux.c:

     if (iPage == cPages)
     {
         /*
          * Map the pages.
          *
          * Not entirely sure we really need to set nr_pages and pages here, but
          * they provide a very convenient place for storing something we need
          * in the free function, if nothing else...
          */
# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
         struct page **papPagesIterator = papPages;
# endif
         pVmArea->nr_pages = cPages;
         pVmArea->pages    = papPages;
         if (!map_vm_area(pVmArea, PAGE_KERNEL_EXEC,
# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
                          &papPagesIterator
# else
                          papPages
# endif
                          ))
         {
             PRTMEMLNXHDREX pHdrEx = (PRTMEMLNXHDREX)pVmArea->addr;
             pHdrEx->pVmArea     = pVmArea;
             pHdrEx->pvDummy     = NULL;
             return &pHdrEx->Hdr;
         }
         /* bail out */
# if LINUX_VERSION_CODE < KERNEL_VERSION(3, 17, 0)
         pVmArea->nr_pages = papPagesIterator - papPages;
# endif
     }

I think the code could use vm_map_ram() to map the papPages array directly, but 
I would appreciate any help the developers could provide.

Thanks,

Larry



More information about the vbox-dev mailing list