lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 27 Jul 2011 13:05:18 -0400
From:	Andrew Lutomirski <luto@....edu>
To:	Konrad Rzeszutek Wilk <konrad.wilk@...cle.com>
Cc:	jeremy@...p.org, xen-devel@...ts.xensource.com, x86@...nel.org,
	Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
	virtualization@...ts.linux-foundation.org, keir.xen@...il.com
Subject: Re: [Xen-devel] Re: [PATCH 0/5] Collected vdso/vsyscall fixes for 3.1

On Wed, Jul 27, 2011 at 12:58 PM, Konrad Rzeszutek Wilk
<konrad.wilk@...cle.com> wrote:
>> >> $ test_vsyscall test
>> >> Testing gettimeofday...
>> >>   vDSO offset = 0.000001s
>> >>   vsyscall offset = 0.000001s
>> >>
>> >> Testing time...
>> >>   vDSO offset = 0
>> >>   vsyscall offset = 0
>> >> Testing getcpu...
>> >>   ok!  cpu=6 node=0
>
>> I bet if you pull a new copy or remove -mavx from Makefile it will
>> work.  I got a grossly hacked-up Xen domU booted and everything seems
>> to work.
>
> It did. Both Dom0 and DomU work on AMD and Intel.
>
> In regards to the last pv-ops patch - is there no better way? The reason I am asking
> is the pv-ops hook is just a bandaid for the problem. Is the Xen syscall suppose to
> be doingsomething extra with the stack perhaps?
>

The Xen code in question is:

restore_all_guest:
        ASSERT_INTERRUPTS_DISABLED
        RESTORE_ALL
        testw $TRAP_syscall,4(%rsp)
        jz    iret_exit_to_guest

        addq  $8,%rsp
        popq  %rcx                    # RIP
        popq  %r11                    # CS
        cmpw  $FLAT_USER_CS32,%r11
        popq  %r11                    # RFLAGS
        popq  %rsp                    # RSP
        je    1f
        sysretq
1:      sysretl


So with VCGF_in_syscall set, the ireq hypercall will return via
sysretq if the saved CS is __USER_CS or FLAT_USER_CS64.  This is
faster than iretq.

The hypervisor doesn't allow the guest OS to override the values in
MSR_STAR, so FLAT_USER_CS64 gets returned to userspace.  And sysretq
is probably much faster than iretq, so unsetting VCGF_in_syscall is
probably a bad idea.

The ideal solution would be to allow the kernel to change MSR_STAR,
but this would require changing the hypervisor and the kernel.

--Andy
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ