[vbox-dev] Replacing VbglPhysHeapAlloc with kmalloc for linux vboxguest module ?

Hans de Goede hdegoede at redhat.com
Thu Jul 6 11:09:43 GMT 2017


Hi,

On 06-07-17 11:44, Knut St. Osmundsen wrote:
> Hi Hans.
> 
> On 2017-07-06 11:13 AM, Hans de Goede wrote:
>> Hi,
>>
>> VbglPhysHeapAlloc seems to be yet another mem-allocator
>> which chunks up memory returned by RTMemContAlloc, which
>> returns physical contiguous memory below 4GB.
> Need for keeping the code cross platform, not all supported guest have
> nice and efficient memory management functions.
> 
>>
>> I don't see any reason why we cannot use kmalloc directly
>> for that with a GFP_DMA32 flag.
>>
>> One other thing which RTMemContAlloc seems to do is mark
>> the pages executable. Does memory used by VbglGRAlloc /
>> VbglGRPerform need to be marked executable ?
> Hysterical raisins.  The RTMemContAlloc API is really ancient, the x86
> world was 32-bit only and the NX bit existed only in AMD64 preliminary
> docs.  It is(/was?) also used for various trampoline code (logging, ++)
> and world switchers (VMM/VMMSwitcher/*), which needed to be executable,
> thus all memory it returns is executable.
> 
> That the phys heap in VBoxGuest is working with memory marked executable
> is just a side effect of that API requirement.  I'm not aware of any
> reason why these allocations would need to be executable.  We should
> probably address this ourselves too.

Ok, thank you for the info.

Regards,

Hans



More information about the vbox-dev mailing list