Received: by 2002:a5d:9c59:0:0:0:0:0 with SMTP id 25csp2196374iof; Tue, 7 Jun 2022 22:54:03 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzLmV7HjZGkOqG94pXf8Nz0bJTmwFfC/nsGy7Q/SbA3uQ7zAUFkrOP+h/dfIYPpY/aJrILe X-Received: by 2002:a17:902:dacb:b0:167:621b:f2ec with SMTP id q11-20020a170902dacb00b00167621bf2ecmr20379492plx.19.1654667643554; Tue, 07 Jun 2022 22:54:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1654667643; cv=none; d=google.com; s=arc-20160816; b=H/p51Bs2cUbnZ2W9VnSnMlH/Ao8SAhdOB4WfuJmVoY8dCY/O94BdOU1e1XPi+tJFsu GhmcT0gWFfl+sHfKytFRZ0AqJCbiMfJMXfqytNU40mJM1VkrF3GGlh+gbyJGEjSFBwUT Qk5ON2BvlW3NNPDqBXsRhtcW64fH+URjx3aWGlKUpi7r88cgrjM7dKsHb40SUVj6pxhG 3oJleG94Kc3tyWWVRPnsjjr6uOwigteVoePCohL8dENlBJHu/j2xjbYThbw6yfXarj0g yj0IwzZ+1W/f9hJ6gOdejFWB9RVdWkeC5Pnhnz4zXOiUnt8WD4T0fodKKVOyKVmGae96 zLWw== 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 :user-agent:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=SAO08+xX2qaqkkaQljCO+qPROXi4Ph/OLXsUBFx767o=; b=LmAS2BNcbcDZElCTeA3MJT/7rkKv7TFPHcCvoyAg8e9X5110BTnqA7rPr7nKezPqhm LNxEzz8BOjuf/qaa1o1hMYHGXclh3Pc0DusQ5BQDYDvx7H8AigMW+Be8dEWYX603J2s+ Nn4lfb4aBIly/zXic18K6NrHNYjAjZZAws16MFxPditjMClg/++98QsNkz6GHruYStxF JYlxAVOMLhSwwohCVwshXtSZnDfkp4lWr50t1XqOT9ZdhCzH3mqB0TF/I01QMRmRND+B 9Ko8pWkPP2qXqSsMngSOVPDPiDJ+88RxtYOJBU1LSkfaafztpl8obTEPnKkDYxNnqxEy hMwQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TFQKsHM+; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [23.128.96.19]) by mx.google.com with ESMTPS id q2-20020a056a00088200b005190631b525si31175635pfj.148.2022.06.07.22.54.03 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 07 Jun 2022 22:54:03 -0700 (PDT) Received-SPF: softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) client-ip=23.128.96.19; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=TFQKsHM+; spf=softfail (google.com: domain of transitioning linux-kernel-owner@vger.kernel.org does not designate 23.128.96.19 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linuxfoundation.org Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id ACB704AADCF; Tue, 7 Jun 2022 22:20:40 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1388828AbiFHApu (ORCPT + 99 others); Tue, 7 Jun 2022 20:45:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36256 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1378985AbiFGVrM (ORCPT ); Tue, 7 Jun 2022 17:47:12 -0400 Received: from ams.source.kernel.org (ams.source.kernel.org [145.40.68.75]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id DE397237CA7; Tue, 7 Jun 2022 12:07:57 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by ams.source.kernel.org (Postfix) with ESMTPS id A13A2B8220B; Tue, 7 Jun 2022 19:07:55 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 00DE6C385A2; Tue, 7 Jun 2022 19:07:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1654628874; bh=DUDMVzjvFO77UfkyPnXyh1ew4WBBGr7dJc+/dBOGVXo=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=TFQKsHM+wSDCVnEAtM6f2J7szhWzQDK4x22Php3hW4moym2HMN68MzdGnIZuLMgWQ ZcYMC9M/DhLG0cAqOcZ+jRRdkzirYSzbc6rWFDUkUdmgKIy4LIaWO3LYRZUcScMLio crwhKHfUmZAv1NdN5cemnVVMAqh7FJHavdbTkvDo= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Lai Jiangshan , Borislav Petkov , Josh Poimboeuf , Sasha Levin Subject: [PATCH 5.18 486/879] x86/sev: Annotate stack change in the #VC handler Date: Tue, 7 Jun 2022 19:00:04 +0200 Message-Id: <20220607165016.979145538@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220607165002.659942637@linuxfoundation.org> References: <20220607165002.659942637@linuxfoundation.org> User-Agent: quilt/0.66 MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-3.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Lai Jiangshan [ Upstream commit c42b145181aafd59ed31ccd879493389e3ea5a08 ] 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.com Signed-off-by: Sasha Levin --- 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 73d958522b6a..d8376e5fe1af 100644 --- a/arch/x86/entry/entry_64.S +++ b/arch/x86/entry/entry_64.S @@ -508,6 +508,7 @@ SYM_CODE_START(\asmsym) call vc_switch_off_ist movq %rax, %rsp /* Switch to new stack */ + ENCODE_FRAME_POINTER UNWIND_HINT_REGS /* Update pt_regs */ -- 2.35.1