From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: from mail.linuxfoundation.org ([140.211.169.12]:50524 "EHLO mail.linuxfoundation.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932136AbeGBJhm (ORCPT ); Mon, 2 Jul 2018 05:37:42 -0400 Date: Mon, 2 Jul 2018 11:37:39 +0200 From: Greg KH To: Andrey Ryabinin Cc: stable-commits@vger.kernel.org, Linus Torvalds , Peter Zijlstra , Thomas Gleixner , stable@vger.kernel.org, Ingo Molnar Subject: Re: [PATCH 4.17 v2] x86/mm: Don't free P4D table when it is folded at runtime Message-ID: <20180702093739.GA9232@kroah.com> References: <20180701143858.GA22410@kroah.com> <20180702084828.30113-1-aryabinin@virtuozzo.com> <20180702091520.GB7140@kroah.com> <1f686f00-1017-b738-8b53-46f8875179c1@virtuozzo.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1f686f00-1017-b738-8b53-46f8875179c1@virtuozzo.com> Sender: stable-owner@vger.kernel.org List-ID: On Mon, Jul 02, 2018 at 12:20:06PM +0300, Andrey Ryabinin wrote: > > > On 07/02/2018 12:15 PM, Greg KH wrote: > > On Mon, Jul 02, 2018 at 11:48:28AM +0300, Andrey Ryabinin wrote: > >> commit 0e311d237d7f3022b7dafb639b42541bfb42fe94 upstream. > >> > >> When the P4D page table layer is folded at runtime, the p4d_free() > >> should do nothing, the same as in . > >> > >> It seems this bug should cause double-free in efi_call_phys_epilog(), > >> but I don't know how to trigger that code path, so I can't confirm that > >> by testing. > >> > >> Signed-off-by: Andrey Ryabinin > >> Reviewed-by: Kirill A. Shutemov > >> Cc: Linus Torvalds > >> Cc: Peter Zijlstra > >> Cc: Thomas Gleixner > >> Cc: stable@vger.kernel.org # 4.17 > >> Fixes: 98219dda2ab5 ("x86/mm: Fold p4d page table layer at runtime") > >> Link: http://lkml.kernel.org/r/20180625102427.15015-1-aryabinin@virtuozzo.com > >> Signed-off-by: Ingo Molnar > >> Signed-off-by: Andrey Ryabinin > >> --- > >> > >> Changes since v1: > >> - Fix wrong "From:" field > >> > >> arch/x86/include/asm/pgalloc.h | 3 +++ > >> 1 file changed, 3 insertions(+) > >> > >> diff --git a/arch/x86/include/asm/pgalloc.h b/arch/x86/include/asm/pgalloc.h > >> index 263c142a6a6c..f65e9e1cea4c 100644 > >> --- a/arch/x86/include/asm/pgalloc.h > >> +++ b/arch/x86/include/asm/pgalloc.h > >> @@ -184,6 +184,9 @@ static inline p4d_t *p4d_alloc_one(struct mm_struct *mm, unsigned long addr) > >> > >> static inline void p4d_free(struct mm_struct *mm, p4d_t *p4d) > >> { > >> + if (!pgtable_l5_enabled) > >> + return; > >> + > > > > Again, did you actually test-build this? > > Again, yes, I did test-build this. > > > What changed from the original > > patch which blew the build up into little tiny pieces? > > > > Removed '()'. In 4.17 pgtable_l5_enabled is variable, in 4.18 it's function. Ah, good, it wasn't obvious that you changed anything. I'll queue this up after these latest kernels are released in a few days. thanks, greg k-h