lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <aRs6EbV2gnkertzA@google.com>
Date: Mon, 17 Nov 2025 07:06:57 -0800
From: Sean Christopherson <seanjc@...gle.com>
To: Ankit Khushwaha <ankitkhushwaha.linux@...il.com>
Cc: Paolo Bonzini <pbonzini@...hat.com>, Shuah Khan <shuah@...nel.org>, kvm@...r.kernel.org, 
	linux-kselftest@...r.kernel.org, linux-kernel@...r.kernel.org, 
	linux-kernel-mentees@...r.kernel.org
Subject: Re: [PATCH] KVM: selftests: Include missing uapi header for *_VECTOR definitions

On Sat, Nov 15, 2025, Ankit Khushwaha wrote:
> The exception vector constants CP_VECTOR, HV_VECTOR, VC_VECTOR, and
> SX_VECTOR are used in ex_str(), but the header that defines
> them is not included. Other exception vectors are picked up through
> indirect includes, but these four are not, which leads to unresolved

That means your build is picking up stale kernel headers (likely the ones installed
system-wide).  The "#include <asm/kvm.h>" in kvm_util.h is what pulls in the kernel
uAPI headers.

Selftests uapi headers are a bit of a mess.  In the past, selftests would
automatically do "make headers_install" as part of the build, but commit
3bb267a36185 ("selftests: drop khdr make target") yanked that out because there
are scenarios where it broke the build.

So the "right" way to build selftest is to first do "make headers_install", and
then build selftests.

Note, if you build KVM selftests directly, tools/testing/selftests/lib.mk will
define the includes to be relative to the source directory, i.e. expects the
headers to be installed in the source.

  ifeq ($(KHDR_INCLUDES),)
  KHDR_INCLUDES := -isystem $(top_srcdir)/usr/include
  endif

You can explicitly set KHDR_INCLUDES when building if you install headers somewhere
else.  E.g. my build invocation looks something like this, where "$output" is an
out-of-tree directory.

  KHDR_INCLUDES="-isystem $output/usr/include" EXTRA_CFLAGS="-static -Werror -gdwarf-4" make \
  INSTALL_HDR_PATH="$output/usr" OUTPUT=$output

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ