linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Jan Beulich <jbeulich@suse.com>
To: Andy Lutomirski <luto@kernel.org>
Cc: lkml <linux-kernel@vger.kernel.org>,
	"xen-devel@lists.xenproject.org" <xen-devel@lists.xenproject.org>
Subject: Ping: [PATCH] x86/stackframe/32: repair 32-bit Xen PV
Date: Thu, 24 Oct 2019 09:40:16 +0200	[thread overview]
Message-ID: <279e6368-7446-9419-fef9-c4069b6aee5a@suse.com> (raw)
In-Reply-To: <ef1c9381-dfc7-7150-feca-581f4d798513@suse.com>

On 07.10.2019 12:41, Jan Beulich wrote:
> Once again RPL checks have been introduced which don't account for a
> 32-bit kernel living in ring 1 when running in a PV Xen domain. The
> case in FIXUP_FRAME has been preventing boot; adjust BUG_IF_WRONG_CR3
> as well just in case.
> 
> Fixes: 3c88c692c287 ("x86/stackframe/32: Provide consistent pt_regs")
> Signed-off-by: Jan Beulich <jbeulich@suse.com>

Ping?

I'd like to further note that there appears to a likely related
2nd problem - I'm seeing seemingly random attempts to enter VM86
mode when running PV under Xen. I suspect a never written eflags
value to get inspected. While the issue here kills the kernel
reliably during boot, that other issue sometimes allows the
system to at least come up in a partly functional way (depending
on which user processes get killed because of there not being
any VM86 mode available when running PV under [64-bit] Xen).

Jan

> --- a/arch/x86/entry/entry_32.S
> +++ b/arch/x86/entry/entry_32.S
> @@ -48,6 +48,17 @@
>  
>  #include "calling.h"
>  
> +#ifndef CONFIG_XEN_PV
> +# define USER_SEGMENT_RPL_MASK SEGMENT_RPL_MASK
> +#else
> +/*
> + * When running paravirtualized on Xen the kernel runs in ring 1, and hence
> + * simple mask based tests (i.e. ones not comparing against USER_RPL) have to
> + * ignore bit 0. See also the C-level get_kernel_rpl().
> + */
> +# define USER_SEGMENT_RPL_MASK (SEGMENT_RPL_MASK & ~1)
> +#endif
> +
>  	.section .entry.text, "ax"
>  
>  /*
> @@ -172,7 +183,7 @@
>  	ALTERNATIVE "jmp .Lend_\@", "", X86_FEATURE_PTI
>  	.if \no_user_check == 0
>  	/* coming from usermode? */
> -	testl	$SEGMENT_RPL_MASK, PT_CS(%esp)
> +	testl	$USER_SEGMENT_RPL_MASK, PT_CS(%esp)
>  	jz	.Lend_\@
>  	.endif
>  	/* On user-cr3? */
> @@ -217,7 +228,7 @@
>  	testl	$X86_EFLAGS_VM, 4*4(%esp)
>  	jnz	.Lfrom_usermode_no_fixup_\@
>  #endif
> -	testl	$SEGMENT_RPL_MASK, 3*4(%esp)
> +	testl	$USER_SEGMENT_RPL_MASK, 3*4(%esp)
>  	jnz	.Lfrom_usermode_no_fixup_\@
>  
>  	orl	$CS_FROM_KERNEL, 3*4(%esp)
> 


  reply	other threads:[~2019-10-24  7:40 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-07 10:41 [PATCH] x86/stackframe/32: repair 32-bit Xen PV Jan Beulich
2019-10-24  7:40 ` Jan Beulich [this message]
2019-10-24 16:11 ` Andy Lutomirski
2019-10-24 16:31   ` [Xen-devel] " Andrew Cooper
2019-10-24 16:33     ` Andy Lutomirski
2019-10-25  6:06   ` Jan Beulich
2019-10-25  6:09     ` Jürgen Groß

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=279e6368-7446-9419-fef9-c4069b6aee5a@suse.com \
    --to=jbeulich@suse.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=xen-devel@lists.xenproject.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).