From: "Randy.Dunlap" <rdunlap@xenotime.net>
To: jzb@aexorsyst.com
Cc: linux-kernel@vger.kernel.org, akpm <akpm@osdl.org>
Subject: [PATCH] mpparse: prevent table index out-of-bounds
Date: Thu, 6 Apr 2006 13:18:05 -0700 [thread overview]
Message-ID: <20060406131805.d6eb0fe7.rdunlap@xenotime.net> (raw)
In-Reply-To: <200604060918.45185.jzb@aexorsyst.com>
On Thu, 6 Apr 2006 09:18:45 -0700 John Z. Bohach wrote:
Re: mem= causes oops (was Re: BIOS causes (exposes?) modprobe (load_module) kernel oops)
> I found the root cause, but don't know if its worth fixing. If the board has more than
> 32 PCI busses on it, the mptable bus array will overwrite its bounds for the PCI busses,
> and stomp on anything that's after it. In this case, what got stomped on is the PAGE_KERNEL_EXEC
> variable, which changed the bit-field settings for the page tables (cleared the 'present' bit,
> and screwed up the rest), hence accounting for the page fault.
Well, > 32 busses or just one busid value >= 32.
> This can only happen if there are more than 32 PCI busses, so I'd say its an _extremely_ rare
> condition on a desktop system. At any rate, the fix would simply be to change the value of the
> #define in the mptable.h header file (I forget which exactly, but its easy to find) from 32 to 256.
> The side effect of that is that the kernel data area would grow, and mostly be a total waste,
> since I can't fathom a desktop system with more than 32 PCI busses. On arch's where more than
> 32 PCI busses are likely, the #define is already 256.
I think that the kernel init code should detect and prevent the
data corruption. Here's a patch to do that, by ignoring busses
whose busid value is too large.
~~~
From: Randy Dunlap <rdunlap@xenotime.net>
Prevent possible table overflow and unknown data corruption.
Code is in an __init section so it will be discarded after init.
Signed-off-by: Randy Dunlap <rdunlap@xenotime.net>
---
arch/i386/kernel/mpparse.c | 7 +++++++
1 files changed, 7 insertions(+)
--- linux-2617-rc1.orig/arch/i386/kernel/mpparse.c
+++ linux-2617-rc1/arch/i386/kernel/mpparse.c
@@ -249,6 +249,13 @@ static void __init MP_bus_info (struct m
mpc_oem_bus_info(m, str, translation_table[mpc_record]);
+ if (m->mpc_busid >= MAX_MP_BUSSES) {
+ printk(KERN_WARNING "MP table busid value (%d) for bustype %s "
+ " is too large, max. supported is %d\n",
+ m->mpc_busid, str, MAX_MP_BUSSES - 1);
+ return;
+ }
+
if (strncmp(str, BUSTYPE_ISA, sizeof(BUSTYPE_ISA)-1) == 0) {
mp_bus_id_to_type[m->mpc_busid] = MP_BUS_ISA;
} else if (strncmp(str, BUSTYPE_EISA, sizeof(BUSTYPE_EISA)-1) == 0) {
---
next prev parent reply other threads:[~2006-04-06 20:15 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2006-03-22 4:05 BIOS causes (exposes?) modprobe (load_module) kernel oops John Z. Bohach
2006-03-22 9:06 ` Arjan van de Ven
2006-03-23 3:48 ` John Z. Bohach
2006-03-23 5:26 ` John Z. Bohach
2006-03-23 5:42 ` Randy.Dunlap
2006-03-24 17:36 ` mem= causes oops (was Re: BIOS causes (exposes?) modprobe (load_module) kernel oops) John Z. Bohach
2006-03-25 0:32 ` Randy.Dunlap
2006-03-25 18:36 ` John Z. Bohach
2006-03-25 18:50 ` mem= causes oops Jan Engelhardt
2006-03-26 17:41 ` Randy.Dunlap
2006-03-26 18:40 ` Jan Engelhardt
2006-04-05 19:07 ` mem= causes oops (was Re: BIOS causes (exposes?) modprobe (load_module) kernel oops) Randy.Dunlap
2006-04-06 16:18 ` John Z. Bohach
2006-04-06 20:18 ` Randy.Dunlap [this message]
2006-04-07 5:34 ` [PATCH] mpparse: prevent table index out-of-bounds John Z. Bohach
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=20060406131805.d6eb0fe7.rdunlap@xenotime.net \
--to=rdunlap@xenotime.net \
--cc=akpm@osdl.org \
--cc=jzb@aexorsyst.com \
--cc=linux-kernel@vger.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®