From: Kees Cook <keescook@chromium.org>
To: Sean Christopherson <seanjc@google.com>
Cc: Paolo Bonzini <pbonzini@redhat.com>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@redhat.com>, Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
"Gustavo A. R. Silva" <gustavoars@kernel.org>,
x86@kernel.org, "H. Peter Anvin" <hpa@zytor.com>,
kvm@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-hardening@vger.kernel.org
Subject: Re: [PATCH] KVM: x86: Replace 0-length arrays with flexible arrays
Date: Thu, 12 Jan 2023 14:44:47 -0800 [thread overview]
Message-ID: <202301121444.104E492D@keescook> (raw)
In-Reply-To: <Y7xPSEMOWqz+3kgD@google.com>
On Mon, Jan 09, 2023 at 05:30:48PM +0000, Sean Christopherson wrote:
> On Thu, Jan 05, 2023, Kees Cook wrote:
> > Zero-length arrays are deprecated[1]. Replace struct kvm_nested_state's
> > "data" union 0-length arrays with flexible arrays. (How are the
> > sizes of these arrays verified?)
>
> It's not really interpreted as an array, it's a mandatory single-entry "array".
[...]
> >
> > /*
> > - * Define data region as 0 bytes to preserve backwards-compatability
> > + * Define union of flexible arrays to preserve backwards-compatability
>
> I think I'd actually prefer the "as 0 bytes" comment. The important part is that
> the size of "data" be zero, how that happens is immaterial.
Oh, dur, I can read the comment. :)
It has to stay the old size -- this was a way to add an optional extra
struct to the end. Got it!
--
Kees Cook
prev parent reply other threads:[~2023-01-12 22:44 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-01-05 19:05 [PATCH] KVM: x86: Replace 0-length arrays with flexible arrays Kees Cook
2023-01-09 17:30 ` Sean Christopherson
2023-01-12 22:42 ` Kees Cook
2023-01-12 22:44 ` Kees Cook [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=202301121444.104E492D@keescook \
--to=keescook@chromium.org \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=gustavoars@kernel.org \
--cc=hpa@zytor.com \
--cc=kvm@vger.kernel.org \
--cc=linux-hardening@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=pbonzini@redhat.com \
--cc=seanjc@google.com \
--cc=tglx@linutronix.de \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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).