All of lore.kernel.org
 help / color / mirror / Atom feed
From: Juergen Gross <jgross@suse.com>
To: Boris Ostrovsky <boris.ostrovsky@oracle.com>,
	linux-kernel@vger.kernel.org, xen-devel@lists.xenproject.org
Cc: tglx@linutronix.de, mingo@redhat.com, x86@kernel.org,
	luto@kernel.org, hpa@zytor.com
Subject: Re: [PATCH] x86/entry/64/paravirt: Use paravirt-safe macro to access eflags
Date: Mon, 27 Nov 2017 20:22:28 +0100	[thread overview]
Message-ID: <be726c34-865b-e238-9fa2-96d0df859e13__21081.3878723004$1511810627$gmane$org@suse.com> (raw)
In-Reply-To: <1511805918-8041-1-git-send-email-boris.ostrovsky@oracle.com>

On 27/11/17 19:05, Boris Ostrovsky wrote:
> Commit 1d3e53e8624a ("x86/entry/64: Refactor IRQ stacks and make
> them NMI-safe") added DEBUG_ENTRY_ASSERT_IRQS_OFF macro that acceses
> eflags using 'pushfq' instruction when testing for IF bit. On PV Xen
> guests looking at IF flag directly will always see it set, resulting
> in 'ud2'.
> 
> Introduce SAVE_FLAGS() macro that will use appropriate save_fl pv op
> when running paravirt.
> 
> Signed-off-by: Boris Ostrovsky <boris.ostrovsky@oracle.com>
> ---
>  arch/x86/entry/entry_64.S        |    5 ++---
>  arch/x86/include/asm/irqflags.h  |    3 +++
>  arch/x86/include/asm/paravirt.h  |    9 +++++++++
>  arch/x86/kernel/asm-offsets_64.c |    3 +++
>  4 files changed, 17 insertions(+), 3 deletions(-)
> 
> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
> index f81d50d..4bb7719 100644
> --- a/arch/x86/entry/entry_64.S
> +++ b/arch/x86/entry/entry_64.S
> @@ -466,12 +466,11 @@ END(irq_entries_start)
>  
>  .macro DEBUG_ENTRY_ASSERT_IRQS_OFF
>  #ifdef CONFIG_DEBUG_ENTRY
> -	pushfq
> -	testl $X86_EFLAGS_IF, (%rsp)
> +	SAVE_FLAGS(CLBR_ANY)
> +	testl $X86_EFLAGS_IF, %eax

Are you sure %eax is allowed to be modified?

>  	jz .Lokay_\@
>  	ud2
>  .Lokay_\@:
> -	addq $8, %rsp
>  #endif
>  .endm
>  
> diff --git a/arch/x86/include/asm/irqflags.h b/arch/x86/include/asm/irqflags.h
> index c8ef23f..7f65f3f 100644
> --- a/arch/x86/include/asm/irqflags.h
> +++ b/arch/x86/include/asm/irqflags.h
> @@ -142,6 +142,9 @@ static inline notrace unsigned long arch_local_irq_save(void)
>  	swapgs;					\
>  	sysretl
>  
> +#ifdef CONFIG_DEBUG_ENTRY
> +#define SAVE_FLAGS(x)		pushfq

Isn't there a "pop %rax" missing (assuming %rax is allowed to be
modified) ?


Juergen

_______________________________________________
Xen-devel mailing list
Xen-devel@lists.xenproject.org
https://lists.xenproject.org/mailman/listinfo/xen-devel

  parent reply	other threads:[~2017-11-27 19:22 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-11-27 18:05 [PATCH] x86/entry/64/paravirt: Use paravirt-safe macro to access eflags Boris Ostrovsky
2017-11-27 19:22 ` Juergen Gross
2017-11-27 21:40   ` Boris Ostrovsky
2017-11-27 21:40     ` Boris Ostrovsky
2017-11-27 19:22 ` Juergen Gross [this message]
2017-11-27 18:05 Boris Ostrovsky

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='be726c34-865b-e238-9fa2-96d0df859e13__21081.3878723004$1511810627$gmane$org@suse.com' \
    --to=jgross@suse.com \
    --cc=boris.ostrovsky@oracle.com \
    --cc=hpa@zytor.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=luto@kernel.org \
    --cc=mingo@redhat.com \
    --cc=tglx@linutronix.de \
    --cc=x86@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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.