Received: by 2002:a05:6a10:206:0:0:0:0 with SMTP id 6csp2791036pxj; Mon, 10 May 2021 10:47:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw4ZrYqw7QsekNDSWyPOO4ZJ9FiKIjHNjkA1XWNS57pDdi5p3SUGTVAvWwEkD1xwIorJN+W X-Received: by 2002:a92:d486:: with SMTP id p6mr17143412ilg.235.1620668853658; Mon, 10 May 2021 10:47:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1620668853; cv=none; d=google.com; s=arc-20160816; b=vQ8rmIUpEXMO1wNae4b1QdUyePRngA+uSRSEJ+rlYnWSljOjsogy0+85cRnU7vTa9k wBlrLZ5VcNrbYqd2MMGYgZ/W1C/oh3B5eEUlXignCtXLNHjs+JZeRkonZJpYXDKdO5/0 jkoWAF7ikZ2PTSbHnjDvT3mBz2jVfmQ6M98XGNCyY8ULD8hATVtdGDjKh8d6k7TLtB+U Wb6gMrKMHQu5dkGj70CeoFzBz9zeUNgQiUMbxOD9cP+N+pl15CucUHi8y4dpcmY8775N yxEbhsgHhURDG7E1GQWvaOkDxP2TiNwxpGCVkgZ8onsbX5faMmCSh08ovIgJ1sUNBi5c p33w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-filter; bh=7zzEAq64ESXNZfItBhsP50MWC9r1d0W8O+dRebRph+s=; b=v5/SK6XwpIfa03B0PwpeDG5wAFubUGPMeI7+nG8PXNqM7JVeUSx03X0do6j+RtcU58 SwswCA5V7YjuSjUO+TBOhd5Vw0ldChSVotcmLHbPNskoNEpVbcYgezeFoxLSL1dfBPtW lkDd7POcKmGE9Lz0JfSFGeVbamGR/D7+NzCd8GOxd3bPIyPUNlWXlTIhh8aKFOxp50II dzf6gf8WoOR1aDq5bPtLAqKakGMsSN0z6a5S5V2qkgsq17Qw9NwMnbY7TRLpoNEzqG/6 m/N3QdGfek8T3cobF104J7ovYbxRBLrV19oxmM9MtokyXAJ/gmOSa/6iJNkcVHT/b7sc 8a5g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@zytor.com header.s=2021042801 header.b=V5EAktyX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id d4si18050004iow.13.2021.05.10.10.47.20; Mon, 10 May 2021 10:47:33 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@zytor.com header.s=2021042801 header.b=V5EAktyX; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=zytor.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S233167AbhEJRrO (ORCPT + 99 others); Mon, 10 May 2021 13:47:14 -0400 Received: from terminus.zytor.com ([198.137.202.136]:59531 "EHLO mail.zytor.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S232975AbhEJRqp (ORCPT ); Mon, 10 May 2021 13:46:45 -0400 Received: from tazenda.hos.anvin.org ([IPv6:2601:646:8602:8be0:7285:c2ff:fefb:fd4]) (authenticated bits=0) by mail.zytor.com (8.16.1/8.15.2) with ESMTPSA id 14AHjGkG2449170 (version=TLSv1.3 cipher=TLS_AES_256_GCM_SHA384 bits=256 verify=NO); Mon, 10 May 2021 10:45:29 -0700 DKIM-Filter: OpenDKIM Filter v2.11.0 mail.zytor.com 14AHjGkG2449170 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=zytor.com; s=2021042801; t=1620668729; bh=7zzEAq64ESXNZfItBhsP50MWC9r1d0W8O+dRebRph+s=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=V5EAktyXyXNbMGGSjlwpGjoEJ9QxZ47U+b2XA80EHBu30lkNbuR5QYN8aWSiwxUJ+ vdYaHrybv1+7k2AIu8L4kLyVb7WGAGUYqiPzIIKPQVMRuj4Y9yRmLujoLe5zH87vQ9 jKrp3fFmWSF7om7RicXRr5izt7e+s2AmyRarAgqZFJ/FLFSSW5Gd3Ba4iv1UAuFA4Y rEQw/v7ApfVcv9iKFpxKu9Sl+9WufNyRUUwcADE/LwXj31/oUli2xttDPYuRAEOiGI +mZYePMqstXLTK9oX9y/pVgxPn99knQldQutm2L5yFai5E5kf4q4Gb9Fo3XDqSwiGE 2VGPKXtbZoJFw== From: "H. Peter Anvin" To: Ingo Molnar , Thomas Gleixner , Andy Lutomirski , Borislav Petkov Cc: "H. Peter Anvin" , Linux Kernel Mailing List Subject: [RFC PATCH 6/6] x86/entry: split PUSH_AND_CLEAR_REGS into two submacros Date: Mon, 10 May 2021 10:45:09 -0700 Message-Id: <20210510174509.3039991-7-hpa@zytor.com> X-Mailer: git-send-email 2.31.1 In-Reply-To: <20210510174509.3039991-1-hpa@zytor.com> References: <20210510174509.3039991-1-hpa@zytor.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: "H. Peter Anvin (Intel)" PUSH_AND_CLEAR_REGS, as the name implies, performs two functions: pushing registers and clearing registers. They don't necessarily have to be performed in immediate sequence, although all current users do. Split it into two macros for the case where that isn't desired; the FRED enabling patchset will eventually make use of this. Signed-off-by: H. Peter Anvin (Intel) --- arch/x86/entry/calling.h | 9 ++++++++- 1 file changed, 8 insertions(+), 1 deletion(-) diff --git a/arch/x86/entry/calling.h b/arch/x86/entry/calling.h index 7436d4a74ecb..a4c061fb7c6e 100644 --- a/arch/x86/entry/calling.h +++ b/arch/x86/entry/calling.h @@ -63,7 +63,7 @@ For 32-bit we have the following conventions - kernel is built with * for assembly code: */ -.macro PUSH_AND_CLEAR_REGS rdx=%rdx rax=%rax save_ret=0 +.macro PUSH_REGS rdx=%rdx rax=%rax save_ret=0 .if \save_ret pushq %rsi /* pt_regs->si */ movq 8(%rsp), %rsi /* temporarily store the return address in %rsi */ @@ -90,7 +90,9 @@ For 32-bit we have the following conventions - kernel is built with .if \save_ret pushq %rsi /* return address on top of stack */ .endif +.endm +.macro CLEAR_REGS /* * Sanitize registers of values that a speculation attack might * otherwise want to exploit. The lower registers are likely clobbered @@ -112,6 +114,11 @@ For 32-bit we have the following conventions - kernel is built with .endm +.macro PUSH_AND_CLEAR_REGS rdx=%rdx rax=%rax save_ret=0 + PUSH_REGS rdx=\rdx, rax=\rax, save_ret=\save_ret + CLEAR_REGS +.endm + .macro POP_REGS pop_rdi=1 skip_r11rcx=0 popq %r15 popq %r14 -- 2.31.1