[RFC, PATCH 7/24] i386 Vmi memory hole

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Gerd Hoffmann wrote:
>>> The complications in my patch come 
>>> from the fact that the vsyscall page has to be relocated dynamically, 
>>> requiring, basically run time linking on the page and some tweaks to get 
>>> sysenter to work.  If you don't use vsyscall (say, non-TLS glibc), then 
>>> you don't need that complexity.  But I think it might be needed now, 
>>> even for Xen.
>>>       
>> I believe both Xen and execshield move vsyscall out of fixmap, and then
>> map into userspace as normal vma.
>>     
>
> Yep, my patch (attached below for reference) moves the vsyscall page
> into user address space, just below PAGE_OFFSET.  Works basically the
> same way the vsyscall page is mapped in the ia32 emulation of the x86_64
>  architecture.  Address stays fixed, thus the relocation magic isn't needed.
>
> Once the vsyscall page is moved out of fixmap it's easy to make fixmap
> movable and thus have a runtime-resizable address space hole at the top
> of address space.  Patch is attached too, although that one is more
> proof-of-concept, it doesn't make much sense as-is.  It has a kernel
> command line option to specify the top of address space so you can play
> around with it ...
>
> Both patches are against -rc3 and most likely still apply just fine,
> havn't tested that though.
>   

Your patch looks a lot cleaner and less hackish than mine.  But I wonder 
if it still works with kernels that support the sysenter method of 
calling into the kernel.  Look at the following code:

ENTRY(sysenter_entry)
        movl TSS_sysenter_esp0(%esp),%esp
sysenter_past_esp:
        STI
        pushl $(__USER_DS)
        pushl %ebp
        pushfl
        pushl $(__USER_CS)
        pushl $SYSENTER_RETURN

SYSENTER_RETURN is a link time constant that is defined based on the 
location of the vsyscall page.  If the vsyscall page can move, this can 
not be a constant.  The reason is, this "fake" exception frame is used 
to return back to the EIP of the call site, and sysenter does not record 
the EIP of the call site.

Zach

[Index of Archives]     [KVM Development]     [Libvirt Development]     [Libvirt Users]     [CentOS Virtualization]     [Netdev]     [Ethernet Bridging]     [Linux Wireless]     [Kernel Newbies]     [Security]     [Linux for Hams]     [Netfilter]     [Bugtraq]     [Yosemite Forum]     [MIPS Linux]     [ARM Linux]     [Linux RAID]     [Linux Admin]     [Samba]

  Powered by Linux