[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20241206101110.1646108-14-kevin.brodsky@arm.com>
Date: Fri, 6 Dec 2024 10:11:07 +0000
From: Kevin Brodsky <kevin.brodsky@....com>
To: linux-hardening@...r.kernel.org
Cc: linux-kernel@...r.kernel.org,
Kevin Brodsky <kevin.brodsky@....com>,
aruna.ramakrishna@...cle.com,
broonie@...nel.org,
catalin.marinas@....com,
dave.hansen@...ux.intel.com,
jannh@...gle.com,
jeffxu@...omium.org,
joey.gouly@....com,
kees@...nel.org,
maz@...nel.org,
pierre.langlois@....com,
qperret@...gle.com,
ryan.roberts@....com,
will@...nel.org,
linux-arm-kernel@...ts.infradead.org,
x86@...nel.org
Subject: [RFC PATCH 13/16] arm64: mm: Reset pkey in __tlb_remove_table()
Page table pages are typically freed via tlb_remove_table() and
friends. Ensure that the linear mapping for those pages is reset to
the default pkey when CONFIG_KPKEYS_HARDENED_PGTABLES is enabled.
This patch is a no-op if CONFIG_KPKEYS_HARDENED_PGTABLES is disabled
(default).
Signed-off-by: Kevin Brodsky <kevin.brodsky@....com>
---
arch/arm64/include/asm/tlb.h | 6 +++++-
1 file changed, 5 insertions(+), 1 deletion(-)
diff --git a/arch/arm64/include/asm/tlb.h b/arch/arm64/include/asm/tlb.h
index a947c6e784ed..d1611ffa6d91 100644
--- a/arch/arm64/include/asm/tlb.h
+++ b/arch/arm64/include/asm/tlb.h
@@ -10,10 +10,14 @@
#include <linux/pagemap.h>
#include <linux/swap.h>
+#include <linux/kpkeys.h>
static inline void __tlb_remove_table(void *_table)
{
- free_page_and_swap_cache((struct page *)_table);
+ struct page *page = (struct page *)_table;
+
+ kpkeys_unprotect_pgtable_memory((unsigned long)page_address(page), 1);
+ free_page_and_swap_cache(page);
}
#define tlb_flush tlb_flush
--
2.47.0
Powered by blists - more mailing lists