Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2012083rda; Tue, 24 Oct 2023 09:36:59 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH3eaQyppo3K2Ss+a04w3ib//G2xOia0qXb4E9VKf5ZlHCXtDHMhRe3LQFskUsnwH9olIuB X-Received: by 2002:a17:903:2289:b0:1ca:86db:1d2f with SMTP id b9-20020a170903228900b001ca86db1d2fmr15881957plh.43.1698165419124; Tue, 24 Oct 2023 09:36:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698165419; cv=none; d=google.com; s=arc-20160816; b=xOzTGN0vd7iD31KlkwlL6pq4rF7Ugjv+S/irDnQFkhXdN8naZC99a2Qw3ib0NRnLE3 ysSNrHrwFZaVZw7AIQPZrz+93dQnfqvvj0KAegzhF3NKM/VMfTHN2ayoWMdwK9Smkcsy 68krOvgDHWDKrBqfcBMCOen0bG111LyxF+aCLyOp1f9MtzImUmF6Im+VYy/KVz/j/xzK tZKONnBB73NpeeYGGTgODwY0GM6aeX60HNM9v9q2M2ehAcyxn+XFo6HS/rheYYcf4In3 E4LhTD/BuA1CJs2Gn/lTDb+cqWpcsiuRF56fhoALsC9mPsFGfzxuM1D99AJI0ITg2g4M mSGw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=FRhM1lkxrMQXB6nBknGKk7DxO1qxF/oGT3Z0ktDXX/c=; fh=FtUvlj3N+mHXQqmPX59TJy8Xsw0SZcoZZJJFTd27Pr0=; b=w1YVkcg+w1TJ6STaPAQgnB8rACx6pKa3zjvs7mNaIv0uM63fVQ/64MwKZCtqsritFE W2+LRp2fxFa4CABWqMGWwm+hu/9NQbVcLWtVe6PNUFw5pY/9X8o/0KBVmHc9y4n395xC NX6cBwTspoyGWkBpOJLDNaJhpxwBvyurpOCl1kmd7mNP8J4TorCTBkfxlaIaOxKKLBo1 SAQzW9/vhLBznXzdwhfRneyq3oXGfD1YZLk/XW+W3ppenjXfKrelTJ1o8fij7pnsij5M 3QExkcLrYsw4HxHT55iKCdWmmV37g5AnQCX6HlO6aIj/M9tWiORjbgjBmES7fXN3qkel Ctaw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=bvia4VeL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id h12-20020a170902704c00b001c624237977si8646984plt.252.2023.10.24.09.36.58 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 09:36:59 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@infradead.org header.s=desiato.20200630 header.b=bvia4VeL; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 3C4808039EC9; Tue, 24 Oct 2023 09:36:57 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234889AbjJXQgv (ORCPT + 99 others); Tue, 24 Oct 2023 12:36:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36594 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S234898AbjJXQgp (ORCPT ); Tue, 24 Oct 2023 12:36:45 -0400 Received: from desiato.infradead.org (desiato.infradead.org [IPv6:2001:8b0:10b:1:d65d:64ff:fe57:4e05]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1872C93; Tue, 24 Oct 2023 09:36:43 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=infradead.org; s=desiato.20200630; h=In-Reply-To:Content-Type:MIME-Version: References:Message-ID:Subject:Cc:To:From:Date:Sender:Reply-To: Content-Transfer-Encoding:Content-ID:Content-Description; bh=FRhM1lkxrMQXB6nBknGKk7DxO1qxF/oGT3Z0ktDXX/c=; b=bvia4VeLbi96QgUtm2UwDli3dl sD5sTqhoOKDHRkgmNgdpLszg1kwxUjO9vfBlgEViuJReaFKzlGwpl+1r94ig5eFb5jAWpfAM05VcI l6ew3hQ2TkPFk+UwXNuNGFdFxLq/RLAfw1Lnb4PYf9wzRP6582UY7hEN7pjnUx2ytUfdj/kAUr0Dd nUse4Z5ibfKe2COkrTmzj3AIIh1WHXltbvk/jSmvgW4FcfrlE3t5JVymO94gQuDuTicL2Rd8n2H0P bkofqcMFA1Jd+X1LKHLHaLoL35pUo5YeI+woc+579kPk4t/GTz03Zs1UjA8Pfrbu8Fvl35vURJ96+ u2prTGew==; Received: from j130084.upc-j.chello.nl ([24.132.130.84] helo=noisy.programming.kicks-ass.net) by desiato.infradead.org with esmtpsa (Exim 4.96 #2 (Red Hat Linux)) id 1qvKOE-00Fdzk-0V; Tue, 24 Oct 2023 16:36:22 +0000 Received: by noisy.programming.kicks-ass.net (Postfix, from userid 1000) id C9A5B300451; Tue, 24 Oct 2023 18:36:21 +0200 (CEST) Date: Tue, 24 Oct 2023 18:36:21 +0200 From: Peter Zijlstra To: Pawan Gupta Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , Dave Hansen , x86@kernel.org, "H. Peter Anvin" , Josh Poimboeuf , Andy Lutomirski , Jonathan Corbet , Sean Christopherson , Paolo Bonzini , tony.luck@intel.com, ak@linux.intel.com, tim.c.chen@linux.intel.com, linux-kernel@vger.kernel.org, linux-doc@vger.kernel.org, kvm@vger.kernel.org, Alyssa Milburn , Daniel Sneddon , antonio.gomez.iglesias@linux.intel.com, Alyssa Milburn Subject: Re: [PATCH v2 1/6] x86/bugs: Add asm helpers for executing VERW Message-ID: <20231024163621.GD40044@noisy.programming.kicks-ass.net> References: <20231024-delay-verw-v2-0-f1881340c807@linux.intel.com> <20231024-delay-verw-v2-1-f1881340c807@linux.intel.com> <20231024103601.GH31411@noisy.programming.kicks-ass.net> <20231024163515.aivo2xfmwmbmlm7z@desk> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231024163515.aivo2xfmwmbmlm7z@desk> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIM_SIGNED,DKIM_VALID, DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Tue, 24 Oct 2023 09:36:57 -0700 (PDT) On Tue, Oct 24, 2023 at 09:35:15AM -0700, Pawan Gupta wrote: > On Tue, Oct 24, 2023 at 12:36:01PM +0200, Peter Zijlstra wrote: > > On Tue, Oct 24, 2023 at 01:08:21AM -0700, Pawan Gupta wrote: > > > > > +.macro CLEAR_CPU_BUFFERS > > > + ALTERNATIVE "jmp .Lskip_verw_\@;", "jmp .Ldo_verw_\@", X86_FEATURE_CLEAR_CPU_BUF > > > + /* nopl __KERNEL_DS(%rax) */ > > > + .byte 0x0f, 0x1f, 0x80, 0x00, 0x00; > > > +.Lverw_arg_\@: .word __KERNEL_DS; > > > +.Ldo_verw_\@: verw _ASM_RIP(.Lverw_arg_\@); > > > +.Lskip_verw_\@: > > > +.endm > > > > Why can't this be: > > > > ALTERNATIVE "". "verw _ASM_RIP(mds_verw_sel)", X86_FEATURE_CLEAR_CPU_BUF > > > > And have that mds_verw_sel thing be out-of-line ? > > I haven't done this way because its a tad bit fragile as it depends on > modules being within 4GB of kernel. We 100% rely on that *everywhere*, nothing fragile about it.