On 8/21/25 04:57, Harry Yoo wrote:
However, {pgd,p4d}_populate_kernel() is defined as a function regardless of the number of page table levels, so the compiler may not optimize them away. In this case, the following linker error occurs:
This part of the changelog confused me. I think it's focusing on the wrong thing.
The code that's triggering this is literally:
pgd_populate(&init_mm, pgd, lm_alias(kasan_early_shadow_p4d));
It sure _looks_ like it's unconditionally referencing the 'kasan_early_shadow_p4d' symbol. I think it's wrong to hide that with macro magic and just assume that the macros won't reference it.
If a symbol isn't being defined, it shouldn't be referenced in C code.:q
The right way to do it is to have an #ifdef in a header that avoids compiling in the reference to the symbol.
But just changing the 'static inline' to a #define seems like a fragile hack to me.