Messages in this thread | | | From | Sven Schnelle <> | Subject | Re: [PATCH 1/2] kfence: add function to mask address bits | Date | Fri, 14 May 2021 13:03:35 +0200 |
| |
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
| |