Received: by 10.223.176.5 with SMTP id f5csp2852046wra; Mon, 5 Feb 2018 10:58:32 -0800 (PST) X-Google-Smtp-Source: AH8x227me5sOhOODEEk+exhylFuuFFVNKynTNFTUZeYAXQMWEHnYi8J6zq3Uyi9J9Fn80xkqWNDH X-Received: by 10.101.98.85 with SMTP id q21mr26803075pgv.298.1517857112273; Mon, 05 Feb 2018 10:58:32 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517857112; cv=none; d=google.com; s=arc-20160816; b=jr6OEL0VhIvUJXpsL7T5t5PglJAu1uUeNiRyNkxTJU5QiR7MCBzBb4ucWzivKlEKZA 6Rkx5kA8ZqlL1Z8nSvKh0Nf6G34AuZ4w31fp6T/903VzbbsZHNeZRtCTbnyTR6zFCfLm bElg2PeTXPrERiD3Dr7N2GIo9YCCx57n2zhSm12T+RjiUTvbQu+a4411f7UhOIbauCgI cUg73orWmpFlk6SkEOP91mk497tOZ+hwBpBzGRQK3G0uJTvXx1NOip90D4dQRJfyu/pq plkgzfqF3aPlWUY5skj+csd13iIXZGpDt+4rn9jx1M00/cGHWgPrmTgtgIVYOXdpIkUo GjPw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :in-reply-to:message-id:date:subject:cc:to:from :arc-authentication-results; bh=GDaOmOnUO+cqGnSNV938ZTs5yJ5EbC/N2wZI5rUTQV0=; b=I+iTYJHVfarNj8oScKYx0RNPKx1g1BZLV2J9qBEnZAR559ujsG+fK4O/fs5KY3LB2R 2twyMPn5AddAIpWCHKjMhRzl7PWUKvkP1IkxCujfc+p9c5nKvZDhw6suL6V1Z+v5wcvr VDnLtSMX6EthsLi+FpJe0pB64BJZ0IhiHSeQVjwf+s3ZB4nxBh6U6NPm9/YIAxnCuqSh 0JECz71ue3GpkLBwb8KQ5cNW5HuQYneCPjMIzwi5bCjgV4Anixggfc7rrhtFzlp9AnMc DEQG58alARxmXSHAuKLzJW4UOj2QxL1VUWUevqMPKuO26bfqIlzkPr84nf9s4/7XDjRn 3GGg== 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 k8si236284pgc.482.2018.02.05.10.58.17; Mon, 05 Feb 2018 10:58:32 -0800 (PST) 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 S1753674AbeBESZA (ORCPT + 99 others); Mon, 5 Feb 2018 13:25:00 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:51248 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753396AbeBESX5 (ORCPT ); Mon, 5 Feb 2018 13:23:57 -0500 Received: from localhost (unknown [104.132.1.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id DE838102C; Mon, 5 Feb 2018 18:23:52 +0000 (UTC) From: Greg Kroah-Hartman To: linux-kernel@vger.kernel.org Cc: Greg Kroah-Hartman , stable@vger.kernel.org, William Grant , Thomas Gleixner Subject: [PATCH 4.14 31/64] x86/mm: Fix overlap of i386 CPU_ENTRY_AREA with FIX_BTMAP Date: Mon, 5 Feb 2018 10:22:50 -0800 Message-Id: <20180205182139.862012036@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180205182138.571333346@linuxfoundation.org> References: <20180205182138.571333346@linuxfoundation.org> User-Agent: quilt/0.65 MIME-Version: 1.0 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 4.14-stable review patch. If anyone has any objections, please let me know. ------------------ From: William Grant commit 55f49fcb879fbeebf2a8c1ac7c9e6d90df55f798 Since commit 92a0f81d8957 ("x86/cpu_entry_area: Move it out of the fixmap"), i386's CPU_ENTRY_AREA has been mapped to the memory area just below FIXADDR_START. But already immediately before FIXADDR_START is the FIX_BTMAP area, which means that early_ioremap can collide with the entry area. It's especially bad on PAE where FIX_BTMAP_BEGIN gets aligned to exactly match CPU_ENTRY_AREA_BASE, so the first early_ioremap slot clobbers the IDT and causes interrupts during early boot to reset the system. The overlap wasn't a problem before the CPU entry area was introduced, as the fixmap has classically been preceded by the pkmap or vmalloc areas, neither of which is used until early_ioremap is out of the picture. Relocate CPU_ENTRY_AREA to below FIX_BTMAP, not just below the permanent fixmap area. Fixes: commit 92a0f81d8957 ("x86/cpu_entry_area: Move it out of the fixmap") Signed-off-by: William Grant Signed-off-by: Thomas Gleixner Cc: stable@vger.kernel.org Link: https://lkml.kernel.org/r/7041d181-a019-e8b9-4e4e-48215f841e2c@canonical.com Signed-off-by: Greg Kroah-Hartman --- arch/x86/include/asm/fixmap.h | 6 ++++-- arch/x86/include/asm/pgtable_32_types.h | 5 +++-- 2 files changed, 7 insertions(+), 4 deletions(-) --- a/arch/x86/include/asm/fixmap.h +++ b/arch/x86/include/asm/fixmap.h @@ -137,8 +137,10 @@ enum fixed_addresses { extern void reserve_top_address(unsigned long reserve); -#define FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT) -#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) +#define FIXADDR_SIZE (__end_of_permanent_fixed_addresses << PAGE_SHIFT) +#define FIXADDR_START (FIXADDR_TOP - FIXADDR_SIZE) +#define FIXADDR_TOT_SIZE (__end_of_fixed_addresses << PAGE_SHIFT) +#define FIXADDR_TOT_START (FIXADDR_TOP - FIXADDR_TOT_SIZE) extern int fixmaps_set; --- a/arch/x86/include/asm/pgtable_32_types.h +++ b/arch/x86/include/asm/pgtable_32_types.h @@ -44,8 +44,9 @@ extern bool __vmalloc_start_set; /* set */ #define CPU_ENTRY_AREA_PAGES (NR_CPUS * 40) -#define CPU_ENTRY_AREA_BASE \ - ((FIXADDR_START - PAGE_SIZE * (CPU_ENTRY_AREA_PAGES + 1)) & PMD_MASK) +#define CPU_ENTRY_AREA_BASE \ + ((FIXADDR_TOT_START - PAGE_SIZE * (CPU_ENTRY_AREA_PAGES + 1)) \ + & PMD_MASK) #define PKMAP_BASE \ ((CPU_ENTRY_AREA_BASE - PAGE_SIZE) & PMD_MASK)