lkml.org 
[lkml]   [2023]   [Nov]   [9]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
SubjectRe: [RFC] mm/kasan: Add Allocation, Free, Error timestamps to KASAN report
From
On 2023/11/2 22:58, Andrey Konovalov wrote:
> On Tue, Oct 31, 2023 at 10:46 AM Dmitry Vyukov <dvyukov@google.com> wrote:
>>
>>>>>> There is also an aspect of memory consumption. KASAN headers increase
>>>>>> the size of every heap object. So we tried to keep them as compact as
>>>>>> possible. At some point CPU numbers and timestamps (IIRC) were already
>>>>>> part of the header, but we removed them to shrink the header to 16
>>>>>> bytes.
>
>>> Do you think it is worth using the extra bytes to record more
>>> information? If this is a user-configurable feature.
>>
>> If it's user-configurable, then it is OK.
>
> FWIW, Generic KASAN already stores the auxiliary stack handles in the
> redzone, so the size of the redzone header is 24 bytes. Perhaps, we
> should hide them under a config as well.
>
> However, the increase of the redzone header size will only affect
> small kmalloc allocations (<= 16 bytes, as kmalloc allocations are
> aligned to the size of the object and the redzone is thus as big as
> the object anyway) and small non-kmalloc slab allocations (<= 64
> bytes, for which optimal_redzone returns 16). So I don't think adding
> new fields to the redzone will increase the memory usage by much. But
> this needs to be tested to make sure.

Yes, I read the design documentation and source code of KASAN
in depth today.

Currently in Generic mode, the alloc meta is stored in the redzone
(unless it doesn't fit) and the free meta is stored in the object
(or in the redzone if it cannot be stored in the object).

Therefore, I also think that using a few extra bytes to record more
information may consume less extra memory than we expected.

I am trying to implement the feature to let KASAN record more
information (configurable) and test it, I will send an PATCH RFC
when I am done.

Thanks.

\
 
 \ /
  Last update: 2023-11-20 13:54    [W:1.197 / U:0.056 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site