Received: by 2002:a25:e7d8:0:0:0:0:0 with SMTP id e207csp578275ybh; Thu, 12 Mar 2020 07:22:10 -0700 (PDT) X-Google-Smtp-Source: ADFU+vtnNCXLdwCyYn6Y55viMWFmiUx3LFCAU/e+MQy5sZPRP00ZT1uh6GRyRT4fIKIkzvK6jylZ X-Received: by 2002:a9d:5e04:: with SMTP id d4mr6407253oti.36.1584022930246; Thu, 12 Mar 2020 07:22:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1584022930; cv=none; d=google.com; s=arc-20160816; b=qht3OWtJMu//uJJKpQMHrH/Nk3qISYaJWcRjme5IJPfvsbEVDaVQijo2axXJ3JXZlh B1yXDdUzwLRSZWMhwCwDdAd39+1rzGXjOBR85TZIyzp1YxCtlNgpG539px4s5S7ZA3pN FQSf/cTRzRvFovxHlVolPn5iqZvbwmRIvxHR15vx0flMYEhT48832/CZhIeu7onx/15K Ryiymq7luPV1ZTC3aKGIDvDvYfAutRilmLqtpQs3anxKMMlPDOk7CseCi3y+a5E/01Fk +4qETYlYM1I6V4PIAbW09t+/EDyZ4Ig6JRiyHOqvc2sp3oWWA1MkRQ62eoNdChUVm8KG JxBQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=Yy/abpKLzPGJ3dyCZYn+2MT0dTt5GpHnHXP5L0dc3jY=; b=VSgJLzT7A3zy380zjxdsSYoGYUSd6r0cjDfbEdaOnT43fdybs6Zk0MwmHEWLsPji4m ZrExQETzo6CwFi8zNDie8lJggtUunPGLRfPqj/IXpigXt9mTNDAEInyxlX+a4b9mPtj5 9yzq71R0VRvikmHmk2UUhtvdV4g5imAHSdikUQ3NtjsvE/TSGIQ5J/BMmfVhChiBMw1f nXDDxDUfwmKC01YLfFfPlPCQtQgxx20T7h2BjL1OQ+02RYbF1WhSKLeBb9ss09Lxaecy 0T/jl0rCY6RRckP254UwGGDLRvzLB9HTHlM33iGtB2nRstV2E0tBcQMKaVS97ndZc9D5 BdGw== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id y7si484965otb.91.2020.03.12.07.21.57; Thu, 12 Mar 2020 07:22:10 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727595AbgCLOUS (ORCPT + 99 others); Thu, 12 Mar 2020 10:20:18 -0400 Received: from mx2.suse.de ([195.135.220.15]:58356 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727340AbgCLOUM (ORCPT ); Thu, 12 Mar 2020 10:20:12 -0400 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 Cc: x86@kernel.org, xen-devel@lists.xenproject.org, linux-kernel@vger.kernel.org, live-patching@vger.kernel.org, jslaby@suse.cz, Miroslav Benes Subject: [PATCH 1/2] x86/xen: Make the boot CPU idle task reliable 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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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 -- 2.25.1