From: Borislav Petkov <bp@alien8.de>
To: Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de>
Cc: Jan Kiszka <jan.kiszka@siemens.com>,
x86@kernel.org, jailhouse-dev@googlegroups.com,
linux-kernel@vger.kernel.org, Ingo Molnar <mingo@redhat.com>,
"H . Peter Anvin" <hpa@zytor.com>
Subject: Re: [PATCH v5 1/2] x86/jailhouse: improve setup data version comparison
Date: Mon, 7 Oct 2019 18:25:51 +0200 [thread overview]
Message-ID: <20191007162551.GC24289@zn.tnic> (raw)
In-Reply-To: <20191007123819.161432-2-ralf.ramsauer@oth-regensburg.de>
On Mon, Oct 07, 2019 at 02:38:18PM +0200, Ralf Ramsauer wrote:
> We will soon introduce a new setup_data version and extend the
Who is "We"?
There a couple more "we" below. Can you please rewrite that commit message in
passive voice and thus dispense my confusion about who's "we"? :)
> structure. This requires some preparational work for the sanity check of
> the header and the check of the version.
>
> Use the following strategy:
>
> 1. Ensure that the header declares at least enough space for the version
> and the compatible_version as we must hold that fields for any
> version. Furthermore, the location and semantics of those fields will
> never change.
>
> 2. Copy over data -- as much as we can. The length is either limited by
> the header length, or the length of setup_data.
>
> 3. Things are now in place -- sanity check if the header length complies
> the actual version.
>
> For future versions of the setup_data, only step 3 requires alignment.
>
> Signed-off-by: Ralf Ramsauer <ralf.ramsauer@oth-regensburg.de>
> Reviewed-by: Jan Kiszka <jan.kiszka@siemens.com>
> ---
> arch/x86/include/uapi/asm/bootparam.h | 22 +++++++-----
> arch/x86/kernel/jailhouse.c | 50 +++++++++++++++++----------
> 2 files changed, 44 insertions(+), 28 deletions(-)
...
> @@ -180,13 +175,26 @@ static void __init jailhouse_init_platform(void)
> if (!pa_data)
> panic("Jailhouse: No valid setup data found");
>
> - if (setup_data.compatible_version > JAILHOUSE_SETUP_REQUIRED_VERSION)
> - panic("Jailhouse: Unsupported setup data structure");
> + /* setup data must at least contain the header */
> + if (header.len < sizeof(setup_data.hdr))
> + goto unsupported;
>
> - pmtmr_ioport = setup_data.pm_timer_address;
> + pa_data += offsetof(struct setup_data, data);
> + setup_data_len = min(sizeof(setup_data), (unsigned long)header.len);
Checkpatch makes sense here:
WARNING: min() should probably be min_t(unsigned long, sizeof(setup_data), header.len)
#165: FILE: arch/x86/kernel/jailhouse.c:183:
+ setup_data_len = min(sizeof(setup_data), (unsigned long)header.len);
--
Regards/Gruss,
Boris.
https://people.kernel.org/tglx/notes-about-netiquette
next prev parent reply other threads:[~2019-10-07 16:26 UTC|newest]
Thread overview: 11+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-10-07 12:38 [PATCH v5 0/2] x86/jailhouse: improve probing of platform UARTs Ralf Ramsauer
2019-10-07 12:38 ` [PATCH v5 1/2] x86/jailhouse: improve setup data version comparison Ralf Ramsauer
2019-10-07 16:25 ` Borislav Petkov [this message]
2019-10-07 18:25 ` [tip: x86/platform] x86/jailhouse: Improve " tip-bot2 for Ralf Ramsauer
2019-10-07 12:38 ` [PATCH v5 2/2] x86/jailhouse: Only enable platform UARTs if available Ralf Ramsauer
2019-10-07 15:20 ` Jan Kiszka
2019-10-07 16:26 ` Borislav Petkov
2019-10-07 16:44 ` Ralf Ramsauer
2019-10-07 16:59 ` Borislav Petkov
2019-10-07 18:25 ` [tip: x86/platform] x86/jailhouse: Enable platform UARTs only " tip-bot2 for Ralf Ramsauer
2019-10-07 18:27 ` Ingo Molnar
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=20191007162551.GC24289@zn.tnic \
--to=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=jailhouse-dev@googlegroups.com \
--cc=jan.kiszka@siemens.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@redhat.com \
--cc=ralf.ramsauer@oth-regensburg.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.