Skip to content

KVM: x86: Fix UBSAN bool warnings in module parameters

Gal Pressman kvm lkml 2 versions – Applied

Status from this message: Applied patch 1 to kvm-x86 svm, and patch 2 to kvm-x86 mmu. Thanks!

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 Latest2 patches 2 repliesApplied
  2. v12 patches 4 repliesSuperseded

Patches in v2 Applied

#Subject and filesSizeRepliesApplied
1/2KVM: SVM: Fix UBSAN warning when reading avic parameterarch/x86/kvm/svm/avic.c+12 -11 reply
2/2KVM: x86/mmu: Fix UBSAN warning when reading nx_huge_pages parameterarch/x86/kvm/mmu/mmu.c+5 -00 replies

Reviews trailers per patch

All 2 patches have a Reviewed-by or Acked-by.

PatchDragos TatuleaNaveen N Rao (AMD)
1/2R-b R-b
2/2R-b

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v2 thread

Cover letter [PATCH v2 0/2] KVM: x86: Fix UBSAN bool warnings in module parameters

Several KVM module parameters use int to support a special -1 (auto) value, but rely on param_get_bool() for the sysfs getter. When userspace reads these parameters before the auto value is resolved, param_get_bool() interprets the int as a bool, triggering UBSAN "load of value 255 is not a valid value for type '_Bool'" warnings.

Fix both instances by implementing getter functions that handle the -1 case before falling through to param_get_bool().

Changelog -
v1->v2: https://lore.kernel.org/all/[email protected]/
* Show auto avic as 'N' (Naveen)

Gal Pressman (2):
KVM: SVM: Fix UBSAN warning when reading avic parameter
KVM: x86/mmu: Fix UBSAN warning when reading nx_huge_pages parameter

 arch/x86/kvm/mmu/mmu.c  |  5 +++++
 arch/x86/kvm/svm/avic.c | 13 ++++++++++++-
 2 files changed, 17 insertions(+), 1 deletion(-)
Signature · 1 line
2.52.0