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:   Thu, 14 Oct 2021 09:24:43 +0800
From:   Xiaoyao Li <xiaoyao.li@...el.com>
To:     Sathyanarayanan Kuppuswamy 
        <sathyanarayanan.kuppuwamy@...ux.intel.com>,
        Sean Christopherson <seanjc@...gle.com>,
        Kuppuswamy Sathyanarayanan 
        <sathyanarayanan.kuppuswamy@...ux.intel.com>, xiaoyao.li@...el.com
Cc:     Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>, Borislav Petkov <bp@...en8.de>,
        x86@...nel.org, Paolo Bonzini <pbonzini@...hat.com>,
        David Hildenbrand <david@...hat.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Josh Poimboeuf <jpoimboe@...hat.com>,
        "H . Peter Anvin" <hpa@...or.com>,
        Dave Hansen <dave.hansen@...el.com>,
        Tony Luck <tony.luck@...el.com>,
        Dan Williams <dan.j.williams@...el.com>,
        Andi Kleen <ak@...ux.intel.com>,
        Kirill Shutemov <kirill.shutemov@...ux.intel.com>,
        Kuppuswamy Sathyanarayanan <knsathya@...nel.org>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH v7 6/6] x86/split_lock: Fix the split lock #AC handling
 when running as guest

On 10/14/2021 5:32 AM, Sathyanarayanan Kuppuswamy wrote:
> + Xiaoyao
> 
> On 10/13/21 1:30 PM, Sean Christopherson wrote:
>> On Tue, Oct 05, 2021, Kuppuswamy Sathyanarayanan wrote:
>>> From: Xiaoyao Li <xiaoyao.li@...el.com>
>>>
>>> If running as guest and hypervisor enables
>>> MSR_TEST_CTRL.SPLIT_LOCK_DETECT during its running, it can get split
>>> lock #AC even though sld_state is sld_off.
>> That's a hypervisor bug, no?  The hypervisor should never inject a 
>> fault that
>> the guest cannot reasonably expect.

What if hypervisor doesn't intercept #AC and host enables 
SPLIT_LOCK_DETECT during guest running? That's exactly the case TDX is 
facing.

(BTW, this patch is not complete that no matter what state sld_state is, 
it should always treat it as fatal even sld_warn because sld_warn 
doesn't guarantee SPLIT_LOCK_DETECT is available)

Sathya, we need to drop this one. Andi has anther one to disable split 
lock detection for SPR. That's a better direction.

>>> For kernel mode #AC, it always dies("split lock"), no more action
>>> needed.
>>>
>>> For user mode #AC, it should treat sld_off (default state when feature
>>> is not available) as fatal as well.
>>>
>>> Signed-off-by: Xiaoyao Li <xiaoyao.li@...el.com>
>>> Signed-off-by: Kuppuswamy Sathyanarayanan 
>>> <sathyanarayanan.kuppuswamy@...ux.intel.com>
>>> ---
>>>   arch/x86/kernel/cpu/intel.c | 7 ++++++-
>>>   1 file changed, 6 insertions(+), 1 deletion(-)
>>>
>>> diff --git a/arch/x86/kernel/cpu/intel.c b/arch/x86/kernel/cpu/intel.c
>>> index 01d7935feaed..47f0bc95ce2a 100644
>>> --- a/arch/x86/kernel/cpu/intel.c
>>> +++ b/arch/x86/kernel/cpu/intel.c
>>> @@ -1190,7 +1190,12 @@ static void bus_lock_init(void)
>>>   bool handle_user_split_lock(struct pt_regs *regs, long error_code)
>>>   {
>>> -    if ((regs->flags & X86_EFLAGS_AC) || sld_state == sld_fatal)
>>> +    /*
>>> +     * In virtualization environment, it can get split lock #AC even 
>>> when
>>> +     * sld_off but hypervisor enables it.
>>> +     * Thus only handles when sld_warn explicitly.
>>> +     */
>>> +    if ((regs->flags & X86_EFLAGS_AC) || sld_state != sld_warn)
>>>           return false;
>>>       split_lock_warn(regs->ip);
>>>       return true;
>>> -- 
>>> 2.25.1
>>>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ