From: Pengpeng Hou <pengpeng@iscas.ac.cn>
To: Thomas Gleixner <tglx@kernel.org>, Ingo Molnar <mingo@redhat.com>,
Borislav Petkov <bp@alien8.de>,
Dave Hansen <dave.hansen@linux.intel.com>,
x86@kernel.org
Cc: "H. Peter Anvin" <hpa@zytor.com>,
Andy Lutomirski <luto@kernel.org>,
Peter Zijlstra <peterz@infradead.org>,
linux-kernel@vger.kernel.org, pengpeng@iscas.ac.cn
Subject: Re: [PATCH 1/2] x86/setup_data: validate indirect entry sizes before dereferencing them
Date: Sun, 5 Apr 2026 09:40:00 +0800 [thread overview]
Message-ID: <20260405094002.2-reply-x86-setup-data-pengpeng@iscas.ac.cn> (raw)
In-Reply-To: <20260404190001.1-x86-setup-data-pengpeng@iscas.ac.cn>
Hi Boris,
Because the failure mode here is not just “the bootloader passed nonsense” in
a semantic sense; the current code can dereference past the mapped payload of
a malformed `SETUP_INDIRECT` entry.
The affected paths first read the outer `struct setup_data` header, and then
some of them treat `data->len` as though it always covers a full
`struct setup_indirect`. If `data->len` is short, or wraps when
`sizeof(struct setup_data) + data->len` is computed, the kernel can remap or
reserve less than a full indirect header and still read `indirect->type`,
`addr`, or `len` beyond that range.
So the thing I was trying to harden is not “make every bad setup_data entry
boot successfully”; it is “do not turn malformed boot metadata into a kernel
OOB read while walking setup_data”.
I think that is worth handling because `setup_data` is still external boot
input to the kernel. It can come not only from a normal bootloader path, but
also from kexec-style handoff and virtualized boot flows.
The intended fallback here is narrow and local: if an indirect entry is
malformed, keep treating the outer `setup_data` payload as opaque instead of
walking the embedded header. That way we avoid the out-of-bounds read without
trying to make malformed metadata otherwise “work”.
Thanks,
Pengpeng
next prev parent reply other threads:[~2026-04-05 2:15 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-04-04 13:48 Pengpeng Hou
2026-04-04 9:32 ` [PATCH 2/2] x86/boot/compressed/kaslr: validate indirect setup_data payloads Pengpeng Hou
2026-04-04 21:53 ` [PATCH 1/2] x86/setup_data: validate indirect entry sizes before dereferencing them Borislav Petkov
2026-04-05 1:40 ` Pengpeng Hou [this message]
2026-04-05 11:06 ` Borislav Petkov
2026-04-06 20:54 ` H. Peter Anvin
2026-04-05 3:20 ` Pengpeng Hou
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=20260405094002.2-reply-x86-setup-data-pengpeng@iscas.ac.cn \
--to=pengpeng@iscas.ac.cn \
--cc=bp@alien8.de \
--cc=dave.hansen@linux.intel.com \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@redhat.com \
--cc=peterz@infradead.org \
--cc=tglx@kernel.org \
--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
all inboxes | Powered by JetHome®