Received: by 2002:a25:ef43:0:0:0:0:0 with SMTP id w3csp952140ybm; Wed, 27 May 2020 12:02:08 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyY4RNWKU6L2ycDB8ommEIR58XZM7j4sYM4Hoifx3TXhWCggAOkHYegTvhFb1ifM3AdtfCN X-Received: by 2002:a17:907:1106:: with SMTP id qu6mr7169967ejb.321.1590606128509; Wed, 27 May 2020 12:02:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1590606128; cv=none; d=google.com; s=arc-20160816; b=ZbicHXxYStZPoIFJSuRoifuX1ycVPqnimYBLjroKPrFxmQE5kYJ9+SM53OIKcJmgkm 0B3sswSc1ELiZN1VkJqlObE48bzfi620CJ9IgUrmY5+tLOOxGwPdN633ziGLFx0BnU0Y 8biF4FInsLkawKxI8jGu9KmJ1DY4rDep5osLi6WYX3QCb5uDpXhxwo1AhYY87upN+kJX KTRzorwKx8Q0N3T77jnwx9sWv1PqdUC2gtCSJVDCEkEzWKLXCa1GXj4DswfnHETt6jvv gQRrKIxjrY/zcpzcm6vVyKHDMKLVUeSW3x2kgpXIiLPk07ze5v47/bjD17jjEPeThz/X VQyw== 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:cc:to :subject:from; bh=DgDJfbX6Xb6hUYCe2aZJD1pqDS8ghEgmUfLP+dGOEwI=; b=Gd7LFn6pzUUxINajrWyuVuPgnJPeZjEa2Cf/MZXSxylmzu3c8QPScXlXGLllILCoX+ kpi8D7n4E/x+xk7vzabZraL0LdKGeZ9OPAa0ZkK8HnX1aK6JiIKmCFdS30/z1zEseEu4 Y13Fd+E67CgVaJ7AKu3KOKYVhW2BecJeLmrjNmGCy7Zgr1cZXSbz0rOuA1Vrnws4Il4f zXDyr/Y2vdMWb45qCFjEZaMyXCQkEM6nmEeb4pHe+AfVTnvjqOQuBd0c9eJk59QPz3Le bGI/aQEo0+rbbVWqSbcO2E0DBpaxqH62h5OCswwtpu0GFvD5v8+aPnxlKERvQLEkaM8k g7Lw== ARC-Authentication-Results: i=1; mx.google.com; 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 Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id m24si2355325eji.423.2020.05.27.12.01.45; Wed, 27 May 2020 12:02:08 -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; 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 Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2390455AbgE0Pxn (ORCPT + 98 others); Wed, 27 May 2020 11:53:43 -0400 Received: from mx2.suse.de ([195.135.220.15]:39548 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388176AbgE0Pxm (ORCPT ); Wed, 27 May 2020 11:53:42 -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 40CE3AEAF; Wed, 27 May 2020 15:53:44 +0000 (UTC) From: Jan Beulich Subject: [PATCH] x86/mm: keep __default_kernel_pte_mask in sync with __supported_pte_mask To: Dave Hansen , Andy Lutomirski , Peter Zijlstra Cc: lkml , Juergen Gross , Boris Ostrovsky Message-ID: <321effdb-06d5-6b63-e94c-64f83f771024@suse.com> Date: Wed, 27 May 2020 17:53:39 +0200 User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.8.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 Both masks get applied in the process of e.g. set_fixmap() - the former through use of PAGE_KERNEL, the latter by use of massage_pgprot(). Hence forever since the introduction of the former there was a time window (between x86_configure_nx() and the syncing of the two in probe_page_size_mask(), as called from init_mem_mapping()) where fixmap mappings would get established without NX set. For a 32-bit kernel running in PV mode under Xen this meant a W+X mapping (and associated warning) for its shared info page mapping established in xen_pv_init_platform(). Signed-off-by: Jan Beulich --- a/arch/x86/mm/setup_nx.c +++ b/arch/x86/mm/setup_nx.c @@ -33,10 +33,13 @@ early_param("noexec", noexec_setup); void x86_configure_nx(void) { - if (boot_cpu_has(X86_FEATURE_NX) && !disable_nx) + if (boot_cpu_has(X86_FEATURE_NX) && !disable_nx) { __supported_pte_mask |= _PAGE_NX; - else + __default_kernel_pte_mask |= _PAGE_NX; + } else { __supported_pte_mask &= ~_PAGE_NX; + __default_kernel_pte_mask &= ~_PAGE_NX; + } } void __init x86_report_nx(void)