From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-pg1-f202.google.com (mail-pg1-f202.google.com [209.85.215.202]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 9EC9321A434 for ; Wed, 15 Apr 2026 22:17:01 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.215.202 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776291422; cv=none; b=DWffwIa7UXJ7B57HTizMC/33l6bKvjB39GoFT1mhGORgMF/vQyX32PGiX8olZVt4mYXKl42iZ8prQQn6j2S5ZsfI6/OyT6N6ok3GNw8dZ7ZouZxxgDqaDIQJCBKo/o4y5trAb7l+xNSHdxIwKeiGnmz+unTAwGexibNm5uu3gMs= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1776291422; c=relaxed/simple; bh=CcCwRytegUwsJjSZ6eoAOigRploRUfqEvFZTbZletZE=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Cc:Content-Type; b=YXrpWAye5C0Rt7EAmg3/nIc0XGWBt/7Rhj4dqiGIB1cm4/mTPmt84h3TNjtsSXFgwOwM+5wBytV54Dh0oxLJgTW2M6EQQjCO1Zkj676xXAhrYsepxB+hFbrinM5HmQDBt7cRzfv2459aPLWQIU6onVo2XQQ7bqhgNtVXhY0ARG8= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=OiVXyert; arc=none smtp.client-ip=209.85.215.202 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--seanjc.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="OiVXyert" Received: by mail-pg1-f202.google.com with SMTP id 41be03b00d2f7-c79281bd14cso3241535a12.3 for ; Wed, 15 Apr 2026 15:17:01 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20251104; t=1776291421; x=1776896221; darn=vger.kernel.org; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:from:to:cc:subject:date:message-id:reply-to; bh=EGo4VOJQPFyHusz55hlkxA3lp3eULjapJ3aQapxGGCk=; b=OiVXyertePQRRrSuG9Wcowee4jDkhH9Pc4WZqLBANVMRpaLiYsCkFGcTjJulSUOB1f 1l9HcxWcStgqELJQgxV672B+78NOs79AU0Yj+w8Zicxoa8oY6Ctf73TzB1xwZbcZ05dG UjMWHR4R1smqTqKz/rBVLHqtixHM6OSenOMjRHkbcuI6p9s/Ma8KuqhsGxOrj1+HjYvA 3vGZRH+GGJTiE7x5Xj+ab/7f35OHzXeWGhnT4PJvAIgmjCd3JtwNt1EkbjX/XzMmsG3r QyjVYfM70mbCPf9DfJfMPcrO3+LbLYdFOw3j+W1snTRAdWsJ8cQX1WpNQ7Rk0Q3/3pVV xDjg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1776291421; x=1776896221; h=cc:to:from:subject:message-id:references:mime-version:in-reply-to :date:x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=EGo4VOJQPFyHusz55hlkxA3lp3eULjapJ3aQapxGGCk=; b=nuhXOQz9rSt5cu5P4h+ClUQAxkVcr/4Y49ePYm8HaBtwgUIehnt0NgtER785dxm0Fd fRpURYXDiQjl4OTOyWhJFceV5B8hiZVZhCYA2RxliO02vNnuFPTOtXgN6BLCb7mSbudB nYx5rgSKy4Tgs3O1Hvtmd3eV1/Sh02V4spLkuZmLpzPYDXep3q2+sZz+UojA6YaSgdd7 P7tFjje8dDRUUkWfdvTB1xCy4wGc7c23JV082RSaTWy4yW9n5E/iZjCgZ5cn2njPtEP0 XQyzjgNbAtZrFVGdKxYqrjlUP6SQEC1vsYBZ+zaF0wZKo/CqpGbTCVCE7SRGG0nATAi1 EaMw== X-Gm-Message-State: AOJu0YxBatTUjx3En59O5sJ95biRqmjEogAQB74HcEFWExlQeFazhrYZ FQFECQWDqT3O6l8TJf3O2go8tR+c8VVHHNPX7mv8mt44eEhF1tsbdBKh+AG8tWOu7uG4olDt74T /papY4g== X-Received: from pfav10.prod.google.com ([2002:a05:6a00:ab0a:b0:82f:805:b62a]) (user=seanjc job=prod-delivery.src-stubby-dispatcher) by 2002:a05:6a00:2791:b0:82c:f035:6748 with SMTP id d2e1a72fcca58-82f0c253756mr24313312b3a.42.1776291420760; Wed, 15 Apr 2026 15:17:00 -0700 (PDT) Date: Wed, 15 Apr 2026 15:16:59 -0700 In-Reply-To: <20260413130125.2879436-2-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <2026041317-engaged-onset-3db3@gregkh> <20260413130125.2879436-1-sashal@kernel.org> <20260413130125.2879436-2-sashal@kernel.org> Message-ID: Subject: Re: [PATCH 6.18.y 2/2] KVM: x86: Use __DECLARE_FLEX_ARRAY() for UAPI structures with VLAs From: Sean Christopherson To: Sasha Levin Cc: stable@vger.kernel.org, David Woodhouse Content-Type: text/plain; charset="us-ascii" On Mon, Apr 13, 2026, Sasha Levin wrote: > From: David Woodhouse > > [ Upstream commit 2619da73bb2f10d88f7e1087125c40144fdf0987 ] > > Commit 94dfc73e7cf4 ("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: 94dfc73e7cf4 ("treewide: uapi: Replace zero-length arrays with flexible-array members") > Cc: stable@vger.kernel.org > Signed-off-by: David Woodhouse > Link: https://patch.msgid.link/3abaf6aefd6e5efeff3b860ac38421d9dec908db.camel@infradead.org > [sean: tag for stable@] > Signed-off-by: Sean Christopherson > Signed-off-by: Sasha Levin > --- Acked-by: Sean Christopherson