[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20200929183513.380760-7-alex.popov@linux.com>
Date: Tue, 29 Sep 2020 21:35:13 +0300
From: Alexander Popov <alex.popov@...ux.com>
To: Kees Cook <keescook@...omium.org>, Jann Horn <jannh@...gle.com>,
Will Deacon <will@...nel.org>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Alexander Potapenko <glider@...gle.com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Christoph Lameter <cl@...ux.com>,
Pekka Enberg <penberg@...nel.org>,
David Rientjes <rientjes@...gle.com>,
Joonsoo Kim <iamjoonsoo.kim@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
Masahiro Yamada <masahiroy@...nel.org>,
Masami Hiramatsu <mhiramat@...nel.org>,
Steven Rostedt <rostedt@...dmis.org>,
Peter Zijlstra <peterz@...radead.org>,
Krzysztof Kozlowski <krzk@...nel.org>,
Patrick Bellasi <patrick.bellasi@....com>,
David Howells <dhowells@...hat.com>,
Eric Biederman <ebiederm@...ssion.com>,
Johannes Weiner <hannes@...xchg.org>,
Laura Abbott <labbott@...hat.com>,
Arnd Bergmann <arnd@...db.de>,
Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Daniel Micay <danielmicay@...il.com>,
Andrey Konovalov <andreyknvl@...gle.com>,
Matthew Wilcox <willy@...radead.org>,
Pavel Machek <pavel@...x.de>,
Valentin Schneider <valentin.schneider@....com>,
kasan-dev@...glegroups.com, linux-mm@...ck.org,
kernel-hardening@...ts.openwall.com, linux-kernel@...r.kernel.org,
Alexander Popov <alex.popov@...ux.com>
Cc: notify@...nel.org
Subject: [PATCH RFC v2 6/6] mm: Add heap quarantine verbose debugging (not for merge)
Add verbose debugging for deeper understanding of the heap quarantine
inner workings (this patch is not for merge).
Signed-off-by: Alexander Popov <alex.popov@...ux.com>
---
mm/kasan/quarantine.c | 21 +++++++++++++++++++++
1 file changed, 21 insertions(+)
diff --git a/mm/kasan/quarantine.c b/mm/kasan/quarantine.c
index 4ce100605086..98cd6e963755 100644
--- a/mm/kasan/quarantine.c
+++ b/mm/kasan/quarantine.c
@@ -203,6 +203,12 @@ void quarantine_put(struct kasan_free_meta *info, struct kmem_cache *cache)
qlist_move_all(q, &temp);
raw_spin_lock(&quarantine_lock);
+
+ pr_info("quarantine: PUT %zu to tail batch %d, whole sz %zu, batch sz %lu\n",
+ temp.bytes, quarantine_tail,
+ READ_ONCE(quarantine_size),
+ READ_ONCE(quarantine_batch_size));
+
WRITE_ONCE(quarantine_size, quarantine_size + temp.bytes);
qlist_move_all(&temp, &global_quarantine[quarantine_tail]);
if (global_quarantine[quarantine_tail].bytes >=
@@ -313,7 +319,22 @@ void quarantine_reduce(void)
quarantine_head = get_random_int() % QUARANTINE_BATCHES;
} while (quarantine_head == quarantine_tail);
qlist_move_random(&global_quarantine[quarantine_head], &to_free);
+ pr_info("quarantine: whole sz exceed max by %lu, REDUCE head batch %d by %zu, leave %zu\n",
+ quarantine_size - quarantine_max_size,
+ quarantine_head, to_free.bytes,
+ global_quarantine[quarantine_head].bytes);
WRITE_ONCE(quarantine_size, quarantine_size - to_free.bytes);
+
+ if (quarantine_head == 0) {
+ unsigned long i;
+
+ pr_info("quarantine: data level in batches:");
+ for (i = 0; i < QUARANTINE_BATCHES; i++) {
+ pr_info(" %lu - %lu%%\n",
+ i, global_quarantine[i].bytes *
+ 100 / quarantine_batch_size);
+ }
+ }
}
#endif
--
2.26.2
Powered by blists - more mailing lists