Received: by 2002:a05:6602:18e:0:0:0:0 with SMTP id m14csp2116367ioo; Mon, 23 May 2022 10:24:20 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxQsQPSLYmvfPQXm7LRwQfGLWxZlrl7bPKdw5abevzr7D9eaUiZouQRANb32/x77ci1qqN6 X-Received: by 2002:a62:6dc3:0:b0:505:895a:d38b with SMTP id i186-20020a626dc3000000b00505895ad38bmr24813092pfc.7.1653326660318; Mon, 23 May 2022 10:24:20 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1653326660; cv=none; d=google.com; s=arc-20160816; b=DyCLcmv6XhFo0d+eoIITuXvfa+MockDcnXEwzSsKCtUVvrTi+MKXZGaKwz0mgsPpAQ VzQOQIcvKl2cqviU4kugyY4K3owb7ZxQR/8kQ9/e6BpFaek5ezdTpOSjDTN62CEWkWzc /b/tDHxlxK3pP4HjKdyOYUmUjwyvS1e7cldrfCeyvfVgPVBq9NO7RL4k8VhurJ2EbtvT X3zVaIrlku4D+sHlJ34Q5sUDmjkhhXytWb+Tl2GafUkZGX10H0WxqKC0lXsSltT47w4v o7UHPSAvUXeEBHwzwimtM9560e9HACer5PqYiWRguYWNrWDKfiaoRyN+hK1Zt87HBJU6 uQWQ== 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=vCyShjD9RaSclqws19h+sXLgfifr2ClyeJGX/ZTWYFE=; b=FfEAW2qvZVQa++m6VPskIs1DD9RTyPBNX136V2Oy3R2uDR5DgcsVPtqaCMNUMVVUhj Co6NVe6tIgrsNi92J+6lErpHyEkTUxik3MLSSrVlYW//0aKi+Zxq3uy4BqgbqMStZv62 6NrNKcpVTxgJROF3aoztX4Nj6G3rHEdAUAkk9mMkr3j3BGQuL2yj2VuZn/Yxa1nd1lMm crEaR6lcwMD4sTrrN/r3tsypvIVVv3WXcNCHzbfSoqKTlIerQKIZB1CgyGELTQJRyX1X qVEzpLLPDnlJu0eDNKITRdib5kgmKQWpqj+M9cirElF22GHYwLgXUtFnh+DbjXOwTA/b 1afQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fMNHpgEu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id f2-20020a170902ce8200b00161ba2ffeb8si11702758plg.557.2022.05.23.10.24.17 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 May 2022 10:24:20 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; dkim=pass header.i=@linuxfoundation.org header.s=korg header.b=fMNHpgEu; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 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 D38A08AE6D; Mon, 23 May 2022 10:23:58 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S239857AbiEWRTw (ORCPT + 99 others); Mon, 23 May 2022 13:19:52 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34058 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240597AbiEWRQc (ORCPT ); Mon, 23 May 2022 13:16:32 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 386D719C09; Mon, 23 May 2022 10:16:07 -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 dfw.source.kernel.org (Postfix) with ESMTPS id 554896149F; Mon, 23 May 2022 17:12:53 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4A06FC385A9; Mon, 23 May 2022 17:12:52 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=linuxfoundation.org; s=korg; t=1653325972; bh=06V9Vus7Vl3yeRD0Rjb/alorKB/rQRDsxaTTsJpkre8=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=fMNHpgEufz8NH4WepGaXEvu31fcREeEoiKnFwiM32zLG13wCm5gD9+xJQaX2PHzPv JuxvYUIV+aV1LEFH52SPc0KI6znjclhXHVZcSKStAm05cyMh2dSjQa3qkCQTOnIxCG P5+p2IcSulaCW7qxc+jna8xrQZ8EvlFZxP8cUoTI= From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, Miroslav Benes , Juergen Gross , Markus Boehme Subject: [PATCH 5.4 02/68] x86/xen: Make the boot CPU idle task reliable Date: Mon, 23 May 2022 19:04:29 +0200 Message-Id: <20220523165802.934260353@linuxfoundation.org> X-Mailer: git-send-email 2.36.1 In-Reply-To: <20220523165802.500642349@linuxfoundation.org> References: <20220523165802.500642349@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=-2.6 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: Miroslav Benes commit 2f62f36e62daec43aa7b9633ef7f18e042a80bed upstream. The unwinder reports the boot CPU idle task's stack on XEN PV as unreliable, which affects at least live patching. There are two reasons for this. First, the task does not follow the x86 convention that its stack starts at the offset right below saved pt_regs. It allows the unwinder to easily detect the end of the stack and verify it. Second, startup_xen() function does not store the return address before jumping to xen_start_kernel() which confuses the unwinder. Amend both issues by moving the starting point of initial stack in startup_xen() and storing the return address before the jump, which is exactly what call instruction does. Signed-off-by: Miroslav Benes Reviewed-by: Juergen Gross Signed-off-by: Juergen Gross Signed-off-by: Markus Boehme Signed-off-by: Greg Kroah-Hartman --- arch/x86/xen/xen-head.S | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) --- a/arch/x86/xen/xen-head.S +++ b/arch/x86/xen/xen-head.S @@ -35,7 +35,11 @@ ENTRY(startup_xen) rep __ASM_SIZE(stos) mov %_ASM_SI, xen_start_info - mov $init_thread_union+THREAD_SIZE, %_ASM_SP +#ifdef CONFIG_X86_64 + mov initial_stack(%rip), %rsp +#else + mov pa(initial_stack), %esp +#endif #ifdef CONFIG_X86_64 /* Set up %gs. @@ -51,7 +55,7 @@ ENTRY(startup_xen) wrmsr #endif - jmp xen_start_kernel + call xen_start_kernel END(startup_xen) __FINIT #endif