Received: by 2002:a05:7208:9594:b0:7e:5202:c8b4 with SMTP id gs20csp1811721rbb; Tue, 27 Feb 2024 01:44:11 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCX9LW6D5OadKyk1wI5lc0Oj+fd6uhRWmyB5Hiw3q3OiecH1zPZUXHdJyCjMuLlpZz71R8IYLvDZZBdCe/PpEDOGzA02VzhIXf6iiJyuFw== X-Google-Smtp-Source: AGHT+IEaAFdcaxRzhWb4A2AWcREkyHH0Og3qOinkGxq8ABl02YNV57EzX7+MqAcu8b2sT+6UVqfC X-Received: by 2002:a17:90a:a89:b0:299:3332:a649 with SMTP id 9-20020a17090a0a8900b002993332a649mr7707727pjw.18.1709027050841; Tue, 27 Feb 2024 01:44:10 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709027050; cv=pass; d=google.com; s=arc-20160816; b=qTgyx0qnzUrglbqiLfyasNjCo4yJr/0OtRFPQjoee7A78c2psj3+Ip9S0825Ci7UHa KfHo/UiEeyHj+VRKipuXTRP63opcDbxfiOyb9383XV/KVfXtpj2we0K5Pr7MWCiErg6g 80CvtgPocDMeokYVqj+JIdikr1GOccOuvUvxIv2bzgBU7JXtc6uvu69TNuauVGEzDNHy UkrWKZgAjNxsfgHfl2krbQukHxpeGqth7H+20iDMnmx//nAjl8lxebH5MB270GmUYufs UrdnlvtfLYYEVwwTs9LoCuKS/uRWxJgVpBxHMUGj/tiUMbZbOtaczfSmsc/Dzy3kR7WM Tbzw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version :list-unsubscribe:list-subscribe:list-id:precedence:date:message-id; bh=BZtneY2221lsZSEsmdoaC1eV3+M74BwSZ3O0IWrGErE=; fh=UZ++oaiqwIxUvvkqvNifxK+1IT03KbxWFTGyTUvwpfY=; b=dScgyXjrXJL1NdIgkpjdLATOi1odnk1IOXbNbUqImdg+kUoWo6bYmnVcQCSkJ5nMBf 7JQxWQ34bXBnjRDg2udmQOxkaSY2e5LgjMmwhMV5vHvt/UEMqJvCubOIqW0RHvZNA9Jh hU6BKLSqBTBf+2qGSRxwdVu94VLIw6iIY4OkNXYhqqnLFXWAyfDgRTCokDE44s2TzoHN zFekzFAzdIT6l+zkyBkS/KWa2efkk1qFR0RF2K9Xr+Jhqyd9/9Rz3sR+kOrxSTfGkmw+ WyCGAvRYsuppF8aTgms6vTnnFVRwxgKNBlazpYryAiaHHFmKy8qKDIbwRGnhDWjmJZ8j k3EQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-82986-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82986-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id hk15-20020a17090b224f00b0029ae1d2019fsi953005pjb.56.2024.02.27.01.44.10 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 27 Feb 2024 01:44:10 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82986-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=gmail.com); spf=pass (google.com: domain of linux-kernel+bounces-82986-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82986-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org 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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 852F8282D72 for ; Tue, 27 Feb 2024 09:44:10 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 99BFD13699D; Tue, 27 Feb 2024 09:43:58 +0000 (UTC) Received: from mail-wr1-f51.google.com (mail-wr1-f51.google.com [209.85.221.51]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 4B268136989 for ; Tue, 27 Feb 2024 09:43:56 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.221.51 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709027038; cv=none; b=p+Ga3EX12o5B0ZszZ7Ij/xUiAhZixw97rbgB/tUiIDqDdzcBEzLsiSgdaGBItkvbfa18rgaZClh/4yYkUTqJITYDUi23RIzKw1beIhW7SCmSMQhM9hHes89KfALfgY3ymEK7UUZUlfk4b9mje6hvYxobLLh2pwsbjJX20IwXaVw= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709027038; c=relaxed/simple; bh=eY9mLWvWENbzvvnDFf61NURLD+YUY43q8xe+W2oscqU=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=JytAbcgjdUXwXH2rYFUpl4/Mz3U9ogmS9Bq6Rh2ugRg+SOnASIxjwhO6KVRxl9Qkdhc08Q9RtXHn+fdwisA/MHK9J2pyqJYFp85bTJDxL/XuQuWVRvx0GXCMYAjLdpLhgBf62vGBu4gbcArqopPa4oEYFy8KA724gYPbF3xRoYo= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org; spf=pass smtp.mailfrom=gmail.com; arc=none smtp.client-ip=209.85.221.51 Authentication-Results: smtp.subspace.kernel.org; dmarc=fail (p=none dis=none) header.from=kernel.org Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Received: by mail-wr1-f51.google.com with SMTP id ffacd0b85a97d-33d6f1f17e5so2824241f8f.3 for ; Tue, 27 Feb 2024 01:43:56 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1709027035; x=1709631835; h=content-transfer-encoding:in-reply-to:autocrypt:from:references:cc :to:content-language:subject:user-agent:mime-version:date:message-id :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=BZtneY2221lsZSEsmdoaC1eV3+M74BwSZ3O0IWrGErE=; b=KX0MoAJ4tdqnjmi7t6mZpHihaqNXoFB92wF3gOwLBVFn9FPIXH8Kis7gysemKUxQox lgMGe2PcFMeSHyFYjhsDDopI4vGQva4+knEaNh0UmRWUPQc4VCglrk+/6xIFn1VzCwAt oplTPSzDwfMLIQJO2etZKDufVmzOTpgCpoM/hJRTO1OnsjxpL/XXVQF6hT1Nueya7miS bYXXfaLFkQpaPmw6ji9OJua2+79jXV0f62f0Ww2i+LA8qytQy4HMV2t1UzZV7/74HQBB V1ASswrpfSWlXxQbbajul2Hz6/YtIjopBgzHjgPIbCV2gPnLT49PBvSNw+cXprnhaQYx WaLw== X-Forwarded-Encrypted: i=1; AJvYcCUNKmC8czV8h0nMzf3M/x9W4YPiU+HTDUlP+V24kgr0l9SDI+c6uXNEmiO6BugJ6ky67ubeZrUsObM1a4UgTb9DnbSrnif5VfAXlYxc X-Gm-Message-State: AOJu0Yyd8jXfqcHGqzYzSHQ9fPmt/9H3Rm5SMWwkTVDA4HVxHIXSaydP xuEH0wnSta8wDnK4eGJnhL+Zw1Zc1nX+mMldFKKt5/q5JcOGmNPcoYLFKUSN X-Received: by 2002:adf:e6c8:0:b0:33d:6334:e14 with SMTP id y8-20020adfe6c8000000b0033d63340e14mr5938816wrm.11.1709027034445; Tue, 27 Feb 2024 01:43:54 -0800 (PST) Received: from ?IPV6:2a0b:e7c0:0:107::aaaa:59? ([2a0b:e7c0:0:107::aaaa:59]) by smtp.gmail.com with ESMTPSA id by6-20020a056000098600b0033d568f8310sm10976586wrb.89.2024.02.27.01.43.53 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Tue, 27 Feb 2024 01:43:54 -0800 (PST) Message-ID: <373674e4-cbd0-44d7-98c7-304b0ab4f34b@kernel.org> Date: Tue, 27 Feb 2024 10:43:53 +0100 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] x86/bugs: Use fixed addressing for VERW operand Content-Language: en-US To: Nikolay Borisov , Pawan Gupta , Thomas Gleixner , Borislav Petkov , Peter Zijlstra , Josh Poimboeuf , Ingo Molnar , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Cc: Daniel Sneddon , linux-kernel@vger.kernel.org References: <20240226-verw-arg-fix-v1-1-7b37ee6fd57d@linux.intel.com> <92440f47-21b7-4f4f-ad99-a99358cfbedf@suse.com> From: Jiri Slaby Autocrypt: addr=jirislaby@kernel.org; keydata= xsFNBE6S54YBEACzzjLwDUbU5elY4GTg/NdotjA0jyyJtYI86wdKraekbNE0bC4zV+ryvH4j rrcDwGs6tFVrAHvdHeIdI07s1iIx5R/ndcHwt4fvI8CL5PzPmn5J+h0WERR5rFprRh6axhOk rSD5CwQl19fm4AJCS6A9GJtOoiLpWn2/IbogPc71jQVrupZYYx51rAaHZ0D2KYK/uhfc6neJ i0WqPlbtIlIrpvWxckucNu6ZwXjFY0f3qIRg3Vqh5QxPkojGsq9tXVFVLEkSVz6FoqCHrUTx wr+aw6qqQVgvT/McQtsI0S66uIkQjzPUrgAEtWUv76rM4ekqL9stHyvTGw0Fjsual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gAwW35rpnq4f/EYTykbk1sa13Tav6btJ+4QOgbcezWI wZ5w/JVfEJW9JXp3BFAVzRQ5nVrrLDAJZ8Y5ioWcm99JtSIIxXxt9FJaGc1Bgsi5K/+dyTKL wLMJgiBzbVx8G+fCJJ9YtlNOPWhbKPlrQ8+AY52Aagi9WNhe6XfJdh5g6ptiOILm330mkR4g W6nEgZVyIyTq3ekOuruftWL99qpP5zi+eNrMmLRQx9iecDNgFr342R9bTDlb1TLuRb+/tJ98 f/bIWIr0cqQmqQ33FgRhrG1+Xml6UXyJ2jExmlO8JljuOGeXYh6ZkIEyzqzffzBLXZCujlYQ DFXpyMNVJ2ZwPmX2mWEoYuaBU0JN7wM+/zWgOf2zRwhEuD3A2cO2PxoiIfyUEfB9SSmffaK/ S4xXoB6wvGENZ85Hg37C7WDNdaAt6Xh2uQIly5grkgvWppkNy4ZHxE+jeNsU7tg= In-Reply-To: <92440f47-21b7-4f4f-ad99-a99358cfbedf@suse.com> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 8bit On 27. 02. 24, 9:47, Nikolay Borisov wrote: > > > On 27.02.24 г. 1:52 ч., Pawan Gupta wrote: >> Macro used for MDS mitigation executes VERW with relative addressing for >> the operand. This is unnecessary and creates a problem for backports on >> older kernels that don't support relocations in alternatives. Relocation >> support was added by commit 270a69c4485d ("x86/alternative: Support >> relocations in alternatives"). Also asm for fixed addressing is much >> more cleaner than relative RIP addressing. >> >> Simplify the asm by using fixed addressing for VERW operand. >> >> Fixes: baf8361e5455 ("x86/bugs: Add asm helpers for executing VERW") >> Reported-by: Nikolay Borisov >> Closes: >> https://lore.kernel.org/lkml/20558f89-299b-472e-9a96-171403a83bd6@suse.com/ >> Signed-off-by: Pawan Gupta >> --- >>   arch/x86/include/asm/nospec-branch.h | 2 +- >>   1 file changed, 1 insertion(+), 1 deletion(-) >> >> diff --git a/arch/x86/include/asm/nospec-branch.h >> b/arch/x86/include/asm/nospec-branch.h >> index 2aa52cab1e46..ab19c7f1167b 100644 >> --- a/arch/x86/include/asm/nospec-branch.h >> +++ b/arch/x86/include/asm/nospec-branch.h >> @@ -323,7 +323,7 @@ >>    * 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 >> +    ALTERNATIVE "", __stringify(verw mds_verw_sel), >> X86_FEATURE_CLEAR_CPU_BUF > > Actually thinking about it more and discussing with Jiri (cc'ed), will > this work with KASLR enabled? I might of course be wrong. We appear to rely on the asm+linker here. Please see also: https://lore.kernel.org/r/fd8f2df0-563e-4f5c-aca4-bc92a14e9426@kernel.org thanks, -- js suse labs