Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp856052ybt; Wed, 1 Jul 2020 11:41:28 -0700 (PDT) X-Google-Smtp-Source: ABdhPJz9F+0LybFHCu+/3sb8aY+7eNTK4o5Yra1X/Q1ItWejOPAiEqf/uwbFw4Hphz0OR0BftIx2 X-Received: by 2002:a17:906:fa9b:: with SMTP id lt27mr23429149ejb.513.1593628888579; Wed, 01 Jul 2020 11:41:28 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593628888; cv=none; d=google.com; s=arc-20160816; b=scyefBVJSUrxk6FPKq6q1zkQyQkmBFTyIGIuHrrF3XIZSxe09h4V6YnPdd76Pi/8N0 AWxozAqbvjU3cQaxSqr9ii+1S6U2WGIctWex4rbEV3CCfsHy/8PX2cLXIoAnC3b20iW3 TNyjgH0Z8S1kAUkto+2s5WjJlrI3PoOSZL4z6gkPSjcM+jEXl6/PAehA6RnTp6QnJLAu +gzr/cnBLA/yBQiqJTcRtaoyLY7RZzSTb2Scy3o6s43+LXa2lB1wAz7oUl1x7Apuhwc1 1ZiEzyQyl7jFYXqq6Cn2FzLWbZtb8Zyf/Kw+DprRJeuWp9Wll2OTWCwBw0QYfYG+zGUo RCCg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:dkim-signature; bh=7tr8l81de9IDbrUsWax8Vw6bmb8HAtbDT6G/r1Q45sA=; b=d6fJ3GCILPCA37dIVdAOJMHuFoTEZa8RUyXiBxjpVYPjlH4PVhd+8w02ZQEkhETfzR 4G+ISBA5v2r9sC4GKhdAEXPPHHXViG2zBJJ9DMWIJdx7Q12wFArB7zfATelatSXN+xKi kHt4nVRNJTq9pj2KEERP1RUJlhkTK4Wnw0G1+U3gPSRorGOFWJLRLkce31kmr2kSTbwP cWGVIgFViBDKB430wOA176MtGg8W5SIdbLgnSHe1gDcwlqa82F4ssYEkhFTRtG4QyKuW IfodsXApT103PRk4vfDleCBbnq2seyTlgxJt5elfpmZ1MC3N57GVXPOr3OYju5vbYSrp /iHQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EekpatgC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id p6si4339708edx.295.2020.07.01.11.41.05; Wed, 01 Jul 2020 11:41:28 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=default header.b=EekpatgC; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726255AbgGASjz (ORCPT + 99 others); Wed, 1 Jul 2020 14:39:55 -0400 Received: from mail.kernel.org ([198.145.29.99]:52676 "EHLO mail.kernel.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1725440AbgGASjy (ORCPT ); Wed, 1 Jul 2020 14:39:54 -0400 Received: from mail-wr1-f53.google.com (mail-wr1-f53.google.com [209.85.221.53]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPSA id A36A0208D5 for ; Wed, 1 Jul 2020 18:39:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=default; t=1593628793; bh=BzgN9CdkNj8KsNJpO6Dp3dgk25B6SZxEFrbbFo9+dlk=; h=References:In-Reply-To:From:Date:Subject:To:Cc:From; b=EekpatgCfXAY5PVIXJOXKjXre1Wyt5kLnk69xj79naKsliUjFBna4Am1jKxDJ1RUB YwgGo3BT2S3Rx2ybuQVvOdWWxVpkyGDwgeTCGh2QZeVh0VyaK5E3Db8ddZOCtW/e4V jqfSmiN8gcKG4aikDeyjscuKc7uS8UTF14Y94hyM= Received: by mail-wr1-f53.google.com with SMTP id j4so22725448wrp.10 for ; Wed, 01 Jul 2020 11:39:53 -0700 (PDT) X-Gm-Message-State: AOAM533QH2hxR//37kO+f8WPrD3lBPK78r+0FcAW8ozFRxfPq1H++aF+ GCVXt2lM/TdmiyQ80atWbxs1W6Q5X4vKGpeVvJIQJA== X-Received: by 2002:a5d:458a:: with SMTP id p10mr27429972wrq.184.1593628792155; Wed, 01 Jul 2020 11:39:52 -0700 (PDT) MIME-Version: 1.0 References: <947880c41ade688ff4836f665d0c9fcaa9bd1201.1593191971.git.luto@kernel.org> In-Reply-To: From: Andy Lutomirski Date: Wed, 1 Jul 2020 11:39:40 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH 3/6] x86/entry/64/compat: Fix Xen PV SYSENTER frame setup To: Brian Gerst Cc: Andy Lutomirski , "the arch/x86 maintainers" , Linux Kernel Mailing List , Andrew Cooper , Juergen Gross , Boris Ostrovsky , Stefano Stabellini , xen-devel Content-Type: text/plain; charset="UTF-8" Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Wed, Jul 1, 2020 at 8:42 AM Brian Gerst wrote: > > On Fri, Jun 26, 2020 at 1:30 PM Andy Lutomirski wrote: > > > > The SYSENTER frame setup was nonsense. It worked by accident > > because the normal code into which the Xen asm jumped > > (entry_SYSENTER_32/compat) threw away SP without touching the stack. > > entry_SYSENTER_compat was recently modified such that it relied on > > having a valid stack pointer, so now the Xen asm needs to invoke it > > with a valid stack. > > > > Fix it up like SYSCALL: use the Xen-provided frame and skip the bare > > metal prologue. > > > > Cc: Boris Ostrovsky > > Cc: Juergen Gross > > Cc: Stefano Stabellini > > Cc: xen-devel@lists.xenproject.org > > Fixes: 1c3e5d3f60e2 ("x86/entry: Make entry_64_compat.S objtool clean") > > Signed-off-by: Andy Lutomirski > > --- > > arch/x86/entry/entry_64_compat.S | 1 + > > arch/x86/xen/xen-asm_64.S | 20 ++++++++++++++++---- > > 2 files changed, 17 insertions(+), 4 deletions(-) > > > > diff --git a/arch/x86/entry/entry_64_compat.S b/arch/x86/entry/entry_64_compat.S > > index 7b9d8150f652..381a6de7de9c 100644 > > --- a/arch/x86/entry/entry_64_compat.S > > +++ b/arch/x86/entry/entry_64_compat.S > > @@ -79,6 +79,7 @@ SYM_CODE_START(entry_SYSENTER_compat) > > pushfq /* pt_regs->flags (except IF = 0) */ > > pushq $__USER32_CS /* pt_regs->cs */ > > pushq $0 /* pt_regs->ip = 0 (placeholder) */ > > +SYM_INNER_LABEL(entry_SYSENTER_compat_after_hwframe, SYM_L_GLOBAL) > > This skips over the section that truncates the syscall number to > 32-bits. The comments present some doubt that it is actually > necessary, but the Xen path shouldn't differ from native. That code > should be moved after this new label. Whoops. I thought I caught that myself, but apparently not. I'll fix it. > > -- > Brian Gerst