[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20240624133951.GDZnl3JxlKXaIvrrJ3@fat_crate.local>
Date: Mon, 24 Jun 2024 15:39:51 +0200
From: Borislav Petkov <bp@...en8.de>
To: Tom Lendacky <thomas.lendacky@....com>
Cc: "Nikunj A. Dadhania" <nikunj@....com>, linux-kernel@...r.kernel.org,
x86@...nel.org, kvm@...r.kernel.org, mingo@...hat.com,
tglx@...utronix.de, dave.hansen@...ux.intel.com, pgonda@...gle.com,
seanjc@...gle.com, pbonzini@...hat.com
Subject: Re: [PATCH v9 03/24] virt: sev-guest: Make payload a variable length
array
On Mon, Jun 24, 2024 at 08:00:38AM -0500, Tom Lendacky wrote:
> An alternative to the #defines would be something like:
>
> struct snp_guest_msg {
> struct snp_guest_msg_hdr hdr;
> u8 payload[PAGE_SIZE - sizeof(struct snp_guest_msg_hdr)];
> } __packed;
>
> Not sure it matters, but does reduce the changes while ensuring the
> payload plus header doesn't exceed a page.
Yeah, because that would've been my next question - the requirement to keep it
<= PAGE_SIZE.
So yeah, Nikunj, please do that also and add a
BUILD_BUG_ON(sizeof(struct snp_guest_msg) > PAGE_SIZE);
somewhere in the driver to catch all kinds of funky stuff.
Thx.
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
Powered by blists - more mailing lists