Received: by 2002:a05:6902:102b:0:0:0:0 with SMTP id x11csp731626ybt; Wed, 1 Jul 2020 08:43:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzrB0ykM9YBsu3kHsbM8BSEb8Rnuny+RbTtfCCvQPUU9GrvJQlSof4aE6gP81BhsWPJDIUF X-Received: by 2002:a50:9dc8:: with SMTP id l8mr29640012edk.248.1593618215006; Wed, 01 Jul 2020 08:43:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1593618215; cv=none; d=google.com; s=arc-20160816; b=zAZuSUuPfkEb8vF7mfMHpHwnt/XZ31kLiaSt8MzXCuG3Ur0jLABJ4A1WZkKBLwF8kK gZ8U2zaw2oWKdsOqqqKEiYFaYeUxwHbgZhiODsfA7GDXhm17toTP2k49dFsw0yq54cdW gHFGhATyt20mB5z2VbyCRKNjAp9GNYdSBTsKxkVgG7yXloDx85jwwBPRLUhRYQvPXhMd SgiP0zQ+XYpGCjvoBBVX2hWv9x1Bx7lQN5XBUBDgdWp1ClOFrRpqAJnwL6mwDq+bm9Sn 0pf6WEXhSmk2/n5hHxoMVYB6X0WATUA3i5ramNqeUEzp4J2rfxASRG03uIak3ZhwnsVH pPfw== 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=hvie/6BG7o1swX84/UM5fLpFCqjSlLJ7YxyaK37mWfQ=; b=j+S7qkjaX5x+XW5KHTSasezHwkC8sBc1Q/t0dm0CoNpuDsJcRLTol8VGArVAZ4+bTm KJsx1JQJ3PH7mIh5n1metohkKlu3nExQ4crmhvsTpKgYhf/wbkl+z4n3idXHVhPhDAte PvEDKINbbPNIqWLNtwCR5Oh6PcZXzFFRf/LJjtiqd+ZxXShGpYnAEo7zYdErGkZ2a25W fogJHxV7EmYFt0kduc/b4uYpe85AO3Tj/dujpBXgytzfvcQy+RtKxocb8Xu3mAerfgrq 6y2j2j7D3VOehMX3HVH+KtBqc6baU5pU/4A8J0h+33ABBILGKVd/svgE/uPsWQYAwFvY lC8A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Bq1vY63R; 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=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id c11si3879355edy.498.2020.07.01.08.43.12; Wed, 01 Jul 2020 08:43:34 -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=@gmail.com header.s=20161025 header.b=Bq1vY63R; 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=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731441AbgGAPmu (ORCPT + 99 others); Wed, 1 Jul 2020 11:42:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:34242 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728796AbgGAPmu (ORCPT ); Wed, 1 Jul 2020 11:42:50 -0400 Received: from mail-io1-xd41.google.com (mail-io1-xd41.google.com [IPv6:2607:f8b0:4864:20::d41]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1609EC08C5C1 for ; Wed, 1 Jul 2020 08:42:50 -0700 (PDT) Received: by mail-io1-xd41.google.com with SMTP id e64so20574859iof.12 for ; Wed, 01 Jul 2020 08:42:50 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=hvie/6BG7o1swX84/UM5fLpFCqjSlLJ7YxyaK37mWfQ=; b=Bq1vY63RSI+AVQWedtGjs4OUW2V0itIttXR/Ci9bU+UKtI2BWdpUf4sDz96BGrSGyR V/UHlS3aV5SiS1fho1aDTwbVxTp9t9zupgusW9YlBOKSFD1s5HwzZCEnfkzKUo4houln Cb9GusQWPx+4H9uO3kYPoNxDNhXwNZRfOArcBfdPzeZujuNW7QbqNM+E5s1nPvPswtiE yalC+9Rq/obRStT18qIsbrsHaiLJfmIufmx2kDpKPpibWV64gwBlaNJtvv+rkyGKxq/D QNlSZpiBWDiBf25Mu9KGz+xPLsEN9KPmrpg9RuyfbJ9gKv5/mawluJJ9fmVMi2Zym+aS HSIQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=hvie/6BG7o1swX84/UM5fLpFCqjSlLJ7YxyaK37mWfQ=; b=emcheIFaZps05u2zdXWq/0lf1dgu9VCjv3Dc5bebFRQEuzlumNREiChDIpnRGf9cXq 2YkY109LTHpn4eS0o7n7/K/PFWZaRcba62/e1io6AgQO10DqspqXCrCxE//lZfCGL+6Y YoukYT/Z2IwcWiXmo4UH7ycyEPD+P5p8g165ggFf48QeGxinHUO8rYGnpRKhvNfeZG7e UQ2c2pi535ODnR9Z1UoVuQzRg3CmbfgbU5luhYEwyYfm+TFlmGiiWCQ1fdTSQydYjuAH Zgw6D5tCidWHu2Ja9z4Tfi5gDKuDbFo2xcZhWtGwzc2VMsbM3LYuAGrHK6CYA7HINDkA txDw== X-Gm-Message-State: AOAM532fb/rD/wKcKN7mSyUgCnHsMn+s7hhnpVaW1PVfdEMqQQ9OidO8 QyPdUq6trCsEboosYIz6qkCd6oqVprF+egn3BgVH X-Received: by 2002:a5e:d90c:: with SMTP id n12mr2832816iop.144.1593618168297; Wed, 01 Jul 2020 08:42:48 -0700 (PDT) MIME-Version: 1.0 References: <947880c41ade688ff4836f665d0c9fcaa9bd1201.1593191971.git.luto@kernel.org> In-Reply-To: <947880c41ade688ff4836f665d0c9fcaa9bd1201.1593191971.git.luto@kernel.org> From: Brian Gerst Date: Wed, 1 Jul 2020 11:42:37 -0400 Message-ID: Subject: Re: [PATCH 3/6] x86/entry/64/compat: Fix Xen PV SYSENTER frame setup To: Andy Lutomirski Cc: "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 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. -- Brian Gerst