From patchwork Mon Feb 26 23:52:33 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Pawan Gupta X-Patchwork-Id: 206990 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a05:7300:a81b:b0:108:e6aa:91d0 with SMTP id bq27csp2426889dyb; Mon, 26 Feb 2024 17:10:14 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCXRT5lxWXscQedvKyssiqF3CGgomlqoj9iZZAo/hQhLLCxbejJ+HAySPMVmLyB6TE+RLoKSbr5fmLVxobpAvJ1oX6nIjA== X-Google-Smtp-Source: AGHT+IGf5eTSj3/NuwM93rtpSGj1h/lABeoAtAVMi6VhMNi1CUQdZ+MiTSca5kwD+jy+dQrcODhF X-Received: by 2002:a05:6214:f23:b0:68f:22b1:8e24 with SMTP id iw3-20020a0562140f2300b0068f22b18e24mr1228331qvb.28.1708996214499; Mon, 26 Feb 2024 17:10:14 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708996214; cv=pass; d=google.com; s=arc-20160816; b=IiCw02oc69jk9/I8QktavS2dWWAW53R3Y8UhOhUlmxjNMtciMQkt85MYnvu/SCdlZm YMp77YnFtgXJ3vOFo1LrQBxSmlvlZTStxw8LKQBWjZx9mpK+tWn4jNTsgf54AZeSkqSG 79kHuw+P1g60QP0eG77DM1uLRGAdORaEuf1ewuXKZlSzWcmuoY30wUN42xZOnQnPpQjX 0Q1dRFkpTY/Zfgo2NwGIwJFbPKz74e8Wvm0AB5OnbqKzs62grFv4G6ilhSg4/mlb78kE J+LavYLTnhpjvf6FkpLlPtyJKmzz9ZnxSH4/LBRyI+gtGRgLU16TXcnI29/dmvwD6khw aNlQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-disposition:mime-version:list-unsubscribe:list-subscribe :list-id:precedence:message-id:subject:cc:to:from:date :dkim-signature; bh=KYuxNfHytXCiu750xUqMLTeHDN76m54tB8hq/19FVdM=; fh=/SW4r5cWHmOVQk4Z9jg6TjPU2RamqwhieJHWWEMeL/U=; b=UF5ydQfys1JVx0o1xxrQD/4zSPau9qRVU4xUoVGCuL/KATuhx56taOMDM8nP0W/A0N 9TsD69obQODdDG832XHV+aBJjWpl2dnflFWG/KBL9aO4a2mRR5+WSoOlK6gMeXAJtiny TXWGlm4C5IWWL5wkWlVR+XrNEOORgnw4DvCNtqrtnYJ6pCTNeSCYtXUQl5opAVkKH/yW 29Q23TlFR7rIVmMXu3gQh40XHvZJcjooeYW2xXHaiuVt5dV71Vvah4t8n9Ma9KKUGreH BQMxvpcwYxpjw4jYfbD7QP+Y67DmvLS08re0pczdxECeqX8Q69GUgQSxlCUXbmir61WR l4TA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=eKmUSclU; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-82456-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82456-ouuuleilei=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id gu15-20020a056214260f00b0068ccc1e5d6csi6575576qvb.41.2024.02.26.17.10.14 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 26 Feb 2024 17:10:14 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-82456-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=eKmUSclU; arc=pass (i=1 dkim=pass dkdomain=intel.com dmarc=pass fromdomain=linux.intel.com); spf=pass (google.com: domain of linux-kernel+bounces-82456-ouuuleilei=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-82456-ouuuleilei=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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 438421C22C77 for ; Mon, 26 Feb 2024 23:52:50 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 1B597135A7B; Mon, 26 Feb 2024 23:52:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.b="eKmUSclU" Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.20]) (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 658AE1E894 for ; Mon, 26 Feb 2024 23:52:35 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=198.175.65.20 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708991557; cv=none; b=t0xJF52DaffL8nMiS257jBwGLE1Kyap0+kHL5uzfnGxdg1cGusyaviz6cIdnti0UyLpmj0sqZeUH3SHeb7i54OFtyHHjBOjkYdVbQ6hbm6V5CqDGkxB4c/ss0QJLkf98t0g1m7VDRrfLXSAGP6JC+08C+X7kLAx1PsoH0o4s2Xg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708991557; c=relaxed/simple; bh=XIVySJ6fBrUqstD49rkPpA3Y2psGokotiQmfXjTagF0=; h=Date:From:To:Cc:Subject:Message-ID:MIME-Version:Content-Type: Content-Disposition; b=qZ6mIpuchOR89awBO0bkhCAjSOvpjh2Swd3TYShPlZ32vs7DnXNZrrDUfEiz/KCt16VVnPRmZQxPX2OSBrt199NSSFiAOkdbYPe1IcDDrJUEHoYEVS4b8mGte07ujVgbgnDP+INF6JIG8skehWOz4aWxKX9JafyR83JLUUl26YY= 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=eKmUSclU; arc=none smtp.client-ip=198.175.65.20 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=1708991555; x=1740527555; h=date:from:to:cc:subject:message-id:mime-version; bh=XIVySJ6fBrUqstD49rkPpA3Y2psGokotiQmfXjTagF0=; b=eKmUSclUeXutWPjCmdUxo/PKMYZ5zh4wDlXnrlhGoTI6fgvJVcldNW/t geD2asjt0yNApa9/+Jtb9JSBg9TS+yEK74KEDdPmkaE4KN5d4455UmHIz KKl+8Ov0GBOHEbHaDvxa1fwUP0TeIS4jtVA0xcCNM/FzZiQBW2gZfC3sM 2bbbrV6SruGBUAfocZswn3J322Bw00I2clCUTgL6Hr2W9hwdT7eX4c+3y +cWaEohXImGpyYe3FawuXEhX+7KaIXBG4449/hi/HNcPUoesecslF4Aae o+rTeR8FvdEUnChl0Ewe5d5qhxyQJ2gnozYSUXvZWS2hFSdPDqBS9j83z g==; X-IronPort-AV: E=McAfee;i="6600,9927,10996"; a="3179668" X-IronPort-AV: E=Sophos;i="6.06,187,1705392000"; d="scan'208";a="3179668" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa112.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 15:52:34 -0800 X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.06,187,1705392000"; d="scan'208";a="11511965" Received: from jhaqq-mobl1.amr.corp.intel.com (HELO desk) ([10.209.17.170]) by orviesa004-auth.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 26 Feb 2024 15:52:35 -0800 Date: Mon, 26 Feb 2024 15:52:33 -0800 From: Pawan Gupta To: Thomas Gleixner , Borislav Petkov , Peter Zijlstra , Josh Poimboeuf , Ingo Molnar , Dave Hansen , x86@kernel.org, "H. Peter Anvin" Cc: Daniel Sneddon , Nikolay Borisov , linux-kernel@vger.kernel.org, Pawan Gupta Subject: [PATCH] x86/bugs: Use fixed addressing for VERW operand Message-ID: <20240226-verw-arg-fix-v1-1-7b37ee6fd57d@linux.intel.com> X-B4-Tracking: v=1; b=H4sIAPAj3WUC/x2MQQqAIBAAvxJ7bsEszPpKdBDbbC8WK1gg/T3pO AMzBRIJU4K5KSCUOfEZK3RtA/5wMRDyVhm00oPS2mAmudFJwJ0fHCfjTK+s9cMGNbmEqv53y/q +H0StzMheAAAA X-Mailer: b4 0.12.3 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Disposition: inline X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1792012414422423994 X-GMAIL-MSGID: 1792012414422423994 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(-) --- base-commit: d206a76d7d2726f3b096037f2079ce0bd3ba329b change-id: 20240226-verw-arg-fix-796a63088c4d 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 .endm #else /* __ASSEMBLY__ */