Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1605348rbb; Mon, 26 Feb 2024 15:25:05 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWY2Z9GU1/zOQoZOOqNnZT4jiv8Ni2hiIgfr1E8i3zu7D8SvcweqIubLIJQKPDWxXIY0I5huwaLWhhupbs2OMLepa1CQwt/LFrtxj7Gnw== X-Google-Smtp-Source: AGHT+IEf+DHQKAYB+P3Owb0sMK0B+LqWDPDnOpBZmiDeJ/vQ5dkd2m0FGRXdsrPoRqUtGs3h6twJ X-Received: by 2002:a62:c186:0:b0:6e4:d0ed:d2b8 with SMTP id i128-20020a62c186000000b006e4d0edd2b8mr7149288pfg.16.1708989905601; Mon, 26 Feb 2024 15:25:05 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708989905; cv=pass; d=google.com; s=arc-20160816; b=vsv0i7FrrrS1CVGUXTUSNyMYlSlyNuhDV3cv9YTFwhq3wHUDjWLvlc48q7ZkgRUzEw T8YaPH4qJ6YwJwtKz3v3Y8PD9BDUqZglikr9Ysj5eB5n8aHGHxwD1YDpB/l3GdxKmYwu 1vljPF+Wo44YZM7cVsCxlDDnPa+XF6vWBXGzXOYbsWNpD2p1d4sDjD0AEwuLw4vB7osD orj3yYsNZDVKMSKoFNqYj7V/F1NSJkIHwWfrMs8h6JHVQkpA5Fc/3yEPYVFxxhsJtvwC JYa/HVCMANLO7hRheWcIlWUyCb6MqeumLZzsTkhk5889Wnm5yNIwx5mIwTgJFZTdCN9s tPOA== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-disposition:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:message-id:subject:cc :to:from:date:dkim-signature; bh=LcbV7AzhUOCbXnSdG96G0CemynidY0/GaWCKFmEda4Q=; fh=Um3KunzAsBmlUHpVJIDhgAjHDTtuo+b0CGJr4QeE1c8=; b=QBqBbrbao5DnMrNXg7OGsTfC01Be36jSAG7/wlQnUl4a1Ehtb0MlvT0ncYGl9cW0tX zDShbN8iHRthcYMCEs2GYdT0jbt0m4Cep9NcDElazKhbK91jqvPpyv/MMzey/rM10Ac7 w/aiQ9L1HN+2Uyw9aHydwWk4jSO9bbOIuzw1s4R1kSkrKy+/xj2urjJEX1PSMSgFk/Pl KEEn8cKQ/7ZlmOeLbkOnp/tPZIf5K62mrnuCGYs0vlBLRmwhykM/CFqqwkxvHgxcQ/KK XmOBJtPe5jbziNuEICDQMmT1NWLW4oWwn8weLGTcgcBKlfgAFmVrvkRwH0ZkSWzg724X ICZw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VEam6rVe; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-82381-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82381-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id jw38-20020a056a0092a600b006e4d63436b8si2183265pfb.184.2024.02.26.15.25.05 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 15:25:05 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82381-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=VEam6rVe; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-82381-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82381-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 6B75EB21A55 for ; Mon, 26 Feb 2024 22:11:13 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 0560F131E3B; Mon, 26 Feb 2024 22:11:07 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="VEam6rVe" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.14]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B788F1EA72; Mon, 26 Feb 2024 22:11:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.14 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708985466; cv=none; b=c0fJ/n28epG+nEwlSjxFWj/EdWCTEe3TIKPqs7hBlQu6ObqJD8RShDKElQ/O+R2ijQS9Dbq91hU45hU/zotKpEwl0tnsLFqSQ0dMVap3G0UgR9MRuct9/15O2fB03xCwYowptJFyG868B93E61ToQp0cvBZcZMT5hSwrtwAlUFA= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708985466; c=relaxed/simple; bh=aLP1wrwgND98W3fl2x4ZMt1cA9P2D4b6s5545BhBdRA=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=gNPrDHLktTqjVN/SiYOeu/Rh3DWE6mfsz6u92e5USIS6aP3F7X1ag8135mAqxfUtCPYTi9o6uQ88t5DOQpOD39/qi7nx/I93fc7fwXXAqXC1vLKQ1ZFvK8be4gfV8oPorQ5O5dlUgjca3BDWNCxk9iDp3nZn26VVv2dj008ycQw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com; spf=none smtp.mailfrom=linux.intel.com; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b=VEam6rVe; arc=none smtp.client-ip=198.175.65.14 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=linux.intel.com Authentication-Results: smtp.subspace.kernel.org; spf=none smtp.mailfrom=linux.intel.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1708985462; x=1740521462; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=aLP1wrwgND98W3fl2x4ZMt1cA9P2D4b6s5545BhBdRA=; b=VEam6rVeShjbXNBpnszmCLS6L6xle8F8d5BZfdr52JMlVNRATnb+Z2th 9nUB5vnyZ2HtpWbN2cnPcE52ypjH/fZVyfNKNCwbWFqtVk8ISGQ7V8Mrp GGP6huu9xDe1aDo+nkt9x2ukQ82lZzQCyWZOjF+y4/XP1D+9IWwudoCkR 9rD9Vt7tLJq9H3w5N/20p8Qa663Ac8DCOeRVoljk3TOkePbkjDKDHyf9W ah3Jta+tCkNHyDWFmMSDMQIDKltraul9gN7lxvi74i8TKHrPaLCcDvMhu iyixFxJjfCJHTunmdNIs34K2XnnEZmHlTrbAGpLYEupxrQq4cLSZ5ASKU w==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="7119032" X-IronPort-AV: E=Sophos;i="6.06,186,1705392000"; d="scan'208";a="7119032" Received: from orviesa005.jf.intel.com ([10.64.159.145]) by orvoesa106.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 14:11:02 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,186,1705392000"; d="scan'208";a="11596128" Received: from jhaqq-mobl1.amr.corp.intel.com (HELO desk) ([10.209.17.170]) by orviesa005-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 14:11:01 -0800 Date: Mon, 26 Feb 2024 14:10:59 -0800 From: Pawan Gupta To: Nikolay Borisov Cc: linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org, Alyssa Milburn , Andrew Cooper , Peter Zijlstra , Dave Hansen , x86@kernel.org Subject: Re: [tip: x86/urgent] x86/bugs: Add asm helpers for executing VERW Message-ID: <20240226221059.mnuurhn6g3irys37@desk> References: <170839092792.398.3678407222202963581.tip-bot2@tip-bot2> <6380ba8d-4e99-46e6-8d92-911d10963ba7@suse.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <6380ba8d-4e99-46e6-8d92-911d10963ba7@suse.com> On Mon, Feb 26, 2024 at 09:17:30AM +0200, Nikolay Borisov wrote: > > diff --git a/arch/x86/include/asm/nospec-branch.h b/arch/x86/include/asm/nospec-branch.h > > index 262e655..077083e 100644 > > --- a/arch/x86/include/asm/nospec-branch.h > > +++ b/arch/x86/include/asm/nospec-branch.h > > @@ -315,6 +315,17 @@ > > #endif > > .endm > > +/* > > + * Macro to execute VERW instruction that mitigate transient data sampling > > + * attacks such as MDS. On affected systems a microcode update overloaded VERW > > + * instruction to also clear the CPU buffers. VERW clobbers CFLAGS.ZF. > > + * > > + * Note: Only the memory operand variant of VERW clears the CPU buffers. > > + */ > > +.macro CLEAR_CPU_BUFFERS > > + ALTERNATIVE "", __stringify(verw _ASM_RIP(mds_verw_sel)), X86_FEATURE_CLEAR_CPU_BUF > > Any particular reason why this uses RIP-relative vs an absolute address > mode? Early versions of the series had the VERW arg pointing to the macro itself, that is why relative addressing was used. That got changed in a later version with all VERW sites pointing to a single memory location. > I know in our private exchange you said there is no significance but > for example older kernels have a missing relocation support in alternatives. > This of course can be worked around by slightly changing the logic of the > macro which means different kernels will have slightly different macros. Do you anticipate a problem with that? If yes, I can send a patch to use fixed addressing in upstream as well.