[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <tip-0e311d237d7f3022b7dafb639b42541bfb42fe94@git.kernel.org>
Date: Tue, 26 Jun 2018 03:33:11 -0700
From: tip-bot for Andrey Ryabinin <tipbot@...or.com>
To: linux-tip-commits@...r.kernel.org
Cc: linux-kernel@...r.kernel.org, kirill.shutemov@...ux.intel.com,
torvalds@...ux-foundation.org, tglx@...utronix.de, hpa@...or.com,
mingo@...nel.org, aryabinin@...tuozzo.com, peterz@...radead.org
Subject: [tip:x86/urgent] x86/mm: Don't free P4D table when it is folded at
runtime
Commit-ID: 0e311d237d7f3022b7dafb639b42541bfb42fe94
Gitweb: https://git.kernel.org/tip/0e311d237d7f3022b7dafb639b42541bfb42fe94
Author: Andrey Ryabinin <aryabinin@...tuozzo.com>
AuthorDate: Mon, 25 Jun 2018 13:24:27 +0300
Committer: Ingo Molnar <mingo@...nel.org>
CommitDate: Tue, 26 Jun 2018 09:21:48 +0200
x86/mm: Don't free P4D table when it is folded at runtime
When the P4D page table layer is folded at runtime, the p4d_free()
should do nothing, the same as in <asm-generic/pgtable-nop4d.h>.
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 <aryabinin@...tuozzo.com>
Reviewed-by: Kirill A. Shutemov <kirill.shutemov@...ux.intel.com>
Cc: Linus Torvalds <torvalds@...ux-foundation.org>
Cc: Peter Zijlstra <peterz@...radead.org>
Cc: Thomas Gleixner <tglx@...utronix.de>
Cc: stable@...r.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 <mingo@...nel.org>
---
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 ada6410fd2ec..fbd578daa66e 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;
+
BUG_ON((unsigned long)p4d & (PAGE_SIZE-1));
free_page((unsigned long)p4d);
}
Powered by blists - more mailing lists