From nobody Thu May 7 20:51:10 2026 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by smtp.lore.kernel.org (Postfix) with ESMTP id 89C75C433F5 for ; Wed, 18 May 2022 18:45:07 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S241574AbiERSpF (ORCPT ); Wed, 18 May 2022 14:45:05 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:51688 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S241552AbiERSpE (ORCPT ); Wed, 18 May 2022 14:45:04 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [193.142.43.55]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 9BAD11EEE3D; Wed, 18 May 2022 11:45:00 -0700 (PDT) Date: Wed, 18 May 2022 18:44:57 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1652899498; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=23MV50GdPjU9m2HORd4/zgkwKvmwZmuEql50+DjTl+8=; b=Nk/tgl2bLM9++qjna4dk270LJHDUFIfM2V2VYc8gfo+kBkuPAexRLDpL1gmYcvbf6QxR3H BCLSE5ZCQmi3Iq5YhE9JDCM06tX2nIkU+HsqBvcVoZIScPVuofINNC372kyqWmPtR5InLq EVcOeQpUxDPzEBEoayEQZuk4wQ5EemTiRGrPU4V7jo2iC7RFG1d2MphDF39n1dbEmjTS57 mARwAEbRQLMi0bIvWLDWeTR6FrOTSRyxZx17yqYt2s+R724HPJXotycOmQblR9RfCDVQiw v4QU9nWO3EQsK1gGIHSac8wR9ziQG5L9hc5OT49O79M7ie7te2vlz1QBDEGAIA== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1652899498; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=23MV50GdPjU9m2HORd4/zgkwKvmwZmuEql50+DjTl+8=; b=FfWEri7H4tT4Zuk/hERpMczxP4ZAUGgsyKTbiwbyCVm8kyXYtUOxC6Tasm6qtFAWblocYY Zp4qPpK1ql4dRTCg== From: "tip-bot2 for Lai Jiangshan" Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: x86/sev] x86/sev: Annotate stack change in the #VC handler Cc: Lai Jiangshan , Borislav Petkov , Josh Poimboeuf , x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <20220316041612.71357-1-jiangshanlai@gmail.com> References: <20220316041612.71357-1-jiangshanlai@gmail.com> MIME-Version: 1.0 Message-ID: <165289949701.4207.10740205512652914837.tip-bot2@tip-bot2> Robot-ID: Robot-Unsubscribe: Contact to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: quoted-printable Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org The following commit has been merged into the x86/sev branch of tip: Commit-ID: c42b145181aafd59ed31ccd879493389e3ea5a08 Gitweb: https://git.kernel.org/tip/c42b145181aafd59ed31ccd879493389e= 3ea5a08 Author: Lai Jiangshan AuthorDate: Wed, 16 Mar 2022 12:16:12 +08:00 Committer: Borislav Petkov CommitterDate: Wed, 18 May 2022 20:36:03 +02:00 x86/sev: Annotate stack change in the #VC handler In idtentry_vc(), vc_switch_off_ist() determines a safe stack to switch to, off of the IST stack. Annotate the new stack switch with ENCODE_FRAME_POINTER in case UNWINDER_FRAME_POINTER is used. A stack walk before looks like this: CPU: 0 PID: 0 Comm: swapper Not tainted 5.18.0-rc7+ #2 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 Call Trace: dump_stack_lvl dump_stack kernel_exc_vmm_communication asm_exc_vmm_communication ? native_read_msr ? __x2apic_disable.part.0 ? x2apic_setup ? cpu_init ? trap_init ? start_kernel ? x86_64_start_reservations ? x86_64_start_kernel ? secondary_startup_64_no_verify and with the fix, the stack dump is exact: CPU: 0 PID: 0 Comm: swapper Not tainted 5.18.0-rc7+ #3 Hardware name: QEMU Standard PC (Q35 + ICH9, 2009), BIOS 0.0.0 02/06/2015 Call Trace: dump_stack_lvl dump_stack kernel_exc_vmm_communication asm_exc_vmm_communication RIP: 0010:native_read_msr Code: ... < snipped regs > ? __x2apic_disable.part.0 x2apic_setup cpu_init trap_init start_kernel x86_64_start_reservations x86_64_start_kernel secondary_startup_64_no_verify [ bp: Test in a SEV-ES guest and rewrite the commit message to explain what exactly this does. ] Fixes: a13644f3a53d ("x86/entry/64: Add entry code for #VC handler") Signed-off-by: Lai Jiangshan Signed-off-by: Borislav Petkov Acked-by: Josh Poimboeuf Link: https://lore.kernel.org/r/20220316041612.71357-1-jiangshanlai@gmail.c= om --- arch/x86/entry/entry_64.S | 1 + 1 file changed, 1 insertion(+) diff --git a/arch/x86/entry/entry_64.S b/arch/x86/entry/entry_64.S index 4faac48..f7bd800 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -505,6 +505,7 @@ SYM_CODE_START(\asmsym) call vc_switch_off_ist movq %rax, %rsp /* Switch to new stack */ =20 + ENCODE_FRAME_POINTER UNWIND_HINT_REGS =20 /* Update pt_regs */