Received: by 2002:a25:c593:0:0:0:0:0 with SMTP id v141csp4337819ybe; Mon, 9 Sep 2019 07:55:47 -0700 (PDT) X-Google-Smtp-Source: APXvYqxETfJP3i6BKjZWEA55yReZB8jNr3XUxlFOGC4cMZItzgQ32muQ3ZuyDOLbL0xQJtVGrKTj X-Received: by 2002:a17:906:6403:: with SMTP id d3mr10742709ejm.99.1568040947628; Mon, 09 Sep 2019 07:55:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1568040947; cv=none; d=google.com; s=arc-20160816; b=NZeaosmNGJiRO3TGNpOh7jY39gSNAiTZOhYJUJ13lRf1OWEOcJo1Uaz/l32tyQ4k2v OcULRb5T4YEeVuxsR/Z90HiJLMR1WJI6QlFckDBTDqiYgeecJbTw0flt5RgjBw7WDJoW 4gSYUvnDsNwSxbD6eHd5dkzYu/EnflSq4eMYQVptkgRCDAxRue/f4XEEQv8XeKP1eYMn eO4YjYK4kwEHjCz12hc0MDQFnnFVejsWj0nIecv4D4lcur++C82lOezw4kbp2+vS9iBz TEl23q6eUODhTiioUE6Tg4RRORVcyqjENIrbIAQUIfz7mLGE20pGSXoal5nF3IVrvCWp mbxA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date:dkim-signature; bh=v3sstLaCSj7E9ixnuxLxjeWVyAPlT7tlX/zmEc4rhUw=; b=oRpWB6r+kf71PgyswvNtmMhiuhvDBchpFAhDtKyYjBLwrbxfm4LEz5fpiv21eW47hl rTKhWy5GghZc/kVDg8JQiiUniSL2mqwe2a642DtS6a3NnK012+fZx5JkTDv+yXll7Fu8 JKVOnkSVgPo9ZijQXndx4CsT5EoA90l5uTlWR1aKGUNUoblkAulJf2YhyGJp83c2o2UR GoMLxmePNbAmKkfXQ9/C2kR0Gd4C4aQ204J7+/Qzf6mGPzSHx1T739OqN8HdUDlqNs12 JHXQe0kRUqZQ/hTwN+FGj0IWF5+rJehDkgI4/UfgqS8HcODkCkOvMb5EO5DKOvwiJl2t xRyw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b="Tuxr/W+L"; 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 ha10si7550266ejb.300.2019.09.09.07.55.22; Mon, 09 Sep 2019 07:55:47 -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; dkim=pass header.i=@shutemov-name.20150623.gappssmtp.com header.s=20150623 header.b="Tuxr/W+L"; 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 S2388812AbfIIIOS (ORCPT + 99 others); Mon, 9 Sep 2019 04:14:18 -0400 Received: from mail-ed1-f65.google.com ([209.85.208.65]:42375 "EHLO mail-ed1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727464AbfIIIOR (ORCPT ); Mon, 9 Sep 2019 04:14:17 -0400 Received: by mail-ed1-f65.google.com with SMTP id y91so12098733ede.9 for ; Mon, 09 Sep 2019 01:14:16 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=shutemov-name.20150623.gappssmtp.com; s=20150623; h=date:from:to:cc:subject:message-id:references:mime-version :content-disposition:in-reply-to:user-agent; bh=v3sstLaCSj7E9ixnuxLxjeWVyAPlT7tlX/zmEc4rhUw=; b=Tuxr/W+L5TAU8+6Vm+I9McgdhVgIlvuIYrXGgGQvPV4/y8/zeDZhxsvyLamjRdxe/g HExvm6QBvbnQTsywBSzH9nq1RigXpCG2M+hUTB7OL4LREEnkNWFAkWZgfffXtdZhmXco CE1slF5ReB+buKtl3MkOOPaEdBy4Zlg5vZG7wb9KxqHeuDsH1pd6EmLS47VLC0DSr6yV 9QPBLl+n6/9icBnzGN4/fBDSRItWsmtbhe+z67qSlSxCQpBHgHbD2h5tBuQrDP3I2d1+ bJ9u2mfhH4PxleS/+fgf0KPceePRvnztQ62EfoSHBYI9XxfVc4TB8+EX5zOypJolh63+ sGZA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:date:from:to:cc:subject:message-id:references :mime-version:content-disposition:in-reply-to:user-agent; bh=v3sstLaCSj7E9ixnuxLxjeWVyAPlT7tlX/zmEc4rhUw=; b=W+Vz7ZvjxJ2nqrNe8O1VlwWyO3M0U0V7J74xsicSgIhDauj0/9WEJ0XoNQnNz8CQ1s CFaiWTWXaCyf+Ecl3VvdTVIOLyPltk+qaVernQ8klIITCyiJO3017EKTB0UqozG2I8ns OBD6lKYU+bCHws8qOKKdlcGZjjuhjnp0DEcQrEJGFkF9dHXK/lsAvr6rtXLQ5dVt4DYC o4lNyJkcLYQBj2we2DDQ4/Svu1P9c9hXty+EETF5wSEAegiAl5wZ8h0ylYav9b2P4lQG opLUfxPBO0YvQVIRcunsnYBnS/NxPvoySZmDgbLG3J6FkTtfYl34RRkbAV3oGXZNH4jz HWNw== X-Gm-Message-State: APjAAAWpxi/q0uRB3HI7UJtEXYKJUalAlfrnb3pOweBD3ejXev0S2ja6 1HCrqA8mNhRVz+H2tbqkAsTrpQ== X-Received: by 2002:a17:906:128a:: with SMTP id k10mr1066306ejb.9.1568016856153; Mon, 09 Sep 2019 01:14:16 -0700 (PDT) Received: from box.localdomain ([86.57.175.117]) by smtp.gmail.com with ESMTPSA id bm1sm2835501edb.29.2019.09.09.01.14.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 09 Sep 2019 01:14:15 -0700 (PDT) Received: by box.localdomain (Postfix, from userid 1000) id 4514F104AE4; Mon, 9 Sep 2019 11:14:14 +0300 (+03) Date: Mon, 9 Sep 2019 11:14:14 +0300 From: "Kirill A. Shutemov" To: Steve Wahl Cc: Thomas Gleixner , Ingo Molnar , Borislav Petkov , "H. Peter Anvin" , x86@kernel.org, Juergen Gross , Brijesh Singh , Jordan Borgner , Feng Tang , linux-kernel@vger.kernel.org, Baoquan He , russ.anderson@hpe.com, dimitri.sivanich@hpe.com, mike.travis@hpe.com Subject: Re: [PATCH] x86/boot/64: Make level2_kernel_pgt pages invalid outside kernel area. Message-ID: <20190909081414.5e3q47fzzruesscx@box> References: <20190906212950.GA7792@swahl-linux> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190906212950.GA7792@swahl-linux> User-Agent: NeoMutt/20180716 Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 06, 2019 at 04:29:50PM -0500, Steve Wahl wrote: > Our hardware (UV aka Superdome Flex) has address ranges marked > reserved by the BIOS. These ranges can cause the system to halt if > accessed. > > During kernel initialization, the processor was speculating into > reserved memory causing system halts. The processor speculation is > enabled because the reserved memory is being mapped by the kernel. > > The page table level2_kernel_pgt is 1 GiB in size, and had all pages > initially marked as valid, and the kernel is placed anywhere in this > range depending on the virtual address selected by KASLR. Later on in > the boot process, the valid area gets trimmed back to the space > occupied by the kernel. > > But during the interval of time when the full 1 GiB space was marked > as valid, if the kernel physical address chosen by KASLR was close > enough to our reserved memory regions, the valid pages outside the > actual kernel space were allowing the processor to issue speculative > accesses to the reserved space, causing the system to halt. > > This was encountered somewhat rarely on a normal system boot, and > somewhat more often when starting the crash kernel if > "crashkernel=512M,high" was specified on the command line (because > this heavily restricts the physical address of the crash kernel, > usually to within 1 GiB of our reserved space). > > The answer is to invalidate the pages of this table outside the > address range occupied by the kernel before the page table is > activated. This patch has been validated to fix this problem on our > hardware. If the goal is to avoid *any* mapping of the reserved region to stop speculation, I don't think this patch will do the job. We still (likely) have the same memory mapped as part of the identity mapping. And it happens at least in two places: here and before on decompression stage. -- Kirill A. Shutemov