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, 25 Jan 2018 13:04:23 -0800
From:   Andy Lutomirski <luto@...nel.org>
To:     Peter Zijlstra <peterz@...radead.org>
Cc:     Tim Chen <tim.c.chen@...ux.intel.com>,
        Andy Lutomirski <luto@...nel.org>,
        Arjan van de Ven <arjan@...ux.intel.com>,
        LKML <linux-kernel@...r.kernel.org>,
        KarimAllah Ahmed <karahmed@...zon.de>,
        Andi Kleen <ak@...ux.intel.com>,
        Andrea Arcangeli <aarcange@...hat.com>,
        Ashok Raj <ashok.raj@...el.com>,
        Asit Mallick <asit.k.mallick@...el.com>,
        Borislav Petkov <bp@...e.de>,
        Dan Williams <dan.j.williams@...el.com>,
        Dave Hansen <dave.hansen@...el.com>,
        David Woodhouse <dwmw@...zon.co.uk>,
        Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
        "H . Peter Anvin" <hpa@...or.com>, Ingo Molnar <mingo@...hat.com>,
        Janakarajan Natarajan <Janakarajan.Natarajan@....com>,
        Joerg Roedel <joro@...tes.org>,
        Jun Nakajima <jun.nakajima@...el.com>,
        Laura Abbott <labbott@...hat.com>,
        Linus Torvalds <torvalds@...ux-foundation.org>,
        Masami Hiramatsu <mhiramat@...nel.org>,
        Paolo Bonzini <pbonzini@...hat.com>,
        Radim Krcmar <rkrcmar@...hat.com>,
        Thomas Gleixner <tglx@...utronix.de>,
        Tom Lendacky <thomas.lendacky@....com>, X86 ML <x86@...nel.org>
Subject: Re: [RFC PATCH 1/2] x86/ibpb: Skip IBPB when we switch back to same
 user process

On Thu, Jan 25, 2018 at 12:46 PM, Peter Zijlstra <peterz@...radead.org> wrote:
> On Thu, Jan 25, 2018 at 11:32:46AM -0800, Tim Chen wrote:
>>
>> This patch is not ideal as it comes with the caveats that
>> patch 2 tries to close.  I put it out here to see if it can prompt
>> people to come up with a better solution. Keeping active_mm around would
>> have been cleaner but it looks like there are issues that Andy mentioned.
>>
>> The "A -> idle -> A" case would not trigger IBPB if tlb_defer_switch_to_init_mm()
>> is true (non pcid) as we does not change the mm.
>>
>> This patch tries to address the case when we do switch to init_mm and back.
>> Do you still have objections to the approach in this patch
>> to save the last active mm before switching to init_mm?
>
> I still think the existing active_mm is sufficient. Something like:
>
>   switch_mm()
>   {
>         ...
>         if (prev && next != prev)
>                 ibpb();
>         ...
>   }
>
> should work. Because while the idle crud does leave_mm() and PCID does
> enter_lazy_tlb() and both end up doing: switch_mm(NULL, &init_mm, NULL),
> nothing there affects tsk->active_mm.
>
> So over the "A -> idle -> A" transition, active_mm should actually track
> what you want.
>
>

Can we please not rely on any of the active_mm shit?  That thing has
really weird semantics and should just die.

That being said, just stashing last_user_mm without any refcounting
should be fine.  After all, the only thing anyone does with it is
comparing to next, and next is always alive.  Or we could use
last_user_ctx_id, since we already have a never-reused ctx_id for each
mm on x86.

--Andy

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ