Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp4086570pxb; Wed, 13 Oct 2021 20:38:41 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzueNpE6ZgK3yLXisFygB3Dr8szCTbrpuFSwMxh2w5eIp7TpvjhyzDw3Qgm3y1s11VI8+FR X-Received: by 2002:a63:7447:: with SMTP id e7mr2465857pgn.261.1634182720896; Wed, 13 Oct 2021 20:38:40 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634182720; cv=none; d=google.com; s=arc-20160816; b=Z0isFBE4ZeZbgyHZhdFQsGMcy1+8f0Y7aCL0Px5ZuAoFmvXt9r5ZaBlXxRmdJzmvk0 3l5PJ8iPGxfjkzk3mteVcHZI800b/MT7z/3n3s+dym3b8pPlyL7CDTn5JqJA13qQhyb9 j9irmP17l8v8LrVfHl5nPHHvf3FvDIKUvKQEU+9VRFGc9E+Xd/mcT5GT5WkSSn8Po92m P8RSGFzUWgp3ti81gW1DbsSmn/mmPNfyp0DP70ZsrLaBhY5ySgBdKEQrGNmcY3R30RbJ Wzt3W0cMoynmkC+u3qRMTpgux7NRw8GqpGmFDHR3thmBbztmPbjSTXi1F4ImCKiGkn0I Nylw== 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; bh=1kI2Rkw6YpdObl6e6myBHLkGBf0+xEZMNOZ2amlFD7c=; b=mKkrRxxxLE+rZNGhQLq+dfIB/SpqNlkB+usDYvlllXZlM1nDwjJgvNG8TFcz73NmRa 0F0o2f7SKoUDyF5tQSxyIuhWx/GXYqf0Xje2Uq3dTho8JUrlPsKmfCW8JmlGRWSokkb/ TFQnc4mLDnbIp7xJGMFCBf13fL/khkMt/Hjbi2rHEG6bUMkbJAXb045g8B+18YNI7yDW 2iqb7Vln8E0l3bf1Qkvx+kJp5AolUt4Kz+cDVX1s2Muume+kAglL/mKiTSH2i/nhrpDz B4PpDsgYg00nrvo93O74MphLxchhRpTls/ZY+wqugasYctLR6uxBDj4rcfjJp73bszZU PZJw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=ANMi3TUC; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id hk5si37634pjb.114.2021.10.13.20.38.28; Wed, 13 Oct 2021 20:38:40 -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=@gmail.com header.s=20210112 header.b=ANMi3TUC; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230026AbhJNDjK (ORCPT + 99 others); Wed, 13 Oct 2021 23:39:10 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229966AbhJNDjH (ORCPT ); Wed, 13 Oct 2021 23:39:07 -0400 Received: from mail-pf1-x42b.google.com (mail-pf1-x42b.google.com [IPv6:2607:f8b0:4864:20::42b]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C2D64C061570 for ; Wed, 13 Oct 2021 20:37:02 -0700 (PDT) Received: by mail-pf1-x42b.google.com with SMTP id y7so4278418pfg.8 for ; Wed, 13 Oct 2021 20:37:02 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=1kI2Rkw6YpdObl6e6myBHLkGBf0+xEZMNOZ2amlFD7c=; b=ANMi3TUC0FVYtQrIuMSeNmn4rHc5jXuQFzbXgGEWNd51JK3+7mz1e/w3uwpAtSGh8d 9CoY/LSfBNdFHopjPtZhRKMiakUvyH5/DPCpuoWY4KdwPAEEOyahIBoohK6eRkkkYBc2 F97LBzj97R48SEU2wwXN6s90Czwr5xIO5JQMzK/8y0kmVoyYAUrBKona3TOPbiYj/T/b +TjFQ8+plmX/0DueGcX6h8bvuHQvjuZj4kddOM5iXUz9901aAbUbtIyD3ovJ0Sfrxx74 1OMPuRt8r3CyMqLIyO/efe/35qyvkJx9qybOm0+Go9GAXBkCIZz25nW5SF8qeyOtZsw8 hnRA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=1kI2Rkw6YpdObl6e6myBHLkGBf0+xEZMNOZ2amlFD7c=; b=4ouYyNBLDz3+amXdXjpUipnrG/8+DKTdITSxaGehJmGmpkmLTadGrczfZPwvcS9Yae alTxrmW+MGJ0YMbQ+Xl5/O9ogdfmkh044jJ9DZ37LSygMVC6d9fF4dzvATW5szAUESSD Ja8POh2fj+H4Zd8f+Qml3cw6c5CeLMN9LmPyTzC9t9QkX1Qb6JNbVio6Wdtgd6RUOplD nLFwR0olDezu9ZgtMy/9OlGZ1nUJg69Ri9LEk+xW7AylDM/AsVXxX0f0rmsIyVGV9DlQ iB7ipPzcht0k96h+sROAHRDxdya3S44rQgABZq8mj3mbT2S0nmi/EPcm+YyFp7tQnVgA Lcbw== X-Gm-Message-State: AOAM533JbkRTMbXhWyQCEKS2f/pBzDWW3til8iFFhzLhghBuGsUGGrZd aVY/sG//DeX3KA9pjdT5Q4m0ZKixql0= X-Received: by 2002:a62:6543:0:b0:44c:61a0:555a with SMTP id z64-20020a626543000000b0044c61a0555amr3159627pfb.14.1634182622179; Wed, 13 Oct 2021 20:37:02 -0700 (PDT) Received: from localhost ([198.11.178.15]) by smtp.gmail.com with ESMTPSA id c12sm883785pgw.39.2021.10.13.20.37.01 (version=TLS1_2 cipher=ECDHE-ECDSA-AES128-GCM-SHA256 bits=128/128); Wed, 13 Oct 2021 20:37:01 -0700 (PDT) From: Lai Jiangshan To: linux-kernel@vger.kernel.org Cc: x86@kernel.org, Lai Jiangshan , Andy Lutomirski , Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" Subject: [PATCH V3 30/49] x86/entry: move PUSH_AND_CLEAR_REGS out of paranoid_entry Date: Thu, 14 Oct 2021 11:33:53 +0800 Message-Id: <20211014033414.16321-25-jiangshanlai@gmail.com> X-Mailer: git-send-email 2.19.1.6.gb485710b In-Reply-To: <20211014031413.14471-1-jiangshanlai@gmail.com> References: <20211014031413.14471-1-jiangshanlai@gmail.com> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lai Jiangshan It is prepared for converting the whole paranoid_entry() into C code. No functional change intended. Signed-off-by: Lai Jiangshan --- arch/x86/entry/entry_64.S | 24 +++++++++++++++++------- 1 file changed, 17 insertions(+), 7 deletions(-) diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index 8d873b778681..c9ee58e8e6d1 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -323,9 +323,6 @@ SYM_CODE_END(ret_from_fork) */ .macro idtentry_body cfunc has_error_code:req - PUSH_AND_CLEAR_REGS - ENCODE_FRAME_POINTER - /* * Call error_entry and switch stack settled by sync_regs(). * @@ -404,6 +401,9 @@ SYM_CODE_START(\asmsym) .Lfrom_usermode_no_gap_\@: .endif + PUSH_AND_CLEAR_REGS + ENCODE_FRAME_POINTER + idtentry_body \cfunc \has_error_code _ASM_NOKPROBE(\asmsym) @@ -456,11 +456,14 @@ SYM_CODE_START(\asmsym) pushq $-1 /* ORIG_RAX: no syscall to restart */ + PUSH_AND_CLEAR_REGS + ENCODE_FRAME_POINTER + /* * If the entry is from userspace, switch stacks and treat it as * a normal entry. */ - testb $3, CS-ORIG_RAX(%rsp) + testb $3, CS(%rsp) jnz .Lfrom_usermode_switch_stack_\@ /* paranoid_entry returns GS information for paranoid_exit in EBX. */ @@ -511,11 +514,14 @@ SYM_CODE_START(\asmsym) ASM_CLAC cld + PUSH_AND_CLEAR_REGS + ENCODE_FRAME_POINTER + /* * If the entry is from userspace, switch stacks and treat it as * a normal entry. */ - testb $3, CS-ORIG_RAX(%rsp) + testb $3, CS(%rsp) jnz .Lfrom_usermode_switch_stack_\@ /* @@ -574,6 +580,9 @@ SYM_CODE_START(\asmsym) ASM_CLAC cld + PUSH_AND_CLEAR_REGS + ENCODE_FRAME_POINTER + /* paranoid_entry returns GS information for paranoid_exit in EBX. */ call paranoid_entry UNWIND_HINT_REGS @@ -886,8 +895,6 @@ SYM_CODE_END(xen_failsafe_callback) */ SYM_CODE_START_LOCAL(paranoid_entry) UNWIND_HINT_FUNC - PUSH_AND_CLEAR_REGS save_ret=1 - ENCODE_FRAME_POINTER 8 /* * Always stash CR3 in %r14. This value will be restored, @@ -1307,6 +1314,9 @@ end_repeat_nmi: */ pushq $-1 /* ORIG_RAX: no syscall to restart */ + PUSH_AND_CLEAR_REGS + ENCODE_FRAME_POINTER + /* * Use paranoid_entry to handle SWAPGS and CR3. */ -- 2.19.1.6.gb485710b