Received: by 10.223.176.46 with SMTP id f43csp1861544wra; Sun, 21 Jan 2018 06:09:04 -0800 (PST) X-Google-Smtp-Source: AH8x226MJt0wnzxh/RE4E4L53+B1I6dsnxOKRlSTZp6OKBZmnogjvZgBNymQRqzGwGdcBPC0GnvV X-Received: by 10.98.60.67 with SMTP id j64mr5387910pfa.217.1516543744052; Sun, 21 Jan 2018 06:09:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1516543744; cv=none; d=google.com; s=arc-20160816; b=j50kYSnxsP+EfeBKmrdZp5grZaxLVmqAiDbFXn6feZuQc+W2at/Vj1MyWJ4Riza5xS PeOJz6i712UKzG5M1RpXBsnTZE8nS+r4BQk/CJcvHLdDtX+kzauDkOxEjkCWwBfo8rtL lVUS6n4iVMcWTEmavkNjjub1HNeLUWzNa6snQyvswSyNfVT92s/l0x7akpsmtdT2bBkm YgVMTy6R9lkM8lj4RRKkuojDOtdC1pHpAOV3aWsTrSvOsosxk2vKfvaHUl65pJT2uTQ/ rjXx4pyjPMJviwybOBbGfFwxm/M2O2qpMc8aN59xGabvmnFRYnzEIpg782f0UI4CsAaq BQ0g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :references:in-reply-to:mime-version:dkim-signature :arc-authentication-results; bh=ywtZugMWH48Gu09srgMGV0yhklgWlYfyjP5lZRkkTVc=; b=MtQIS4ZeMexfuPbCdB7v7+CbWMicOs85y+uomEo+C07lXPGRauCVVbXHeAlUrkgAsw ACBrH5BGdeE57XFjDlYtQnN2cfVffwAsSthJGx6xbpU0VlodJvhr24wnMZmobKDWYw93 UB9XWkiPDBMQboZDkEORzKp/cwiYLkW17bMB6YkxxVAVo/Nj1JVe2S5UbI7ouHM2AOrw jyyq4HOhN/Dcaw9pNC60duPhMM6KKsQccioXmNld6KO6L56TDfyR6CaOQddm1tJN3/B9 iy+vMfCAkbAB7L/iLXCUT+fmfuzS+dpFnpbbrix0ieatGSEhu8F2tz/pqHAYnulzh4/m xbZw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Suz8JdjU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t14si9313845pgn.157.2018.01.21.06.08.49; Sun, 21 Jan 2018 06:09:04 -0800 (PST) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Suz8JdjU; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751351AbeAUOHP (ORCPT + 99 others); Sun, 21 Jan 2018 09:07:15 -0500 Received: from mail-ot0-f193.google.com ([74.125.82.193]:42950 "EHLO mail-ot0-f193.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751004AbeAUOHN (ORCPT ); Sun, 21 Jan 2018 09:07:13 -0500 Received: by mail-ot0-f193.google.com with SMTP id s3so5304421otc.9; Sun, 21 Jan 2018 06:07:12 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:in-reply-to:references:from:date:message-id:subject:to :cc; bh=ywtZugMWH48Gu09srgMGV0yhklgWlYfyjP5lZRkkTVc=; b=Suz8JdjUmYR9G99/hjXNX7a87cVc2AXoHdWw/YZHlYonmmogGMb3uedTvnIOD2/f4+ nOjhI2RuRfBucUhtIvl189ZglXLm0zF3hv5eC0rLdou4LScDLe1XTB3k3vgNExZACI+t IW8MTrkkalB6S77uo9W8mjhZJM+kfhzU+48BviJYuHdpSA6sEcuIxTr7QnpmvWaZL4p9 jEPMMpcKX1xAnazQOjupGhxIN32SsdJ+/rkGasDKkyKBfkqpoE9bsm+kwwzQ9AvFbSmR hn2BEVFgllRLyZlrwXSwHwSnp3A7QDiB9An7RT5xiNX7ptJorBdGEeVfNJPkEXSRnn3O j1ug== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:in-reply-to:references:from:date :message-id:subject:to:cc; bh=ywtZugMWH48Gu09srgMGV0yhklgWlYfyjP5lZRkkTVc=; b=OZe+ZEUDmz3bFld606Af7S78l8xZ257inzeyn0OjY6auWbg4ob7jQ+C13XXejlDD0A ygVQ4AvYZ+q2yf//VTc7DS38cmKnafoBICoelhLVCIuEF+c6xz35lavoLK9/F1zJ4Fz1 eQQItxwWvMGBCFJtitodNdVKsW71iscI/qxX1uHjEcONScDo231r+2nShpwZFkDFF4mh /TgmU/wQOFH7Cli0ybH1sBhHoLaAS0iORC6u5Hq7ylz1GjZDwKP3M3pWKpsXcfixZynh Ay6t9iD52lJy4RdA1U2v+0O+WxLypNiuwbKPHe7D3yVDR6lnDORB+Zz/3Rktb+xEz4no uvwA== X-Gm-Message-State: AKwxytfXzXRFN4fLWizj9cRZ+5oMMotL0uUNX+3hVydB8a5azslU8sx4 iUka3sH8qp+AsfYu3OFEPJKGEGMSvrvtljCs4kY= X-Received: by 10.157.73.175 with SMTP id g47mr2369187otf.315.1516543631676; Sun, 21 Jan 2018 06:07:11 -0800 (PST) MIME-Version: 1.0 Received: by 10.74.160.151 with HTTP; Sun, 21 Jan 2018 06:07:11 -0800 (PST) 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" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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.