Received: by 2002:a5b:505:0:0:0:0:0 with SMTP id o5csp4127678ybp; Mon, 7 Oct 2019 03:43:18 -0700 (PDT) X-Google-Smtp-Source: APXvYqz9RFnfbFN6Uo/hOrkO28/nB9saBNBEUuX5kHYG1xkrJ90s3jsJu1umZxGVda71MhQsmHCP X-Received: by 2002:a17:906:409b:: with SMTP id u27mr799863ejj.295.1570444998770; Mon, 07 Oct 2019 03:43:18 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1570444998; cv=none; d=google.com; s=arc-20160816; b=Ivv7w1SMSK67KY2ZEJzSAD2rZ2veEmss8BF1EgkAiPul4/fsxFnqH+FgkRSsSYC6Os SDkKFxTU6C/7J4kqG47rCo6FK6pe/qy0uprKQdYpOUnVwT1gAncw6lvQWR2g50UFg5FK LHcLf7njdnH1wN2i94UzP/ntcQfEdg7b8CJyijsvo6daiT/hn9wQkgECy17+ezx0X00L Qyh+2cF8OBvyMNZvaLazk1uFTTXA4FixmvPmo/uK1RF0oj1XxyiSHcTapLx3W2cBO28d /YoWewXvWU8zY2Ohjkl+BmqC1xtNSObKEIVt66JbMRk+6NrDCnzvpQL5FYmKszS3k3/M MwWQ== 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 :content-language:mime-version:user-agent:date:message-id:subject :from:cc:to; bh=f/D5GS/WiuFOOilDteRtTEJWYoBQ4Z/8MHwGZ6Ml6A4=; b=VuSIpZFGUTxmc06O2isS2cJneDu/gVBw4/TWHkPb3aBGFYL2KiemiH5r8Xps1863Ss vyEzF1zbujZSZJmq4s7xpmlbC34p5M3NGW3wx/xWtsm1AeYtrwornmLduopxDFSkI6mb UrlcjneAmPVAunwC7c+tGD38c17PHLXyCYogsnXS8MDn5buG21t4VarcOHt1Aa57meGl OdedDOyi/GniysnxVxooYKfIw9dcc7qDHrCQcJ0a3mz+9+aIPh2zCW2vb3512CxBxEXs APQzej8l0HDuDBRFW8XaAxFV4YTMrNv2ExfWyL06hAe9l4lhPf6LJEkelbEkrOjlDnX3 tjBw== 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 s19si6726111ejd.277.2019.10.07.03.42.55; Mon, 07 Oct 2019 03:43:18 -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 S1727582AbfJGKlo (ORCPT + 99 others); Mon, 7 Oct 2019 06:41:44 -0400 Received: from mx2.suse.de ([195.135.220.15]:40986 "EHLO mx1.suse.de" rhost-flags-OK-OK-OK-FAIL) by vger.kernel.org with ESMTP id S1727252AbfJGKlo (ORCPT ); Mon, 7 Oct 2019 06:41:44 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay2.suse.de (unknown [195.135.220.254]) by mx1.suse.de (Postfix) with ESMTP id E3FC3B212; Mon, 7 Oct 2019 10:41:42 +0000 (UTC) To: Andy Lutomirski Cc: lkml From: Jan Beulich Subject: [PATCH] x86/stackframe/32: repair 32-bit Xen PV Message-ID: Date: Mon, 7 Oct 2019 12:41:41 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:60.0) Gecko/20100101 Thunderbird/60.9.0 MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Once again RPL checks have been introduced which don't account for a 32-bit kernel living in ring 1 when running in a PV Xen domain. The case in FIXUP_FRAME has been preventing boot; adjust BUG_IF_WRONG_CR3 as well just in case. Fixes: 3c88c692c287 ("x86/stackframe/32: Provide consistent pt_regs") Signed-off-by: Jan Beulich --- a/arch/x86/entry/entry_32.S +++ b/arch/x86/entry/entry_32.S @@ -48,6 +48,17 @@ #include "calling.h" +#ifndef CONFIG_XEN_PV +# define USER_SEGMENT_RPL_MASK SEGMENT_RPL_MASK +#else +/* + * When running paravirtualized on Xen the kernel runs in ring 1, and hence + * simple mask based tests (i.e. ones not comparing against USER_RPL) have to + * ignore bit 0. See also the C-level get_kernel_rpl(). + */ +# define USER_SEGMENT_RPL_MASK (SEGMENT_RPL_MASK & ~1) +#endif + .section .entry.text, "ax" /* @@ -172,7 +183,7 @@ ALTERNATIVE "jmp .Lend_\@", "", X86_FEATURE_PTI .if \no_user_check == 0 /* coming from usermode? */ - testl $SEGMENT_RPL_MASK, PT_CS(%esp) + testl $USER_SEGMENT_RPL_MASK, PT_CS(%esp) jz .Lend_\@ .endif /* On user-cr3? */ @@ -217,7 +228,7 @@ testl $X86_EFLAGS_VM, 4*4(%esp) jnz .Lfrom_usermode_no_fixup_\@ #endif - testl $SEGMENT_RPL_MASK, 3*4(%esp) + testl $USER_SEGMENT_RPL_MASK, 3*4(%esp) jnz .Lfrom_usermode_no_fixup_\@ orl $CS_FROM_KERNEL, 3*4(%esp)