[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAAeHK+wF_BBSDukSPRTTc0N=OuFgKXquzthCxdR3Gq=p6jA9WQ@mail.gmail.com>
Date: Fri, 30 Oct 2020 20:30:34 +0100
From: Andrey Konovalov <andreyknvl@...gle.com>
To: Marco Elver <elver@...gle.com>
Cc: Catalin Marinas <catalin.marinas@....com>,
Will Deacon <will.deacon@....com>,
Vincenzo Frascino <vincenzo.frascino@....com>,
Dmitry Vyukov <dvyukov@...gle.com>,
Alexander Potapenko <glider@...gle.com>,
Evgenii Stepanov <eugenis@...gle.com>,
Kostya Serebryany <kcc@...gle.com>,
Peter Collingbourne <pcc@...gle.com>,
Serban Constantinescu <serbanc@...gle.com>,
Andrey Ryabinin <aryabinin@...tuozzo.com>,
Elena Petrova <lenaptr@...gle.com>,
Branislav Rankov <Branislav.Rankov@....com>,
Kevin Brodsky <kevin.brodsky@....com>,
Andrew Morton <akpm@...ux-foundation.org>,
kasan-dev <kasan-dev@...glegroups.com>,
Linux ARM <linux-arm-kernel@...ts.infradead.org>,
Linux Memory Management List <linux-mm@...ck.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH RFC v2 14/21] kasan: add and integrate kasan boot parameters
On Fri, Oct 30, 2020 at 3:45 PM Marco Elver <elver@...gle.com> wrote:
>
> On Thu, 22 Oct 2020 at 15:19, Andrey Konovalov <andreyknvl@...gle.com> wrote:
> >
> > TODO: no meaningful description here yet, please see the cover letter
> > for this RFC series.
> >
> > Signed-off-by: Andrey Konovalov <andreyknvl@...gle.com>
> > 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.
Will do, thanks!
Powered by blists - more mailing lists