Received: by 2002:ad5:474a:0:0:0:0:0 with SMTP id i10csp4990513imu; Sun, 25 Nov 2018 14:24:04 -0800 (PST) X-Google-Smtp-Source: AJdET5ehO1gemljwOpgoQ90sSYIv4Pww6Dr4c5om7RtLJx87SSVlC52WCCStdRC2c1N6ezW2QYy2 X-Received: by 2002:a62:1541:: with SMTP id 62mr25239384pfv.230.1543184644331; Sun, 25 Nov 2018 14:24:04 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1543184644; cv=none; d=google.com; s=arc-20160816; b=Ri3ne0TE9OxA7uMROqzBAxZlVii5I/eD0e5wHfiMJXotCql+ErkPCXQ3qRfDZaGdA4 +3dRcCME601E899y6cbNllaBRrPdQ2CicMx2uEBozB0cb2YLk3hEX8RUtUczxcGaJ/kM pzhSGp2k1u20LNY88BKDfbXTD3M0F6Eawf8EdVae339QRKOCbGZj8ikDAy3WgfAj/MpP dGH7nDqc95qlHW1c6rxuWedihymmqDD4XPqAUIBs8nAelZWveDhgIafBeql89QUpX1WJ Wge9SzxVQDH9fAVevTcoiwYtk0pxnUGxUgGEhi8/9MJwLH15/rrHJXuIgaM4CIlHoHD0 9MNg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date; bh=AtqS+MZNbMfvkRvPaOPBV+k7344FbRVOuhUk1UMI+fo=; b=Nlp5ZTgnmtFxBsmUuQ4MDxS0RjptJPr1RtIi9WqCe8zNW+d347uBnAYjXf7MKqa4y+ Lxl5mGkpvvlTuU5ndsKR6lANstQZQrnnx2LWnxRBnOBPKUwqvsTDAwluG2PKjiwTNY+h 58d8Hj/92lPzA6E4vGLK1UOPAd/fPrzYZp7O/ymiz3xsw0pna4AWdm0fwhHd/E7bu1pw x54CwlFbNFYJtdVAg609GebGf3Cf2moinQihO+YBIL2r0QMFWYYmFTYyruMWewt2uiaf 6zabgbuhe2n8HwkaTHnDiv3NIXJWbpQD2DrlUmJiPqz+z/RvRYu1TilpBdwLMrL9s+ex 2v5Q== 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id 3si11146750plo.217.2018.11.25.14.23.49; Sun, 25 Nov 2018 14:24: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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726200AbeKZJNI (ORCPT + 99 others); Mon, 26 Nov 2018 04:13:08 -0500 Received: from Galois.linutronix.de ([146.0.238.70]:53287 "EHLO Galois.linutronix.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726021AbeKZJNI (ORCPT ); Mon, 26 Nov 2018 04:13:08 -0500 Received: from p4fea46ac.dip0.t-ipconnect.de ([79.234.70.172] helo=nanos) by Galois.linutronix.de with esmtpsa (TLS1.2:DHE_RSA_AES_256_CBC_SHA256:256) (Exim 4.80) (envelope-from ) id 1gR2ln-0005cZ-KG; Sun, 25 Nov 2018 23:20:51 +0100 Date: Sun, 25 Nov 2018 23:20:50 +0100 (CET) From: Thomas Gleixner To: Andi Kleen cc: LKML , x86@kernel.org, Peter Zijlstra , Andy Lutomirski , Linus Torvalds , Jiri Kosina , Tom Lendacky , Josh Poimboeuf , Andrea Arcangeli , David Woodhouse , Tim Chen , Dave Hansen , Casey Schaufler , Asit Mallick , Arjan van de Ven , Jon Masters , Waiman Long , Greg KH , Dave Stewart , Kees Cook Subject: Re: [patch V2 21/28] x86/speculation: Prepare for conditional IBPB in switch_mm() In-Reply-To: <20181125205330.GO13936@tassilo.jf.intel.com> Message-ID: References: <20181125183328.318175777@linutronix.de> <20181125185005.466447057@linutronix.de> <20181125205330.GO13936@tassilo.jf.intel.com> User-Agent: Alpine 2.21 (DEB 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII X-Linutronix-Spam-Score: -1.0 X-Linutronix-Spam-Level: - X-Linutronix-Spam-Status: No , -1.0 points, 5.0 required, ALL_TRUSTED=-1,SHORTCIRCUIT=-0.0001 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Sun, 25 Nov 2018, Andi Kleen wrote: > > The current check whether two tasks belong to the same context is using the > > tasks context id. While correct, it's simpler to use the mm pointer because > > it allows to mangle the TIF_SPEC_IB bit into it. The context id based > > mechanism requires extra storage, which creates worse code. > > [We tried similar in some really early versions, but it was replaced > with the context id later.] > > One issue with using the pointer is that the pointer can be reused > when the original mm_struct is freed, and then gets reallocated > immediately to an attacker. Then the attacker may avoid the IBPB. > > Given it's probably hard to generate any reasonable leak bandwidth with > such a complex scenario, but it still seemed better to close the hole. Sorry, but that's really a purely academic exercise. Thanks, tglx