Skip to contentSkip to conversation

kasan-clean-up-kasan_requires_meta.patch removed from -mm tree

merged mm-stable Andrew Morton 1 participant 1 message Dec 29, 2023

lore
Share & tools
lore

Andrew Morton

author tree notice Applied
#0 lore raw

The quilt patch titled
Subject: kasan: clean up kasan_requires_meta
has been removed from the -mm tree. Its filename was
kasan-clean-up-kasan_requires_meta.patch

This patch was dropped because it was merged into the mm-stable branch of git://git.kernel.org/pub/scm/linux/kernel/git/akpm/mm

------------------------------------------------------
From: Andrey Konovalov <[email protected]>
Subject: kasan: clean up kasan_requires_meta
Date: Thu, 21 Dec 2023 21:04:46 +0100

Currently, for Generic KASAN mode, kasan_requires_meta is defined to return kasan_stack_collection_enabled.

Even though the Generic mode does not support disabling stack trace collection, kasan_requires_meta was implemented in this way to make it easier to implement the disabling for the Generic mode in the future.

However, for the Generic mode, the per-object metadata also stores the quarantine link. So even if disabling stack collection is implemented, the per-object metadata will still be required.

Fix kasan_requires_meta to return true for the Generic mode and update the related comments.

This change does not fix any observable bugs but rather just brings the code to a cleaner state.

---

 mm/kasan/kasan.h |   18 +++++++++---------
 1 file changed, 9 insertions(+), 9 deletions(-)
mm/kasan/kasan.h renamed from mm/kasan/kasan.h~kasan-clean-up-kasan_requires_meta +9 -9
@@ -101,21 +101,21 @@ static inline bool kasan_sample_page_all
 
 #ifdef CONFIG_KASAN_GENERIC
 
-/* Generic KASAN uses per-object metadata to store stack traces. */
+/*
+ * Generic KASAN uses per-object metadata to store alloc and free stack traces
+ * and the quarantine link.
+ */
 static inline bool kasan_requires_meta(void)
 {
-	/*
-	 * Technically, Generic KASAN always collects stack traces right now.
-	 * However, let's use kasan_stack_collection_enabled() in case the
-	 * kasan.stacktrace command-line argument is changed to affect
-	 * Generic KASAN.
-	 */
-	return kasan_stack_collection_enabled();
+	return true;
 }
 
 #else /* CONFIG_KASAN_GENERIC */
 
-/* Tag-based KASAN modes do not use per-object metadata. */
+/*
+ * Tag-based KASAN modes do not use per-object metadata: they use the stack
+ * ring to store alloc and free stack traces and do not use qurantine.
+ */
 static inline bool kasan_requires_meta(void)
 {
 	return false;

_

Patches currently in -mm which might be from [email protected] are

kasan-stop-leaking-stack-trace-handles.patch