Thread (71 messages) 71 messages, 6 authors, 2020-11-16

Re: [PATCH RFC v2 14/21] kasan: add and integrate kasan boot parameters

From: Marco Elver <elver@google.com>
Date: 2020-10-30 14:56:06
Also in: linux-mm, lkml

On Thu, 22 Oct 2020 at 15:19, Andrey Konovalov [off-list ref] wrote:
quoted hunk ↗ jump to hunk
TODO: no meaningful description here yet, please see the cover letter
      for this RFC series.

Signed-off-by: Andrey Konovalov <redacted>
Link: https://linux-review.googlesource.com/id/If7d37003875b2ed3e0935702c8015c223d6416a4
---
 mm/kasan/common.c  |  92 +++++++++++++-----------
 mm/kasan/generic.c |   5 ++
 mm/kasan/hw_tags.c | 169 ++++++++++++++++++++++++++++++++++++++++++++-
 mm/kasan/kasan.h   |   9 +++
 mm/kasan/report.c  |  14 +++-
 mm/kasan/sw_tags.c |   5 ++
 6 files changed, 250 insertions(+), 44 deletions(-)
diff --git a/mm/kasan/common.c b/mm/kasan/common.c
index 1a5e6c279a72..cc129ef62ab1 100644
--- a/mm/kasan/common.c
+++ b/mm/kasan/common.c
@@ -129,35 +129,37 @@ void kasan_cache_create(struct kmem_cache *cache, unsigned int *size,
        unsigned int redzone_size;
        int redzone_adjust;

-       /* Add alloc meta. */
-       cache->kasan_info.alloc_meta_offset = *size;
-       *size += sizeof(struct kasan_alloc_meta);
-
-       /* Add free meta. */
-       if (IS_ENABLED(CONFIG_KASAN_GENERIC) &&
-           (cache->flags & SLAB_TYPESAFE_BY_RCU || cache->ctor ||
-            cache->object_size < sizeof(struct kasan_free_meta))) {
-               cache->kasan_info.free_meta_offset = *size;
-               *size += sizeof(struct kasan_free_meta);
-       }
-
-       redzone_size = optimal_redzone(cache->object_size);
-       redzone_adjust = redzone_size - (*size - cache->object_size);
-       if (redzone_adjust > 0)
-               *size += redzone_adjust;
-
-       *size = min_t(unsigned int, KMALLOC_MAX_SIZE,
-                       max(*size, cache->object_size + redzone_size));
+       if (static_branch_unlikely(&kasan_stack)) {
I just looked at this file in your Github repo, and noticed that this
could just be

if (!static_branch_unlikely(&kasan_stack))
    return;

since the if-block ends at the function. That might hopefully make the
diff a bit smaller.

Thanks,
-- Marco

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help