Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread H. Peter Anvin
On 07/14/2014 07:46 PM, Andy Lutomirski wrote: > > On espfix-less kernels (Xen and non-Xen), 16-bit CS w/ 16-bit SS > always fails. Native (32-bit or 64-bit, according to the binary) CS > with 16-bit SS fails for sigreturn_32, but passes for sigreturn_64. I > find this somewhat odd. Native ss

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread Andy Lutomirski
On Mon, Jul 14, 2014 at 7:46 PM, Andy Lutomirski wrote: > On Mon, Jul 14, 2014 at 3:23 PM, H. Peter Anvin wrote: >> On 07/14/2014 02:35 PM, Andy Lutomirski wrote: >>> Presumably the problem is here: >>> >>> ENTRY(xen_iret) >>> pushq $0 >>> 1:jmp hypercall_iret >>> ENDPATCH(xen_iret) >>>

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread Andy Lutomirski
On Mon, Jul 14, 2014 at 3:23 PM, H. Peter Anvin wrote: > On 07/14/2014 02:35 PM, Andy Lutomirski wrote: >> Presumably the problem is here: >> >> ENTRY(xen_iret) >> pushq $0 >> 1:jmp hypercall_iret >> ENDPATCH(xen_iret) >> >> This seems rather unlikely to work on the espfix stack. >> >>

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread H. Peter Anvin
On 07/14/2014 02:35 PM, Andy Lutomirski wrote: > Presumably the problem is here: > > ENTRY(xen_iret) > pushq $0 > 1:jmp hypercall_iret > ENDPATCH(xen_iret) > > This seems rather unlikely to work on the espfix stack. > > Maybe espfix64 should be disabled when running on Xen and Xen

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread Andy Lutomirski
On Mon, Jul 14, 2014 at 2:31 PM, Andy Lutomirski wrote: > I'm now rather confused. > > On Xen 64-bit, AFAICS, syscall handlers run with CS = 0xe033. I think > that Xen is somehow fixing up traps that came from "kernel" mode to > show CS = 0xe030, which is an impossible selector value (unless

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread Andy Lutomirski
I'm now rather confused. On Xen 64-bit, AFAICS, syscall handlers run with CS = 0xe033. I think that Xen is somehow fixing up traps that came from "kernel" mode to show CS = 0xe030, which is an impossible selector value (unless that segment is conforming) to keep user_mode_vm happy. I'm running

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread Andy Lutomirski
On Mon, Jul 14, 2014 at 10:11 AM, Andy Lutomirski wrote: > On Mon, Jul 14, 2014 at 10:04 AM, H. Peter Anvin wrote: >> On 07/09/2014 04:17 PM, Andy Lutomirski wrote: >>> This part in __do_double_fault looks fishy: >>> >>> cmpl $__KERNEL_CS,CS(%rdi) >>> jne do_double_fault >>> >>>

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread Andy Lutomirski
On Mon, Jul 14, 2014 at 10:04 AM, H. Peter Anvin wrote: > On 07/09/2014 04:17 PM, Andy Lutomirski wrote: >> This part in __do_double_fault looks fishy: >> >> cmpl $__KERNEL_CS,CS(%rdi) >> jne do_double_fault >> >> Shouldn't that be: >> >> test $3,CS(%rdi) >> jnz do_double_fault >>

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread H. Peter Anvin
On 07/09/2014 04:17 PM, Andy Lutomirski wrote: > This part in __do_double_fault looks fishy: > > cmpl $__KERNEL_CS,CS(%rdi) > jne do_double_fault > > Shouldn't that be: > > test $3,CS(%rdi) > jnz do_double_fault > No, it should be fine. The *only* case where we need to do the

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread Konrad Rzeszutek Wilk
On Wed, Jul 09, 2014 at 04:17:57PM -0700, Andy Lutomirski wrote: > This part in __do_double_fault looks fishy: > > cmpl $__KERNEL_CS,CS(%rdi) > jne do_double_fault > > Shouldn't that be: > > test $3,CS(%rdi) > jnz do_double_fault > Let me rope in David, who was playing with

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread Konrad Rzeszutek Wilk
On Wed, Jul 09, 2014 at 04:17:57PM -0700, Andy Lutomirski wrote: This part in __do_double_fault looks fishy: cmpl $__KERNEL_CS,CS(%rdi) jne do_double_fault Shouldn't that be: test $3,CS(%rdi) jnz do_double_fault Let me rope in David, who was playing with that

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread H. Peter Anvin
On 07/09/2014 04:17 PM, Andy Lutomirski wrote: This part in __do_double_fault looks fishy: cmpl $__KERNEL_CS,CS(%rdi) jne do_double_fault Shouldn't that be: test $3,CS(%rdi) jnz do_double_fault No, it should be fine. The *only* case where we need to do the espfix

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread Andy Lutomirski
On Mon, Jul 14, 2014 at 10:04 AM, H. Peter Anvin h...@zytor.com wrote: On 07/09/2014 04:17 PM, Andy Lutomirski wrote: This part in __do_double_fault looks fishy: cmpl $__KERNEL_CS,CS(%rdi) jne do_double_fault Shouldn't that be: test $3,CS(%rdi) jnz do_double_fault No,

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread Andy Lutomirski
On Mon, Jul 14, 2014 at 10:11 AM, Andy Lutomirski l...@amacapital.net wrote: On Mon, Jul 14, 2014 at 10:04 AM, H. Peter Anvin h...@zytor.com wrote: On 07/09/2014 04:17 PM, Andy Lutomirski wrote: This part in __do_double_fault looks fishy: cmpl $__KERNEL_CS,CS(%rdi) jne

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread Andy Lutomirski
I'm now rather confused. On Xen 64-bit, AFAICS, syscall handlers run with CS = 0xe033. I think that Xen is somehow fixing up traps that came from kernel mode to show CS = 0xe030, which is an impossible selector value (unless that segment is conforming) to keep user_mode_vm happy. I'm running

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread Andy Lutomirski
On Mon, Jul 14, 2014 at 2:31 PM, Andy Lutomirski l...@amacapital.net wrote: I'm now rather confused. On Xen 64-bit, AFAICS, syscall handlers run with CS = 0xe033. I think that Xen is somehow fixing up traps that came from kernel mode to show CS = 0xe030, which is an impossible selector value

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread H. Peter Anvin
On 07/14/2014 02:35 PM, Andy Lutomirski wrote: Presumably the problem is here: ENTRY(xen_iret) pushq $0 1:jmp hypercall_iret ENDPATCH(xen_iret) This seems rather unlikely to work on the espfix stack. Maybe espfix64 should be disabled when running on Xen and Xen should

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread Andy Lutomirski
On Mon, Jul 14, 2014 at 3:23 PM, H. Peter Anvin h...@zytor.com wrote: On 07/14/2014 02:35 PM, Andy Lutomirski wrote: Presumably the problem is here: ENTRY(xen_iret) pushq $0 1:jmp hypercall_iret ENDPATCH(xen_iret) This seems rather unlikely to work on the espfix stack. Maybe

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread Andy Lutomirski
On Mon, Jul 14, 2014 at 7:46 PM, Andy Lutomirski l...@amacapital.net wrote: On Mon, Jul 14, 2014 at 3:23 PM, H. Peter Anvin h...@zytor.com wrote: On 07/14/2014 02:35 PM, Andy Lutomirski wrote: Presumably the problem is here: ENTRY(xen_iret) pushq $0 1:jmp hypercall_iret

Re: Is espfix64's double-fault thing OK on Xen?

2014-07-14 Thread H. Peter Anvin
On 07/14/2014 07:46 PM, Andy Lutomirski wrote: On espfix-less kernels (Xen and non-Xen), 16-bit CS w/ 16-bit SS always fails. Native (32-bit or 64-bit, according to the binary) CS with 16-bit SS fails for sigreturn_32, but passes for sigreturn_64. I find this somewhat odd. Native ss

Is espfix64's double-fault thing OK on Xen?

2014-07-09 Thread Andy Lutomirski
This part in __do_double_fault looks fishy: cmpl $__KERNEL_CS,CS(%rdi) jne do_double_fault Shouldn't that be: test $3,CS(%rdi) jnz do_double_fault --Andy -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to

Is espfix64's double-fault thing OK on Xen?

2014-07-09 Thread Andy Lutomirski
This part in __do_double_fault looks fishy: cmpl $__KERNEL_CS,CS(%rdi) jne do_double_fault Shouldn't that be: test $3,CS(%rdi) jnz do_double_fault --Andy -- To unsubscribe from this list: send the line unsubscribe linux-kernel in the body of a message to