From patchwork Mon Sep 17 10:40:04 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Greg Kroah-Hartman X-Patchwork-Id: 10602431 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 881F1157B for ; Mon, 17 Sep 2018 10:49:42 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 83D7A29832 for ; Mon, 17 Sep 2018 10:49:42 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 7604529844; Mon, 17 Sep 2018 10:49:42 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_NONE autolearn=ham version=3.3.1 Received: from kanga.kvack.org (kanga.kvack.org [205.233.56.17]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 67AB429832 for ; Mon, 17 Sep 2018 10:49:41 +0000 (UTC) Received: by kanga.kvack.org (Postfix) id 530FF8E0018; Mon, 17 Sep 2018 06:49:40 -0400 (EDT) Delivered-To: linux-mm-outgoing@kvack.org Received: by kanga.kvack.org (Postfix, from userid 40) id 4E0CC8E0001; Mon, 17 Sep 2018 06:49:40 -0400 (EDT) X-Original-To: int-list-linux-mm@kvack.org X-Delivered-To: int-list-linux-mm@kvack.org Received: by kanga.kvack.org (Postfix, from userid 63042) id 3CF448E0018; Mon, 17 Sep 2018 06:49:40 -0400 (EDT) X-Original-To: linux-mm@kvack.org X-Delivered-To: linux-mm@kvack.org Received: from mail-pg1-f200.google.com (mail-pg1-f200.google.com [209.85.215.200]) by kanga.kvack.org (Postfix) with ESMTP id F0AF28E0001 for ; Mon, 17 Sep 2018 06:49:39 -0400 (EDT) Received: by mail-pg1-f200.google.com with SMTP id e124-v6so6215600pgc.11 for ; Mon, 17 Sep 2018 03:49:39 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-original-authentication-results:x-gm-message-state:subject:to:cc :from:date:message-id:mime-version:content-transfer-encoding; bh=/znNX31o0w6G5yC2U2MWeZv3BPicJWvFufDGK5boIQA=; b=qrEl6CyJyrUs5SbEYgswjRHWVrtOb2SXNgUkXeN8QoYNMiMFd52RIw9pNmor5dmBOH TCMAjenWE4W6Bm40gUamZxIxXAFKbcv0jfzOb0LbPz2NuUd21ZjVzyKEIQPgCd5w8Snu Q0jaHAWjRAVLb+Kb9eMquK79nWeB7cnaghrYtsV9GJMgB0cibod0T62wXBzFJhRFoBhW urDQb+j7ojGJilGBWgMSXP6l2Sb4vsFfzWYuoEgCMt6E6oWusPwIkB5buZ2pAVxrWmLE b/BbW4KVuCzyyphTEbS64oms7Y8e8hSV7dFK6n0q+wh1OElh40GblyRZkMucPf7EmkUk 3Zzw== X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of gregkh@linuxfoundation.org designates 140.211.169.12 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org X-Gm-Message-State: APzg51BYPM9iuTDUc75VTfQvpCDGfkwOskut6JBD9Tz863+DFL8icYMy rV6GxGdBb4ukZ/nxTy8pZd5GCmxgsu+BubNSLYWrJymxeRAQ55+5y4qGxxLpMmq/yKDNN/LZKyE oWZ2j9C9vZXwXe5CxEsxs1kzXtUpg0G8nFirktXk7B5rRFJNSsuwp7ys5nMRim6yBcA== X-Received: by 2002:a63:5465:: with SMTP id e37-v6mr23090299pgm.316.1537181379648; Mon, 17 Sep 2018 03:49:39 -0700 (PDT) X-Google-Smtp-Source: ANB0VdZFN+McHBbQbkz6UzVh1EtydSn/giKJLza7+brIGIngbRT1lVoKNO9e7j1sa/QdyZxhgW9Y X-Received: by 2002:a63:5465:: with SMTP id e37-v6mr23090256pgm.316.1537181378765; Mon, 17 Sep 2018 03:49:38 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1537181378; cv=none; d=google.com; s=arc-20160816; b=dHivhwPRZ2o6S81dppOf6KxGm1YocWWjVu2XYk7PyCmgTqC5TJLt+V5Jc06EGtdPS3 8WYlgD/wpBr7P6R9dCY9s7OLzZ1DcAd1vlKZC7e+8iHdsNnkEw3UInyMOZXxCFsQ63nS 1Uy6PAiDZYELymASNMTnPFNzVAuBsNIO+6DzMoxsjMSQX8beQh6NjT09sJCHu5zPGTyh QiLNRt5p1szHJ2kLEtRFjsg90hHn+n7TTuBtO5qQBXreHGk7SiHc90lE6qowOB79Oe7k gaPTOxjCwxIn7X74N06IJI1d2+YvMYZb026mZVM6B4BOXd2DN2K0dslYb8QZ1/ZVs7dD 3oRg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:from:cc:to :subject; bh=/znNX31o0w6G5yC2U2MWeZv3BPicJWvFufDGK5boIQA=; b=uNnqPHN2/BegGpOi+tckVyELYN7477zwPqTXkgAthxPnQIQ27cWhtz+sqtbMKpEYIb hVjQ/1lTP3gwfg0CNGihfW8//dPNVa5PtgLnAIFQNXQmgXOYQwpACYrZyeTKSdLwXDfb kBW1E+/S2EeZTS17my9JXpzmJIh2j5S0RJhtM6gJpJODtshPfIb4bQojTLOt0hRu3Xmn mBfpgR0qgw5v+0gCBsaqLv8qKoHU03BRDIOdJVUX8lv+KOtR5mFMzcyQECASsWekSCdL eNoUEhwrh1e2xZMxFVigSWKaK14PE8ll0VdDfeR17uiLQch2qKYTah8lo8UP1ih9RB1X kx/A== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of gregkh@linuxfoundation.org designates 140.211.169.12 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Received: from mail.linuxfoundation.org (mail.linuxfoundation.org. [140.211.169.12]) by mx.google.com with ESMTPS id 23-v6si14345828pgr.493.2018.09.17.03.49.38 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 17 Sep 2018 03:49:38 -0700 (PDT) Received-SPF: pass (google.com: domain of gregkh@linuxfoundation.org designates 140.211.169.12 as permitted sender) client-ip=140.211.169.12; Authentication-Results: mx.google.com; spf=pass (google.com: domain of gregkh@linuxfoundation.org designates 140.211.169.12 as permitted sender) smtp.mailfrom=gregkh@linuxfoundation.org Received: from localhost (ip-213-127-77-73.ip.prioritytelecom.net [213.127.77.73]) by mail.linuxfoundation.org (Postfix) with ESMTPSA id BFFF840C; Mon, 17 Sep 2018 10:49:37 +0000 (UTC) Subject: Patch "x86/kexec: Allocate 8k PGDs for PTI" has been added to the 4.18-stable tree To: 1532533683-5988-4-git-send-email-joro@8bytes.org,David.Laight@aculab.com,aarcange@redhat.com,acme@kernel.org,alexander.levin@microsoft.com,alexander.shishkin@linux.intel.com,aliguori@amazon.com,boris.ostrovsky@oracle.com,bp@alien8.de,brgerst@gmail.com,daniel.gruss@iaik.tugraz.at,dave.hansen@intel.com,dhgutteridge@sympatico.ca,dvlasenk@redhat.com,eduval@amazon.com,gregkh@linuxfoundation.org,hpa@zytor.com,hughd@google.com,jgross@suse.com,jkosina@suse.cz,jolsa@redhat.com,joro@8bytes.org,jpoimboe@redhat.com,jroedel@suse.de,keescook@google.com,linux-mm@kvack.org,llong@redhat.com,luto@kernel.org,namhyung@kernel.org,pavel@ucw.cz,peterz@infradead.org,tglx@linutronix.de,torvalds@linux-foundation.org,will.deacon@arm.com Cc: From: Date: Mon, 17 Sep 2018 12:40:04 +0200 Message-ID: <1537180804227248@kroah.com> MIME-Version: 1.0 X-stable: commit X-Bogosity: Ham, tests=bogofilter, spamicity=0.000000, version=1.2.4 Sender: owner-linux-mm@kvack.org Precedence: bulk X-Loop: owner-majordomo@kvack.org List-ID: X-Virus-Scanned: ClamAV using ClamSMTP This is a note to let you know that I've just added the patch titled x86/kexec: Allocate 8k PGDs for PTI to the 4.18-stable tree which can be found at: http://www.kernel.org/git/?p=linux/kernel/git/stable/stable-queue.git;a=summary The filename of the patch is: x86-kexec-allocate-8k-pgds-for-pti.patch and it can be found in the queue-4.18 subdirectory. If you, or anyone else, feels it should not be added to the stable tree, please let know about it. From foo@baz Mon Sep 17 12:37:52 CEST 2018 From: Joerg Roedel Date: Wed, 25 Jul 2018 17:48:03 +0200 Subject: x86/kexec: Allocate 8k PGDs for PTI From: Joerg Roedel [ Upstream commit ca38dc8f2724d101038b1205122c93a1c7f38f11 ] Fuzzing the PTI-x86-32 code with trinity showed unhandled kernel paging request oops-messages that looked a lot like silent data corruption. Lot's of debugging and testing lead to the kexec-32bit code, which is still allocating 4k PGDs when PTI is enabled. But since it uses native_set_pud() to build the page-table, it will unevitably call into __pti_set_user_pgtbl(), which writes beyond the allocated 4k page. Use PGD_ALLOCATION_ORDER to allocate PGDs in the kexec code to fix the issue. Signed-off-by: Joerg Roedel Signed-off-by: Thomas Gleixner Tested-by: David H. Gutteridge Cc: "H . Peter Anvin" Cc: linux-mm@kvack.org Cc: Linus Torvalds Cc: Andy Lutomirski Cc: Dave Hansen Cc: Josh Poimboeuf Cc: Juergen Gross Cc: Peter Zijlstra Cc: Borislav Petkov Cc: Jiri Kosina Cc: Boris Ostrovsky Cc: Brian Gerst Cc: David Laight Cc: Denys Vlasenko Cc: Eduardo Valentin Cc: Greg KH Cc: Will Deacon Cc: aliguori@amazon.com Cc: daniel.gruss@iaik.tugraz.at Cc: hughd@google.com Cc: keescook@google.com Cc: Andrea Arcangeli Cc: Waiman Long Cc: Pavel Machek Cc: Arnaldo Carvalho de Melo Cc: Alexander Shishkin Cc: Jiri Olsa Cc: Namhyung Kim Cc: joro@8bytes.org Link: https://lkml.kernel.org/r/1532533683-5988-4-git-send-email-joro@8bytes.org Signed-off-by: Sasha Levin Signed-off-by: Greg Kroah-Hartman --- arch/x86/kernel/machine_kexec_32.c | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) Patches currently in stable-queue which might be from jroedel@suse.de are queue-4.18/x86-kexec-allocate-8k-pgds-for-pti.patch queue-4.18/iommu-ipmmu-vmsa-fix-allocation-in-atomic-context.patch queue-4.18/x86-mm-remove-in_nmi-warning-from-vmalloc_fault.patch --- a/arch/x86/kernel/machine_kexec_32.c +++ b/arch/x86/kernel/machine_kexec_32.c @@ -56,7 +56,7 @@ static void load_segments(void) static void machine_kexec_free_page_tables(struct kimage *image) { - free_page((unsigned long)image->arch.pgd); + free_pages((unsigned long)image->arch.pgd, PGD_ALLOCATION_ORDER); image->arch.pgd = NULL; #ifdef CONFIG_X86_PAE free_page((unsigned long)image->arch.pmd0); @@ -72,7 +72,8 @@ static void machine_kexec_free_page_tabl static int machine_kexec_alloc_page_tables(struct kimage *image) { - image->arch.pgd = (pgd_t *)get_zeroed_page(GFP_KERNEL); + image->arch.pgd = (pgd_t *)__get_free_pages(GFP_KERNEL | __GFP_ZERO, + PGD_ALLOCATION_ORDER); #ifdef CONFIG_X86_PAE image->arch.pmd0 = (pmd_t *)get_zeroed_page(GFP_KERNEL); image->arch.pmd1 = (pmd_t *)get_zeroed_page(GFP_KERNEL);