Re: [PATCH] x86: kill arch/x86/kernel/mpparse.c debugging printk.

Rene Herman
2008-08-11T17:20:20Z

[-- Attachment #1: Type: text/plain, Size: 451 bytes --]

On 11-08-08 18:45, Cyrill Gorcunov wrote:

> | From: Rene Herman <rene.herman@gmail.com>
> | Date: Mon, 11 Aug 2008 17:35:41 +0200
> | Subject: [PATCH] x86: make "apic" an early_param() on 32-bit

[ ... ]

> you turned it into early_param so now it's NULL injecting vulnerabled.
> Could you please add checking for NULL str param?

Ah, I was unaware of that difference, thank you. Ingo, can you replace
the previous incarnation with this one?

Rene.

[-- Attachment #2: 0001-x86-make-apic-an-early_param-on-32-bit.patch --]
[-- Type: text/plain, Size: 1398 bytes --]

>From 98cf69c9acbc2c1a29fdaa6fc8c29f1bacae8316 Mon Sep 17 00:00:00 2001
From: Rene Herman <rene.herman@gmail.com>
Date: Mon, 11 Aug 2008 17:35:41 +0200
Subject: [PATCH] x86: make "apic" an early_param() on 32-bit

On 32-bit, "apic" is a __setup() param meaning it is parsed rather
late in the game. Make it an early_param() for apic_printk() use
by arch/x86/kernel/mpparse.c.

On 64-bit, it already is an early_param().

Signed-off-by: Rene Herman <rene.herman@gmail.com>
---
arch/x86/kernel/apic_32.c | 14 +++++++++-----
1 files changed, 9 insertions(+), 5 deletions(-)

diff --git a/arch/x86/kernel/apic_32.c b/arch/x86/kernel/apic_32.c
index d6c8983..039a8d4 100644
--- a/arch/x86/kernel/apic_32.c
+++ b/arch/x86/kernel/apic_32.c
@@ -1720,15 +1720,19 @@ static int __init parse_lapic_timer_c2_ok(char *arg)
}
early_param("lapic_timer_c2_ok", parse_lapic_timer_c2_ok);

-static int __init apic_set_verbosity(char *str)
+static int __init apic_set_verbosity(char *arg)
{
- if (strcmp("debug", str) == 0)
+ if (!arg)
+ return -EINVAL;
+
+ if (strcmp(arg, "debug") == 0)
apic_verbosity = APIC_DEBUG;
- else if (strcmp("verbose", str) == 0)
+ else if (strcmp(arg, "verbose") == 0)
apic_verbosity = APIC_VERBOSE;
- return 1;
+
+ return 0;
}
-__setup("apic=", apic_set_verbosity);
+early_param("apic", apic_set_verbosity);

static int __init lapic_insert_resource(void)
{
--
1.5.5