From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751710AbdILUJy (ORCPT ); Tue, 12 Sep 2017 16:09:54 -0400 Received: from mx1.redhat.com ([209.132.183.28]:57760 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751676AbdILUJx (ORCPT ); Tue, 12 Sep 2017 16:09:53 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 653775D689 Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx10.extmail.prod.ext.phx2.redhat.com; spf=fail smtp.mailfrom=jpoimboe@redhat.com Date: Tue, 12 Sep 2017 15:09:52 -0500 From: Josh Poimboeuf To: Andy Lutomirski Cc: x86@kernel.org, linux-kernel@vger.kernel.org, Borislav Petkov , Brian Gerst , Andrew Cooper , Juergen Gross , Boris Ostrovsky , Kees Cook Subject: Re: [RFC 12/17] x86/xen/64: Clean up SP code in cpu_initialize_context() Message-ID: <20170912200952.2r7xxgtbjwl7jp6j@treble> References: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.39]); Tue, 12 Sep 2017 20:09:53 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Sep 06, 2017 at 02:36:57PM -0700, Andy Lutomirski wrote: > @@ -293,12 +294,19 @@ cpu_initialize_context(unsigned int cpu, struct task_struct *idle) > #endif > memset(&ctxt->fpu_ctxt, 0, sizeof(ctxt->fpu_ctxt)); > > + /* > + * Bring up the CPU in cpu_bringup_and_idle() with the stack > + * pointing just below where pt_regs would be if it were a normal > + * kernel entry. > + */ > ctxt->user_regs.eip = (unsigned long)cpu_bringup_and_idle; > ctxt->flags = VGCF_IN_KERNEL; > ctxt->user_regs.eflags = 0x1000; /* IOPL_RING1 */ > ctxt->user_regs.ds = __USER_DS; > ctxt->user_regs.es = __USER_DS; > ctxt->user_regs.ss = __KERNEL_DS; > + ctxt->user_regs.cs = __KERNEL_CS; > + ctxt->user_regs.esp = task_top_of_stack(idle) - sizeof(struct pt_regs); Isn't this the same as task_pt_regs(idle)? -- Josh