Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp2019723rda; Tue, 24 Oct 2023 09:51:29 -0700 (PDT) X-Google-Smtp-Source: AGHT+IFsXXWoLADQG/e1l0QEqeZdcxvbCOrDSYKZbOGirdFaDDCI8BP1s6I8BH8bkDT9g0d67r4R X-Received: by 2002:a17:902:fb88:b0:1c7:49dd:2df with SMTP id lg8-20020a170902fb8800b001c749dd02dfmr9186077plb.32.1698166288938; Tue, 24 Oct 2023 09:51:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698166288; cv=none; d=google.com; s=arc-20160816; b=yeVxeAVjXMMgbpPjjM9AfANf93KVpAUalp4Y3VNqghCvYShhOoWBqIj1By+gT2dSs6 e5s02QZgpCkbOaUy2QoOTj8YF5vDa7uqW5IRauTraXuuYQT1/7bg8ZTimL99z9LbdJKM B/21ysouyGzxnvoWTJWzSjK/jCWNQhdLTiOR9cOzavXsl5ZMoooOuVbJ8DuBSrYHf07l +uN8ANrX6nkZSRHO2sEKxHWg+T7qpfYwdwK9P/Cfd/zWbim8WisB7oqYU0pDCGQQ8fAC VNUV8eLyyn+D80tjqZi8S7CL4/aR9/AuAO1n47GY5oECy4aqFixGEFSmQsSihZ4eXso+ K12A== 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=sFh7xoL6plHyc2wKnw0mNtqO5rm8eWo25bKekZqAqM0=; fh=q22FrE+3HPFqgIfGSDy85ckjMt4+7YeUp/9thyDx+2k=; b=T2SgnJA8jlIF8gnC9P+BWI8SwpmPQ5gssuRYLHG0bniF3GAwKn8PAkB1Q4kng/RMBu Tl+64TbIeneiKOwfvzRhXSi3y9C2d1dICqk0Mk7bvutQNLcNfB7r+OUPxcop3nNSfCAA 0sJV0eJYrL5dwnE1/rg2bCpyIi2DMpXzbvXAFVa7AUfciar8VKnr16pUcGUE/TabeijA GbOFobMagwB8bcNzj2YDOEEP+B5VU57K+ZmSDYyLZQ3r7x7TMDYxqt4a1lCUzTlb+IVx Yu51yWIkSoV9cK5rvfgmS8w/O4DFwmIO5SwuGEMPoaL+0I23T+Lt2PMn+/3qw2RpzN2R OESg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YxxCOlrJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from pete.vger.email (pete.vger.email. [23.128.96.36]) by mx.google.com with ESMTPS id n12-20020a170903110c00b001bc5a4f56fcsi8700545plh.554.2023.10.24.09.51.26 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 24 Oct 2023 09:51:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) client-ip=23.128.96.36; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=YxxCOlrJ; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.36 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by pete.vger.email (Postfix) with ESMTP id 4B07280401D1; Tue, 24 Oct 2023 09:51:24 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at pete.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234899AbjJXQvP (ORCPT + 99 others); Tue, 24 Oct 2023 12:51:15 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:55780 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S233034AbjJXQvO (ORCPT ); Tue, 24 Oct 2023 12:51:14 -0400 Received: from mgamail.intel.com (mgamail.intel.com [134.134.136.31]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 5A0D512B; Tue, 24 Oct 2023 09:51:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1698166271; x=1729702271; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=LhfLeQjT1NBATI10s/IuG90Bv24jkdT/VZiPecD03ZY=; b=YxxCOlrJIAzJ97/926Qyv3/xpqc8+mRpb8jrQ7FKReUMFvVu/yW0i8DP nq5Hr75+/eljuZAZRgi0empLVpcJdzmnDK3wQUGbeB85wxiU7iSsG+HC5 Myawh48UjqwT1pFlL/2Em/LEOOeHpBNq6atgnPS1zZA6Rihl+VxNgu/Au lvVBVoLWWN6YzjCDnrtX0nJ1t5xfQ4R1TsF4v+Fa6tAvkl1Vj+MohK17q NZZCPGryow67C5dDgU8fvqADgp+aWF9OeTjkz/qzeILkTn/+isL5wt+h/ gSSF+n+J2y/hW0s4LcB7rxQf8B7+xaYJGzQqOg363G6M88E5ee9H6M41m g==; X-IronPort-AV: E=McAfee;i="6600,9927,10873"; a="451339987" X-IronPort-AV: E=Sophos;i="6.03,248,1694761200"; d="scan'208";a="451339987" Received: from orsmga002.jf.intel.com ([10.7.209.21]) by orsmga104.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2023 09:45:38 -0700 X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10873"; a="758530739" X-IronPort-AV: E=Sophos;i="6.03,248,1694761200"; d="scan'208";a="758530739" Received: from zijianw1-mobl.amr.corp.intel.com (HELO desk) ([10.209.109.187]) by orsmga002-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 24 Oct 2023 09:45:37 -0700 Date: Tue, 24 Oct 2023 09:45:20 -0700 From: Pawan Gupta To: Peter Zijlstra 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: <20231024164520.osvqo2dja2xhb7kn@desk> 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> <20231024163621.GD40044@noisy.programming.kicks-ass.net> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20231024163621.GD40044@noisy.programming.kicks-ass.net> X-Spam-Status: No, score=-0.8 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,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 pete.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 (pete.vger.email [0.0.0.0]); Tue, 24 Oct 2023 09:51:24 -0700 (PDT) On Tue, Oct 24, 2023 at 06:36:21PM +0200, Peter Zijlstra wrote: > 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. I didn't know that, doing it this way then. Thanks.