linux/arch/x86/include/uapi/asm
David Woodhouse 2619da73bb KVM: x86: Use __DECLARE_FLEX_ARRAY() for UAPI structures with VLAs
Commit 94dfc73e7c ("treewide: uapi: Replace zero-length arrays with
flexible-array members") broke the userspace API for C++.

These structures ending in VLAs are typically a *header*, which can be
followed by an arbitrary number of entries. Userspace typically creates
a larger structure with some non-zero number of entries, for example in
QEMU's kvm_arch_get_supported_msr_feature():

    struct {
        struct kvm_msrs info;
        struct kvm_msr_entry entries[1];
    } msr_data = {};

While that works in C, it fails in C++ with an error like:
 flexible array member 'kvm_msrs::entries' not at end of 'struct msr_data'

Fix this by using __DECLARE_FLEX_ARRAY() for the VLA, which uses [0]
for C++ compilation.

Fixes: 94dfc73e7c ("treewide: uapi: Replace zero-length arrays with flexible-array members")
Cc: stable@vger.kernel.org
Signed-off-by: David Woodhouse <dwmw@amazon.co.uk>
Link: https://patch.msgid.link/3abaf6aefd6e5efeff3b860ac38421d9dec908db.camel@infradead.org
[sean: tag for stable@]
Signed-off-by: Sean Christopherson <seanjc@google.com>
2026-03-12 10:56:10 -07:00
..
a.out.h
amd_hsmp.h platform/x86/amd/hsmp: Add support for HSMP protocol version 7 messages 2024-12-02 19:20:14 +02:00
auxvec.h x86/uapi: Stop leaking kconfig references to userspace 2026-01-30 16:46:17 +01:00
bitsperlong.h
boot.h
bootparam.h x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI headers 2025-03-19 11:30:53 +01:00
byteorder.h
debugreg.h x86/traps: Initialize DR6 by writing its architectural reset value 2025-06-24 13:15:51 -07:00
e820.h x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI headers 2025-03-19 11:30:53 +01:00
elf.h x86/elf: Add a new FPU buffer layout info to x86 core files 2024-07-29 10:45:43 +02:00
hw_breakpoint.h
hwcap2.h x86/elf: Use _BITUL() macro in UAPI headers 2021-05-21 11:12:52 +02:00
ist.h
Kbuild
kvm_para.h Guest-side KVM async #PF ABI cleanup for 6.9 2024-03-18 19:03:42 -04:00
kvm_perf.h
kvm.h KVM: x86: Use __DECLARE_FLEX_ARRAY() for UAPI structures with VLAs 2026-03-12 10:56:10 -07:00
ldt.h x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI headers 2025-03-19 11:30:53 +01:00
mce.h x86/MCE/AMD: Add support for new MCA_SYND{1,2} registers 2024-10-31 10:36:07 +01:00
mman.h mman: Add map_shadow_stack() flags 2024-10-04 12:04:33 +01:00
msgbuf.h x86: Fix various typos in comments 2021-03-18 15:31:53 +01:00
msr.h x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI headers 2025-03-19 11:30:53 +01:00
mtrr.h x86/mtrr: Don't let mtrr_type_lookup() return MTRR_TYPE_INVALID 2023-06-01 15:04:33 +02:00
perf_regs.h
posix_types_32.h
posix_types_64.h
posix_types_x32.h
posix_types.h
prctl.h x86/shstk: Add ARCH_SHSTK_STATUS 2023-08-02 15:01:51 -07:00
processor-flags.h x86/cpufeatures: Enumerate the LASS feature bits 2025-11-18 10:38:26 -08:00
ptrace-abi.h x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI headers 2025-03-19 11:30:53 +01:00
ptrace.h x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI headers 2025-03-19 11:30:53 +01:00
sembuf.h arch: sembuf.h: make uapi asm/sembuf.h self-contained 2019-12-04 19:44:14 -08:00
setup_data.h x86/kexec: add support for passing kexec handover (KHO) data 2025-05-12 23:50:41 -07:00
setup.h
sgx.h x86/sgx: Document structs and enums with '@', not '%' 2025-11-14 15:30:26 -08:00
shmbuf.h shmbuf.h: add asm/shmbuf.h to UAPI compile-test coverage 2022-02-17 09:09:37 +01:00
sigcontext.h x86: Fix various typos in comments 2021-03-18 15:31:53 +01:00
sigcontext32.h
siginfo.h
signal.h x86/headers: Replace __ASSEMBLY__ with __ASSEMBLER__ in UAPI headers 2025-03-19 11:30:53 +01:00
stat.h
statfs.h
svm.h KVM: SVM: Treat exit_code as an unsigned 64-bit value through all of KVM 2026-01-13 17:37:03 -08:00
swab.h
ucontext.h
unistd.h x86/syscalls: Revert "x86/syscalls: Make __X32_SYSCALL_BIT be unsigned long" 2020-05-26 16:42:43 +02:00
vm86.h x86/vm86/32: Remove VM86_SCREEN_BITMAP support 2021-01-21 20:08:53 +01:00
vmx.h KVM: VMX: Inject #UD if guest tries to execute SEAMCALL or TDCALL 2025-10-20 09:37:04 -07:00
vsyscall.h