[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date: Tue, 4 Apr 2023 12:40:23 +0200
From: Alexander Potapenko <glider@...gle.com>
To: Peng Zhang <zhangpeng.00@...edance.com>
Cc: elver@...gle.com, dvyukov@...gle.com, akpm@...ux-foundation.org,
kasan-dev@...glegroups.com, linux-mm@...ck.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2] mm: kfence: Improve the performance of
__kfence_alloc() and __kfence_free()
> >
> > /* Apply to left of object. */
> > - for (addr = pageaddr; addr < meta->addr; addr++) {
> > - if (!fn((u8 *)addr))
> > + for (; meta->addr - addr >= sizeof(u64); addr += sizeof(u64)) {
> > + if (unlikely(*((u64 *)addr) != KFENCE_CANARY_PATTERN_U64))
> > break;
> > }
> I am confused. Right now this loop either runs from pageaddr to
> meta_addr if there's no corruption, or breaks at the first corrupted
> byte.
> Regardless of that, we are applying check_canary_byte() to every byte
> of that range in the following loop.
> Shouldn't the two be nested, like in the case of the canary bytes to
> the right of the object?
>
Please disregard my comment. This loop is fine, it just speeds up
finding the first corrupted byte.
Powered by blists - more mailing lists