From patchwork Thu Mar 12 14:20:06 2020 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Miroslav Benes X-Patchwork-Id: 11434479 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D782A14B4 for ; Thu, 12 Mar 2020 14:50:44 +0000 (UTC) Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id BE6FF20674 for ; Thu, 12 Mar 2020 14:50:44 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org BE6FF20674 Authentication-Results: mail.kernel.org; dmarc=none (p=none dis=none) header.from=suse.cz Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=xen-devel-bounces@lists.xenproject.org Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jCP9a-0000ZN-I9; Thu, 12 Mar 2020 14:49:42 +0000 Received: from all-amaz-eas1.inumbo.com ([34.197.232.57] helo=us1-amaz-eas2.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.89) (envelope-from ) id 1jCOh1-0006XZ-T6 for xen-devel@lists.xenproject.org; Thu, 12 Mar 2020 14:20:11 +0000 X-Inumbo-ID: 94cb597b-646c-11ea-b19e-12813bfff9fa Received: from mx2.suse.de (unknown [195.135.220.15]) by us1-amaz-eas2.inumbo.com (Halon) with ESMTPS id 94cb597b-646c-11ea-b19e-12813bfff9fa; Thu, 12 Mar 2020 14:20:11 +0000 (UTC) X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 3CAA6B2F1; Thu, 12 Mar 2020 14:20:10 +0000 (UTC) From: Miroslav Benes To: boris.ostrovsky@oracle.com, jgross@suse.com, sstabellini@kernel.org, tglx@linutronix.de, mingo@redhat.com, bp@alien8.de, hpa@zytor.com, jpoimboe@redhat.com Date: Thu, 12 Mar 2020 15:20:06 +0100 Message-Id: <20200312142007.11488-2-mbenes@suse.cz> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20200312142007.11488-1-mbenes@suse.cz> References: <20200312142007.11488-1-mbenes@suse.cz> MIME-Version: 1.0 X-Mailman-Approved-At: Thu, 12 Mar 2020 14:49:40 +0000 Subject: [Xen-devel] [PATCH 1/2] x86/xen: Make the boot CPU idle task reliable X-BeenThere: xen-devel@lists.xenproject.org X-Mailman-Version: 2.1.23 Precedence: list List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Cc: x86@kernel.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, xen-devel@lists.xenproject.org, Miroslav Benes , jslaby@suse.cz Errors-To: xen-devel-bounces@lists.xenproject.org Sender: "Xen-devel" 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. Signed-off-by: Miroslav Benes --- arch/x86/xen/xen-head.S | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/arch/x86/xen/xen-head.S b/arch/x86/xen/xen-head.S index 1d0cee3163e4..642f346bfe02 100644 --- a/arch/x86/xen/xen-head.S +++ b/arch/x86/xen/xen-head.S @@ -35,7 +35,7 @@ SYM_CODE_START(startup_xen) rep __ASM_SIZE(stos) mov %_ASM_SI, xen_start_info - mov $init_thread_union+THREAD_SIZE, %_ASM_SP + mov $init_thread_union+THREAD_SIZE-SIZEOF_PTREGS, %_ASM_SP #ifdef CONFIG_X86_64 /* Set up %gs. @@ -51,7 +51,9 @@ SYM_CODE_START(startup_xen) wrmsr #endif + push $1f jmp xen_start_kernel +1: SYM_CODE_END(startup_xen) __FINIT #endif