lkml.org 
[lkml]   [2021]   [May]   [14]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH 1/2] kfence: add function to mask address bits
Date
Marco Elver <elver@google.com> writes:

>> diff --git a/mm/kfence/core.c b/mm/kfence/core.c
>> index e18fbbd5d9b4..bc15e3cb71d5 100644
>> --- a/mm/kfence/core.c
>> +++ b/mm/kfence/core.c
>> @@ -50,6 +50,11 @@ static unsigned long kfence_sample_interval __read_mostly = CONFIG_KFENCE_SAMPLE
>> #endif
>> #define MODULE_PARAM_PREFIX "kfence."
>>
>> +unsigned long __weak kfence_arch_mask_addr(unsigned long addr)
>> +{
>> + return addr;
>> +}
>
> I don't think this belongs here, because it's test-specific,
> furthermore if possible we'd like to put all arch-specific code into
> <asm/kfence.h> (whether or not your arch will have 'static inline'
> functions only, like x86 and arm64, or not is up to you).
>
> Because I don't see this function being terribly complex, also let's
> just make it a macro.
>
> Then in kfence_test.c, we can have:
>
> #ifndef kfence_test_mask_address
> #define kfence_test_mask_address(addr) (addr)
> #endif
>
> and then have it include <asm/kfence.h>. And in your <asm/kfence.h>
> you can simply say:
>
> #define kfence_test_mask_address(addr) (.........)
>
> It also avoids having to export kfence_test_mask_address, because
> kfence_test can be built as a module.

Ok, i'll change my patch accordingly. Thanks!

Sven

\
 
 \ /
  Last update: 2021-05-14 13:04    [W:0.036 / U:0.096 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site