From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: ARC-Seal: i=1; a=rsa-sha256; t=1516543632; cv=none; d=google.com; s=arc-20160816; b=L/3fJUJ1wGjXU0du2M6AGG84j3XNULUKB8Yg4rBkfS84Zmlf/Sr15wb9R4J7O8GNEf 63bbnj+2K+jQ3bn3G9k/Ooffe+Vsekmw8NelwZJmg0HFPRZdlcQqFm0Zh1u2i/VCybjq cO7SK9KI8Dd8r6kJXK+QJ/cC5n7rcP/HVGeh16CtnTCuXI74fyWbh8g0Ay9Surb6cDeE KnRzKp2ikNZu+Y2KTcZHvAdiA484iafy2Ww7WmYeSKc0vWPricARvt3s5GW5/lpYk7om HpTS4yqWUCnDuxNnSbVcLzgVCpqYaeJ4hIE4EA3Cs3ZX8pB+8fN68TQaDDDIXu+ZWtG2 cL5A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=cc:to:subject:message-id:date:from:references:in-reply-to :mime-version:dkim-signature:arc-authentication-results; bh=ywtZugMWH48Gu09srgMGV0yhklgWlYfyjP5lZRkkTVc=; b=hsKMeWbV2gX1qufoo6zlzw26JDkfrBXIcHqC2vsA5jvui0UiGHMPwsUSSTArqDTypS 7JhuO6Rweeoyn406Sq1bT6igz1Sw06DfsAwOwrOs7ufAZ8zn/rUSwu9T7QMMMZI/MIg2 roHie81dESTfkQFAnPJJnaVHl/lR/fUgjwibJqE3ot0DFhr4G4vboJOSc2MDp9Vy34zD L01h8LgYGt7MsTar45jVFLhvvI47i4wa9T8WOpa3rXWTEWuaEkRnn3zYxbxSrN7hQWUY aZfx56+BbIhVjmtSGEdGeGXdMMPzL6GLLmVCzzkQMRRH9xoFIBGakJL1YLOAhU87Sgmo 3V6w== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Suz8JdjU; spf=pass (google.com: domain of hjl.tools@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=hjl.tools@gmail.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Suz8JdjU; spf=pass (google.com: domain of hjl.tools@gmail.com designates 209.85.220.65 as permitted sender) smtp.mailfrom=hjl.tools@gmail.com; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com X-Google-Smtp-Source: AH8x225YWRYLEp4WVOY9vWgGtnHaZBFFcv9CsVzYYh9Q2JpN4tXGaxwKbSM7o1oiKZDF8KuGffdaoAHy2fVPJ3kyX7s= MIME-Version: 1.0 In-Reply-To: <477cc452f17665440978ae1e227861ca.squirrel@twosheds.infradead.org> References: <1516476182-5153-1-git-send-email-karahmed@amazon.de> <1516476182-5153-5-git-send-email-karahmed@amazon.de> <20180121112224.GH2269@hirez.programming.kicks-ass.net> <477cc452f17665440978ae1e227861ca.squirrel@twosheds.infradead.org> From: "H.J. Lu" Date: Sun, 21 Jan 2018 06:07:11 -0800 Message-ID: Subject: Re: [RFC 04/10] x86/mm: Only flush indirect branches when switching into non dumpable process To: David Woodhouse Cc: Peter Zijlstra , KarimAllah Ahmed , LKML , Andi Kleen , Andrea Arcangeli , Andy Lutomirski , Arjan van de Ven , Ashok Raj , Asit Mallick , Borislav Petkov , Dan Williams , Dave Hansen , David Woodhouse , Greg Kroah-Hartman , "H . Peter Anvin" , Ingo Molnar , Janakarajan Natarajan , Joerg Roedel , Jun Nakajima , Laura Abbott , Linus Torvalds , Masami Hiramatsu , Paolo Bonzini , =?UTF-8?B?UmFkaW0gS3LEjW3DocWZ?= , Thomas Gleixner , Tim Chen , Tom Lendacky , kvm@vger.kernel.org, x86@kernel.org Content-Type: text/plain; charset="UTF-8" X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: =?utf-8?q?1590140567714479425?= X-GMAIL-MSGID: =?utf-8?q?1590211255829396401?= X-Mailing-List: linux-kernel@vger.kernel.org List-ID: On Sun, Jan 21, 2018 at 4:04 AM, David Woodhouse wrote: > >> On Sat, Jan 20, 2018 at 08:22:55PM +0100, KarimAllah Ahmed wrote: >>> From: Tim Chen >>> >>> Flush indirect branches when switching into a process that marked >>> itself non dumpable. This protects high value processes like gpg >>> better, without having too high performance overhead. >> >> So if I understand it right, this is only needed if the 'other' >> executable itself is susceptible to spectre. If say someone audited gpg >> for spectre-v1 and build it with retpoline, it would be safe to not >> issue the IBPB, right? > > > Spectre V2 not v1. V1 is separate. > For V2 retpoline is enough... as long as all the libraries have it too. > >> So would it make sense to provide an ELF flag / personality thing such >> that userspace can indicate its spectre-safe? > > Yes, Arjan and I were pondering that yesterday; it probably does make > sense. Also for allowing a return to userspace after vmexit, if the army > process itself is so marked. Please take a look at how CET is handled in program property in x86-64 psABI for CET: https://github.com/hjl-tools/x86-psABI/wiki/x86-64-psABI-cet.pdf -- H.J.