liveupdate: luo_session: include linux/mm.h for virt/phys translation
Subsystems (3)
PATCH v2 1/1 liveupdate: luo_session: include linux/mm.h for virt/phys translation
From: George Guo <[email protected]>
luo_session.c calls virt_to_phys() and phys_to_virt(). On LoongArch with CONFIG_KFENCE=y, these macros (in arch/loongarch/include/asm/io.h) expand to offset_in_page() and page_address(), both declared in <linux/mm.h>.
Since luo_session.c only includes <linux/io.h>, the translation unit fails to build with CONFIG_KFENCE=y:
asm/io.h: error: implicit declaration of function 'offset_in_page' asm/io.h: error: implicit declaration of function 'page_address'
Add the missing include to fix these build errors.
---
v2: Move the include from arch/loongarch/include/asm/io.h to the consumer
luo_session.c, instead of pulling the heavy <linux/mm.h> into the low-level asm/io.h header (per review feedback). The 0-day report confirmed the v1 approach introduces a circular include (slab.h -> kasan.h -> asm/kasan.h -> asm/io.h -> mm.h, where mm.h needs kfree() before slab.h declares it).
kernel/liveupdate/luo_session.c | 1 + 1 file changed, 1 insertion(+)
kernel/liveupdate/luo_session.c +1 -0
@@ -62,6 +62,7 @@#include <linux/libfdt.h> #include <linux/list.h> #include <linux/liveupdate.h> +#include <linux/mm.h> #include <linux/mutex.h> #include <linux/rwsem.h> #include <linux/slab.h>
Signature · 1 line
2.25.1
Quoted 9 lines · George Guo
From: George Guo <[email protected]>
luo_session.ccallsvirt_to_phys()andphys_to_virt(). On LoongArch withCONFIG_KFENCE=y, these macros (inarch/loongarch/include/asm/io.h) expand tooffset_in_page()andpage_address(), both declared in <linux/mm.h>.Since
luo_session.conly includes <linux/io.h>, the translation unit fails to build withCONFIG_KFENCE=y:
Quoted 8 lines
asm/io.h: error: implicit declaration of function 'offset_in_page'asm/io.h: error: implicit declaration of function 'page_address'Add the missing include to fix these build errors.
Co-developed-by Kexin Liu <[email protected]>Signed-off-by Kexin Liu <[email protected]>Signed-off-by George Guo <[email protected]>
Please send this patch along with the series that enable KHO on LoongArch.
Quoted 27 lines
---
v2: Move the include fromarch/loongarch/include/asm/io.hto the consumer
luo_session.c, instead of pulling the heavy <linux/mm.h> into the low-levelasm/io.hheader (per review feedback). The 0-day report confirmed the v1 approach introduces a circular include (slab.h->kasan.h->asm/kasan.h->asm/io.h->mm.h, wheremm.hneedskfree()beforeslab.hdeclares it).kernel/liveupdate/luo_session.c | 1 + 1 file changed, 1 insertion(+)kernel/liveupdate/luo_session.c +1
-0@@ -62,6 +62,7 @@#include <linux/libfdt.h> #include <linux/list.h> #include <linux/liveupdate.h> +#include <linux/mm.h> #include <linux/mutex.h> #include <linux/rwsem.h> #include <linux/slab.h> Signature · 1 line
2.25.1
Signature · 2 lines
Sincerely yours, Mike.