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]
Message-ID: <fb622b26-acb0-3203-51fe-62bfa1b5cc5b@oracle.com>
Date:   Fri, 1 Dec 2017 11:57:21 -0500
From:   Boris Ostrovsky <boris.ostrovsky@...cle.com>
To:     Andy Lutomirski <luto@...nel.org>
Cc:     "xen-devel@...ts.xenproject.org" <xen-devel@...ts.xenproject.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>, X86 ML <x86@...nel.org>,
        Juergen Gross <jgross@...e.com>
Subject: Re: [PATCH v2] x86/entry/64/paravirt: Use paravirt-safe macro to
 access eflags

On 12/01/2017 11:22 AM, Andy Lutomirski wrote:
> On Tue, Nov 28, 2017 at 7:28 AM, Boris Ostrovsky
> <boris.ostrovsky@...cle.com> 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@...cle.com>
>> ---
>> V2:
>> * Preserve %rax in DEBUG_ENTRY_ASSERT_IRQS_OFF
>> * Return (pop) %rax in SAVE_FLAGS for !CONFIG_PARAVIRT (irqflags.h)
>>
>>  arch/x86/entry/entry_64.S        |    7 ++++---
>>  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, 19 insertions(+), 3 deletions(-)
>>
>> diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S
>> index f81d50d..c208dc1 100644
>> --- a/arch/x86/entry/entry_64.S
>> +++ b/arch/x86/entry/entry_64.S
>> @@ -466,12 +466,13 @@ END(irq_entries_start)
>>
>>  .macro DEBUG_ENTRY_ASSERT_IRQS_OFF
>>  #ifdef CONFIG_DEBUG_ENTRY
>> -       pushfq
>> -       testl $X86_EFLAGS_IF, (%rsp)
>> +       pushq %rax
>> +       SAVE_FLAGS(CLBR_ANY)
>> +       testl $X86_EFLAGS_IF, %eax
> Confused.  You're both using CLBR_ANY and RAX.  Did you perhaps mean CLBR_NONE?

CLBR_NONE will restore all registers, won't it? So it should be
CLBR_RAX, should it? Otherwise we'll lose return value.

-boris

>
>>         jz .Lokay_\@
>>         ud2
>>  .Lokay_\@:
>> -       addq $8, %rsp
>> +       popq %rax
>>  #endif
>>  .endm
>>
>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ