From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1953526AbdDYSxr (ORCPT ); Tue, 25 Apr 2017 14:53:47 -0400 Received: from mail-wr0-f195.google.com ([209.85.128.195]:33574 "EHLO mail-wr0-f195.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1951737AbdDYSxi (ORCPT ); Tue, 25 Apr 2017 14:53:38 -0400 Date: Tue, 25 Apr 2017 20:53:34 +0200 From: Ingo Molnar To: Dan Williams Cc: "Kirill A. Shutemov" , X86 ML , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andi Kleen , Dave Hansen , Andy Lutomirski , Linux MM , "linux-kernel@vger.kernel.org" Subject: Re: [PATCH] x86/mm/64: Fix crash in remove_pagetable() Message-ID: <20170425185333.3ecz46gn5ufy4bwi@gmail.com> References: <20170425092557.21852-1-kirill.shutemov@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org * Dan Williams wrote: > On Tue, Apr 25, 2017 at 2:25 AM, Kirill A. Shutemov > wrote: > > remove_pagetable() does page walk using p*d_page_vaddr() plus cast. > > It's not canonical approach -- we usually use p*d_offset() for that. > > > > It works fine as long as all page table levels are present. We broke the > > invariant by introducing folded p4d page table level. > > > > As result, remove_pagetable() interprets PMD as PUD and it leads to > > crash: > > > > BUG: unable to handle kernel paging request at ffff880300000000 > > IP: memchr_inv+0x60/0x110 > > PGD 317d067 > > P4D 317d067 > > PUD 3180067 > > PMD 33f102067 > > PTE 8000000300000060 > > > > Let's fix this by using p*d_offset() instead of p*d_page_vaddr() for > > page walk. > > > > Signed-off-by: Kirill A. Shutemov > > Reported-by: Dan Williams > > Fixes: f2a6a7050109 ("x86: Convert the rest of the code to support p4d_t") > > Thanks! This patch on top of tip/master passes a full run of the > nvdimm regression suite. > > Tested-by: Dan Williams Does a re-application of: "x86/mm/gup: Switch GUP to the generic get_user_page_fast() implementation" still work (which you can achive via 'git revert 6dd29b3df975'), or is that another breakage? Thanks, Ingo