Received: by 10.223.176.5 with SMTP id f5csp2827952wra; Mon, 5 Feb 2018 10:31:19 -0800 (PST) X-Google-Smtp-Source: AH8x227r+AqDXyD9/nnGxmQblqTqjD9SMIMARUy+8vhYpfdCHU0EMk6FC8dZwi70qA9jkiqXn2lq X-Received: by 2002:a17:902:7c86:: with SMTP id y6-v6mr35122436pll.24.1517855479384; Mon, 05 Feb 2018 10:31:19 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1517855479; cv=none; d=google.com; s=arc-20160816; b=O07Ib6kwAWxxhmO5T16p0pCiLiDSzCHrIirNjNovUKrfZ1wG6tIPQYW9r1P0dVj8ch EpH+oR9E5hqMZb/6snLJHit0sp8tjQ3o0vnnosSkjmKHAQv9M6zbs9Zv/pY/uhPfaHcy PPRMPGFN08X+ukF3gqlLltoaJCdYQXzLcdVuZtNE9mpxdM/pPxGxa4nGI56tfrv09ll+ 6Gm0TEeN9B9PEU24kgTVMp7O/dhxbD1frhYe5mAmGYaE1ofUxDHgm5jGWnHGnuxcR40k lMFmpIX42ECALJaMgV0XmNZwJ0kyPwKJUty+xPcPDbhxeFkWrICPrsKzaupOxvyS9w7+ BwLw== 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=Bk5zjdfWEFwVkyHDWq2Y+YxYhNnsDx7YHJ55/ZgTgbQ=; b=t0pgljYvXQCYb1rA26Ne9XqTADo59W+alYMycvlpjZ09OjPbREYDX6bZ1sBcZSfYcS reZp5KFjr8RCgrTaKsaxxlyjBu+ilhdUo6y1sBn/l3rfwK6R0tRy4KSln9Jh/K/GHiyl Fvy9xGxP9sgVgDxD1aIZW/lAHlXVq/VuNWXHOdg39pYPm1dPbQLrUv0H7ogG3FKI2Bk8 mgUYPtnc1sYXsarUF9e7+BebBrH6sT/b0KCFLrXde1eRQR3l7lUuorMRZDkC0h+JX/m0 vSRFgQWB4q3jVm2XyZMQ0+SckOeNFRyW0Y3vPTpHSW1mpvX21hBK6iqvfIgITWp3RWTN AJLw== 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 h130si753013pgc.787.2018.02.05.10.31.04; Mon, 05 Feb 2018 10:31:19 -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 S1753939AbeBES3u (ORCPT + 99 others); Mon, 5 Feb 2018 13:29:50 -0500 Received: from mail.linuxfoundation.org ([140.211.169.12]:52552 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753719AbeBESZS (ORCPT ); Mon, 5 Feb 2018 13:25:18 -0500 Received: from localhost (unknown [104.132.1.108]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id 2710D10B4; Mon, 5 Feb 2018 18:25:06 +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.15 27/60] x86/mm: Fix overlap of i386 CPU_ENTRY_AREA with FIX_BTMAP Date: Mon, 5 Feb 2018 10:23:00 -0800 Message-Id: <20180205182215.052460372@linuxfoundation.org> X-Mailer: git-send-email 2.16.1 In-Reply-To: <20180205182213.902626065@linuxfoundation.org> References: <20180205182213.902626065@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.15-stable review patch. If anyone has any objections, please let me know. ------------------ From: William Grant william.grant@canonical.com 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)