Received: by 10.213.65.68 with SMTP id h4csp471835imn; Tue, 13 Mar 2018 10:06:19 -0700 (PDT) X-Google-Smtp-Source: AG47ELsnBjWFcY4toj52UkvKB9SJ4Vq+3Ak20FkOgs0Hw1X7ptZN9xpBzCJvsfU10Kd3vd/eIQUy X-Received: by 10.101.97.26 with SMTP id z26mr1085161pgu.44.1520960779125; Tue, 13 Mar 2018 10:06:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1520960779; cv=none; d=google.com; s=arc-20160816; b=I9cdY+x2vqA6/O8WixIYWvlpsZ1TUWqCzCBMlOemydHafJe17/SgkfKnyFzz/2LhIh o5cOy5yt+zex1YVn53bfjhFeKF7DJQUc+vKVx3tiawVS4a7n83Z+WYgD7HUspzm/FEdF x9ym2lAwFHutAd5xuSO2rHkkYPzDyg6kFq49ok1fasdW6K1BGRTdvdaUez8w0tPTIqLj UpW6s0T0eUWHeGLkQCXze7ZY20HxlEjGoG5K/dinsbtCmyt3Nuz8aEp60215yrTENGQY tDAwztewv4RhSSSQ48aymiTYKx5nUzhn60Za0S97zKsGZZBXZdAgqnVSbh7og9IrAgjd yyEw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:arc-authentication-results; bh=jDQIR12hhTdGYeJe1og7QQ4rDMbB+zxrKgBKaRyT3PY=; b=AhZiGN+d3lT/31eWRFrHT1/AYH3bCvEqMEXjzY1ike6iWirVP836ngQsY0rOwomGVY 4MJ8WtIa82eQktYNEKLCU0Pn+3uZt6szaEWJjbHo8YTovwtVQZN9zxE7HHo5MTXRKWUJ XNqnkLTG4DS8SwqE6BS+VQqJZA2Bhjx9Ve9vDDu35z8S84ts4o7o+konaDFqHoUTPS3N AAcYQ3tQ2UeofEgkDEytLGEXBYAfeZwvZXGTem6zCOKhQ52pnJShrMeUdJf76Q44kTSL 950XJhjVnEMbx+yZqXx/ij3BBTNLgvXqizxbfun4RbrQGdY0RXZiIhwYPgfopaKYw4FL xTqA== 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 h32-v6si316493pld.217.2018.03.13.10.06.03; Tue, 13 Mar 2018 10:06:19 -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; 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 S933057AbeCMREO (ORCPT + 99 others); Tue, 13 Mar 2018 13:04:14 -0400 Received: from g4t3425.houston.hpe.com ([15.241.140.78]:36880 "EHLO g4t3425.houston.hpe.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932955AbeCMRDw (ORCPT ); Tue, 13 Mar 2018 13:03:52 -0400 Received: from g4t3433.houston.hpecorp.net (g4t3433.houston.hpecorp.net [16.208.49.245]) by g4t3425.houston.hpe.com (Postfix) with ESMTP id EC409CE; Tue, 13 Mar 2018 17:03:51 +0000 (UTC) Received: from misato.americas.hpqcorp.net (misato.americas.hpqcorp.net [10.34.81.122]) by g4t3433.houston.hpecorp.net (Postfix) with ESMTP id 5B348493; Tue, 13 Mar 2018 17:03:51 +0000 (UTC) From: Toshi Kani To: tglx@linutronix.de, mingo@redhat.com, hpa@zytor.com Cc: bp@alien8.de, luto@kernel.org, gratian.crisan@ni.com, x86@kernel.org, linux-mm@kvack.org, linux-kernel@vger.kernel.org, Toshi Kani , stable@vger.kernel.org Subject: [PATCH 1/2] x86/mm: fix vmalloc_fault to use pXd_large Date: Tue, 13 Mar 2018 11:03:46 -0600 Message-Id: <20180313170347.3829-2-toshi.kani@hpe.com> X-Mailer: git-send-email 2.14.3 In-Reply-To: <20180313170347.3829-1-toshi.kani@hpe.com> References: <20180313170347.3829-1-toshi.kani@hpe.com> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Gratian Crisan reported that vmalloc_fault() crashes when CONFIG_HUGETLBFS is not set since the function inadvertently uses pXn_huge(), which always return 0 in this case. ioremap() does not depend on CONFIG_HUGETLBFS. Fix vmalloc_fault() to call pXd_large() instead. fixes: f4eafd8bcd52 ("x86/mm: Fix vmalloc_fault() to handle large pages properly") Reported-by: Gratian Crisan Signed-off-by: Toshi Kani Cc: Thomas Gleixner Cc: Ingo Molnar Cc: "H. Peter Anvin" Cc: Borislav Petkov Cc: Andy Lutomirski Cc: Gratian Crisan Cc: stable@vger.kernel.org --- arch/x86/mm/fault.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/arch/x86/mm/fault.c b/arch/x86/mm/fault.c index c88573d90f3e..25a30b5d6582 100644 --- a/arch/x86/mm/fault.c +++ b/arch/x86/mm/fault.c @@ -330,7 +330,7 @@ static noinline int vmalloc_fault(unsigned long address) if (!pmd_k) return -1; - if (pmd_huge(*pmd_k)) + if (pmd_large(*pmd_k)) return 0; pte_k = pte_offset_kernel(pmd_k, address); @@ -475,7 +475,7 @@ static noinline int vmalloc_fault(unsigned long address) if (pud_none(*pud) || pud_pfn(*pud) != pud_pfn(*pud_ref)) BUG(); - if (pud_huge(*pud)) + if (pud_large(*pud)) return 0; pmd = pmd_offset(pud, address); @@ -486,7 +486,7 @@ static noinline int vmalloc_fault(unsigned long address) if (pmd_none(*pmd) || pmd_pfn(*pmd) != pmd_pfn(*pmd_ref)) BUG(); - if (pmd_huge(*pmd)) + if (pmd_large(*pmd)) return 0; pte_ref = pte_offset_kernel(pmd_ref, address);