x86/paravirt: Fix tlb_remove_table function callback prototype warning
Subsystems (3)
PATCH 1/1 x86/paravirt: Fix tlb_remove_table function callback prototype warning
Under W=1, this warning is visible in Clang 16 and newer:
arch/x86/kernel/paravirt.c:337:4: warning: cast from 'void (*)(struct mmu_gather *, struct page *)' to 'void (*)(struct mmu_gather *, void *)' converts to incompatible function type [-Wcast-function-type-strict]
(void (*)(struct mmu_gather *, void *))tlb_remove_page,
^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Add a direct wrapper instead, which will make this warning (and potential KCFI failures) go away.
--- arch/x86/kernel/paravirt.c | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-)
arch/x86/kernel/paravirt.c +6 -2
@@ -79,6 +79,11 @@ void __init native_pv_lock_init(void)static_branch_disable (&virt_spin_lock_key); } +static void native_tlb_remove_table (struct mmu_gather *tlb,void *table) +{ +tlb_remove_page (tlb, table); +} +unsigned int paravirt_patch (u8 type,void *insn_buff,unsigned long addr,unsigned int len) {
@@ -295,8 +300,7 @@ struct paravirt_patch_template pv_ops = { .mmu.flush_tlb_kernel = native_flush_tlb_global, .mmu.flush_tlb_one_user = native_flush_tlb_one_user, .mmu.flush_tlb_multi = native_flush_tlb_multi, - .mmu.tlb_remove_table = - (void (*)(struct mmu_gather *, void *))tlb_remove_page, + .mmu.tlb_remove_table = native_tlb_remove_table, .mmu.exit_mmap = paravirt_nop, .mmu.notify_page_enc_status_changed = paravirt_nop,
Signature · 1 line
2.34.1
Quoted 9 lines · Kees Cook
Under W=1, this warning is visible in Clang 16 and newer:
arch/x86/kernel/paravirt.c:337:4: warning: cast from 'void (*)(structmmu_gather*, struct page *)' to 'void (*)(structmmu_gather*, void *)' converts to incompatible function type [-Wcast-function-type-strict](void (*)(struct mmu_gather *, void *))tlb_remove_page, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Add a direct wrapper instead, which will make this warning (and potential KCFI failures) go away.
Quoted 15 lines
Reported-by kernel test robot <[email protected]>Cc Juergen Gross <[email protected]>Cc Peter Zijlstra <[email protected]>Cc Sami Tolvanen <[email protected]>Cc Nathan Chancellor <[email protected]>Cc Ajay Kaher <[email protected]>Cc Alexey Makhalov <[email protected]>Cc VMware PV-Drivers Reviewers <[email protected]>Cc Thomas Gleixner <[email protected]>Cc Ingo Molnar <[email protected]>Cc Borislav Petkov <[email protected]>Cc Dave Hansen <[email protected]>Signed-off-by Kees Cook <[email protected]>
Juergen
Kees Cook
AppliedQuoted 10 lines · Kees Cook
Under W=1, this warning is visible in Clang 16 and newer:
arch/x86/kernel/paravirt.c:337:4: warning: cast from 'void (*)(structmmu_gather*, struct page *)' to 'void (*)(structmmu_gather*, void *)' converts to incompatible function type [-Wcast-function-type-strict](void (*)(struct mmu_gather *, void *))tlb_remove_page, ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~Add a direct wrapper instead, which will make this warning (and potential KCFI failures) go away.
[...]
Applied to for-next/hardening, thanks!
[1/1] x86/paravirt: Fix tlb_remove_table function callback prototype warning
https://git.kernel.org/kees/c/fcce1c6cb156
Take care,
Signature · 1 line
Kees Cook