Received: by 10.223.176.5 with SMTP id f5csp839237wra; Tue, 30 Jan 2018 20:38:24 -0800 (PST) X-Google-Smtp-Source: AH8x227zz8A7cRdMRVGJr1/uEm1svKXOqCFxkKiEGL1TYpn5OXc1HW1k8sISzC1F2w45e49sMN3C X-Received: by 2002:a17:902:8608:: with SMTP id f8-v6mr27926039plo.366.1517373504461; Tue, 30 Jan 2018 20:38:24 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517373504; cv=none; d=google.com; s=arc-20160816; b=xCwQEoZweOO65y1iiz8Wp+BYZEFUBFXAbtjh6qGELRK5luMYXaoMBog04PWxhgB1Ts PJspm0Yw5Q3kLxdYmwORVLi05PG6VtXTofMGUAoXYoR2Lb7RUA3xPRnjP3VF4WsV4nAP 3keMuMfZWmsoFNuJDBq5SJF3fu9Bp7g0QID6O3f8sHn4xKe8575AMI8Gn6s7BVW7RZog ZGGrFGuKa2QSYsGL66iIm4cRC3Rbv1Q9kKyASHvyyRV3tJS+q5BVOOo6+MsgywLZvikH p5QMZa/f/Dbygho3b6v16pFPAwEA89CC/1dn+jh4Fi+VRDA3GRPbV4cD59fH4BovWow4 Y6Cg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:arc-authentication-results; bh=heXgli1NUaVYMlSXzKRzq8xtLAeJ0n5F1k8+S8E7tHI=; b=sjrQoXK6k35csnBL6fFRE0pYehywAQ+UtUqA0KCtl3L8zWb1YStDJLXcZfIr6laMbR Yh1oH7eg0RLs+Olgzp5m3IHKcEdEcGzBn+CoveJM0tUahVt9zGEDZ/iYJB0bfe81RmMW rsG5jCcAmJo3NhimZHFeHIUZ75W2oJcBXP7b06JgucfC8baETtHQDanBhRRnQLwBTqo4 3lTtPlUe+rKQhuvKlPerhhnZSdztPqp1DNiqbHxeFwhC48EtWxLO9pb6MzmzrpeQYqF/ bemAQ7joAzXtZoOfdaYkiua2CWxLgdD7D8N9er1Zxalsz8o5LtBAsYwlJwJ4VJXmVzsU 0bPw== ARC-Authentication-Results: i=1; mx.google.com; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id u13si10263022pgp.790.2018.01.30.20.38.09; Tue, 30 Jan 2018 20:38:24 -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; 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=fail (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753021AbeAaD7j (ORCPT + 99 others); Tue, 30 Jan 2018 22:59:39 -0500 Received: from mx1.redhat.com ([209.132.183.28]:35968 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751598AbeAaD7i (ORCPT ); Tue, 30 Jan 2018 22:59:38 -0500 Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mx1.redhat.com (Postfix) with ESMTPS id D41D7272A3; Wed, 31 Jan 2018 03:59:37 +0000 (UTC) Received: from treble (ovpn-120-124.rdu2.redhat.com [10.10.120.124]) by smtp.corp.redhat.com (Postfix) with SMTP id 1605C5D75F; Wed, 31 Jan 2018 03:59:08 +0000 (UTC) Date: Tue, 30 Jan 2018 21:59:07 -0600 From: Josh Poimboeuf To: Tim Chen Cc: David Woodhouse , arjan@linux.intel.com, tglx@linutronix.de, karahmed@amazon.de, x86@kernel.org, linux-kernel@vger.kernel.org, bp@alien8.de, peterz@infradead.org, pbonzini@redhat.com, ak@linux.intel.com, torvalds@linux-foundation.org, gregkh@linux-foundation.org, mingo@kernel.org, luto@kernel.org, linux@dominikbrodowski.net Subject: Re: [PATCH] x86/speculation: Use Indirect Branch Prediction Barrier in context switch Message-ID: <20180131035907.sye4x7f3e77wnroh@treble> References: <1517263487-3708-1-git-send-email-dwmw@amazon.co.uk> <20180130174850.bwypk4r5yn2344jb@treble> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Wed, 31 Jan 2018 03:59:38 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Tue, Jan 30, 2018 at 01:23:17PM -0800, Tim Chen wrote: > On 01/30/2018 09:48 AM, Josh Poimboeuf wrote: > > On Mon, Jan 29, 2018 at 10:04:47PM +0000, David Woodhouse 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. > > > > I wonder what the point of this patch is. An audit of my laptop shows > > only a single user of PR_SET_DUMPABLE: systemd-coredump. > > This is an opt in approach. For processes who need extra > security, it set itself as non-dumpable. Then it can > ensure that it doesn't see any poisoned BTB. I don't want other users reading my applications' memory. I don't want other containers reading my containers' memory. I don't want *any* user tasks reading root daemons' memory. Those are not unreasonable expectations. So now I have to go and modify all my containers and applications to set PR_SET_DUMPABLE? That seems highly impractical and unlikely. Plus, I happen to *like* core dumps. The other option is to rebuild the entire userland with retpolines, but again, that would make this patch completely pointless. > > [ And yes, I have gpg-agent running. Also, a grep of the gnupg source > > doesn't show any evidence of it being used there. So the gpg thing > > seems to be a myth. ] > > I'm less familiar with gpg-agent. Dave was the one who > put in comments about gpg-agent in this patch so perhaps > he can comment. > > > > > But also, I much preferred the original version of the patch which only > > skipped IBPB when 'prev' could ptrace 'next'. > > For the A->kernel thread->B scenario, you will need context of A > to decide if you need IBPB when switching to B. You need to > worry about whether the context of A has been released ... etc if > you want to use ptrace. Is that why the ptrace approach was abandoned? Surely that's a solvable problem? We have some smart people on lkml. And anyway I didn't see it discussed anywhere. In the worst case we could just always do IBPB when switching between kernel and user tasks. -- Josh