[PATCH v9] mm,kfence: decouple kfence from page granularity mapping judgement

Zhenhua Huang quic_zhenhuah at quicinc.com
Thu Mar 16 04:17:06 PDT 2023



On 2023/3/16 18:56, Alexander Potapenko wrote:
> 
> 
>      >> +    /* Kfence pool needs page-level mapping */
>      >> +    if (early_kfence_pool) {
>      >> +            __map_memblock(pgdp, early_kfence_pool,
>      >> +                    early_kfence_pool + KFENCE_POOL_SIZE,
>      >> +                    pgprot_tagged(PAGE_KERNEL),
>      >> +                    NO_BLOCK_MAPPINGS | NO_CONT_MAPPINGS);
>      >> +            memblock_clear_nomap(early_kfence_pool,
>     KFENCE_POOL_SIZE);
>      >> +            /* kfence_pool really mapped now */
>      >> +            kfence_set_pool(early_kfence_pool);
>      >> +    }
>      >
>      > Why not wrap this under CONFIG_KFENCE ? early_kfence_pool can
>     also go in
>      > there?
> 
>     Because I didn't want to add CONFIG_KFENCE in function.. in the case of
>     w/o CONFIG_KFENCE, early_kfence_pool should be always NULL.
> 
> Please no. If the code is not used in non-KFENCE build, it should not be 
> compiled. Same holds for the variables that only exist in KFENCE builds.

Got it, yeah.. it seems not make sense to have this variable w/o 
CONFIG_KFENCE.

Thanks,
Zhenhua



More information about the linux-arm-kernel mailing list