virtualization.lists.linux-foundation.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] x86/paravirt: Fix tlb_remove_table function callback prototype warning
@ 2023-07-26 23:11 Kees Cook
  2023-07-27  5:14 ` Juergen Gross via Virtualization
  2023-08-03 22:42 ` Kees Cook
  0 siblings, 2 replies; 3+ messages in thread
From: Kees Cook @ 2023-07-26 23:11 UTC (permalink / raw)
  To: Juergen Gross
  Cc: x86, Kees Cook, Peter Zijlstra, Dave Hansen, llvm, linux-kernel,
	virtualization, Nathan Chancellor, VMware PV-Drivers Reviewers,
	Ajay Kaher, Ingo Molnar, Borislav Petkov, linux-hardening,
	Sami Tolvanen, Alexey Makhalov, Thomas Gleixner,
	kernel test robot

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.

Reported-by: kernel test robot <lkp@intel.com>
Closes: https://lore.kernel.org/oe-kbuild-all/202307260332.pJntWR6o-lkp@intel.com/
Cc: Juergen Gross <jgross@suse.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Sami Tolvanen <samitolvanen@google.com>
Cc: Nathan Chancellor <nathan@kernel.org>
Cc: Ajay Kaher <akaher@vmware.com>
Cc: Alexey Makhalov <amakhalov@vmware.com>
Cc: VMware PV-Drivers Reviewers <pv-drivers@vmware.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Ingo Molnar <mingo@redhat.com>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: virtualization@lists.linux-foundation.org
Signed-off-by: Kees Cook <keescook@chromium.org>
---
 arch/x86/kernel/paravirt.c | 8 ++++++--
 1 file changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/paravirt.c b/arch/x86/kernel/paravirt.c
index ac10b46c5832..23d4d7114473 100644
--- a/arch/x86/kernel/paravirt.c
+++ b/arch/x86/kernel/paravirt.c
@@ -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,
-- 
2.34.1

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/paravirt: Fix tlb_remove_table function callback prototype warning
  2023-07-26 23:11 [PATCH] x86/paravirt: Fix tlb_remove_table function callback prototype warning Kees Cook
@ 2023-07-27  5:14 ` Juergen Gross via Virtualization
  2023-08-03 22:42 ` Kees Cook
  1 sibling, 0 replies; 3+ messages in thread
From: Juergen Gross via Virtualization @ 2023-07-27  5:14 UTC (permalink / raw)
  To: Kees Cook
  Cc: x86, kernel test robot, Peter Zijlstra, Dave Hansen, llvm,
	linux-kernel, virtualization, Nathan Chancellor,
	VMware PV-Drivers Reviewers, Ajay Kaher, Ingo Molnar,
	Borislav Petkov, linux-hardening, Sami Tolvanen, Alexey Makhalov,
	Thomas Gleixner


[-- Attachment #1.1.1.1: Type: text/plain, Size: 1390 bytes --]

On 27.07.23 01:11, Kees Cook wrote:
> 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.
> 
> Reported-by: kernel test robot <lkp@intel.com>
> Closes: https://lore.kernel.org/oe-kbuild-all/202307260332.pJntWR6o-lkp@intel.com/
> Cc: Juergen Gross <jgross@suse.com>
> Cc: Peter Zijlstra <peterz@infradead.org>
> Cc: Sami Tolvanen <samitolvanen@google.com>
> Cc: Nathan Chancellor <nathan@kernel.org>
> Cc: Ajay Kaher <akaher@vmware.com>
> Cc: Alexey Makhalov <amakhalov@vmware.com>
> Cc: VMware PV-Drivers Reviewers <pv-drivers@vmware.com>
> Cc: Thomas Gleixner <tglx@linutronix.de>
> Cc: Ingo Molnar <mingo@redhat.com>
> Cc: Borislav Petkov <bp@alien8.de>
> Cc: Dave Hansen <dave.hansen@linux.intel.com>
> Cc: virtualization@lists.linux-foundation.org
> Signed-off-by: Kees Cook <keescook@chromium.org>

Reviewed-by: Juergen Gross <jgross@suse.com>


Juergen


[-- Attachment #1.1.1.2: OpenPGP public key --]
[-- Type: application/pgp-keys, Size: 3149 bytes --]

[-- Attachment #1.2: OpenPGP digital signature --]
[-- Type: application/pgp-signature, Size: 495 bytes --]

[-- Attachment #2: Type: text/plain, Size: 183 bytes --]

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] x86/paravirt: Fix tlb_remove_table function callback prototype warning
  2023-07-26 23:11 [PATCH] x86/paravirt: Fix tlb_remove_table function callback prototype warning Kees Cook
  2023-07-27  5:14 ` Juergen Gross via Virtualization
@ 2023-08-03 22:42 ` Kees Cook
  1 sibling, 0 replies; 3+ messages in thread
From: Kees Cook @ 2023-08-03 22:42 UTC (permalink / raw)
  To: Juergen Gross, Kees Cook
  Cc: x86, kernel test robot, Peter Zijlstra, Dave Hansen, llvm,
	linux-kernel, virtualization, Nathan Chancellor,
	VMware PV-Drivers Reviewers, Ajay Kaher, Ingo Molnar,
	Borislav Petkov, linux-hardening, Sami Tolvanen, Alexey Makhalov,
	Thomas Gleixner

On Wed, 26 Jul 2023 16:11:43 -0700, Kees Cook wrote:
> 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.
> 
> [...]

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,

-- 
Kees Cook

_______________________________________________
Virtualization mailing list
Virtualization@lists.linux-foundation.org
https://lists.linuxfoundation.org/mailman/listinfo/virtualization

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2023-08-03 22:43 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-07-26 23:11 [PATCH] x86/paravirt: Fix tlb_remove_table function callback prototype warning Kees Cook
2023-07-27  5:14 ` Juergen Gross via Virtualization
2023-08-03 22:42 ` Kees Cook

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).