linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH 1/2] x86: fix panic when handling "mem={invalid}" param
@ 2011-02-04  1:38 Kamal Mostafa
  2011-02-04  1:38 ` [PATCH 2/2] x86: "mem=nopentium ignored" warning when not supported Kamal Mostafa
                   ` (2 more replies)
  0 siblings, 3 replies; 8+ messages in thread
From: Kamal Mostafa @ 2011-02-04  1:38 UTC (permalink / raw)
  To: x86
  Cc: Kamal Mostafa, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Yinghai Lu, Len Brown, Rafael J. Wysocki, linux-kernel

Avoid removing all of memory and panicing when "mem={invalid}" is
specified, e.g. mem=blahblah, mem=0, or mem=nopentium (on platforms
other than x86_32).

BugLink: http://bugs.launchpad.net/bugs/553464
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Cc: <stable@kernel.org>
---
 arch/x86/kernel/e820.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 294f26d..55a59d8 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -856,6 +856,9 @@ static int __init parse_memopt(char *p)
 
 	userdef = 1;
 	mem_size = memparse(p, &p);
+	/* don't remove all of memory when handling "mem={invalid}" param */
+	if (mem_size == 0)
+		return -EINVAL;
 	e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1);
 
 	return 0;
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [PATCH 2/2] x86: "mem=nopentium ignored" warning when not supported
  2011-02-04  1:38 [PATCH 1/2] x86: fix panic when handling "mem={invalid}" param Kamal Mostafa
@ 2011-02-04  1:38 ` Kamal Mostafa
  2011-02-14 13:54   ` [tip:x86/mm] x86: Emit " tip-bot for Kamal Mostafa
  2011-02-04 19:44 ` [PATCH 1/2] x86: fix panic when handling "mem={invalid}" param Yinghai Lu
  2011-02-14 13:54 ` [tip:x86/mm] x86: Fix " tip-bot for Kamal Mostafa
  2 siblings, 1 reply; 8+ messages in thread
From: Kamal Mostafa @ 2011-02-04  1:38 UTC (permalink / raw)
  To: x86
  Cc: Kamal Mostafa, Thomas Gleixner, Ingo Molnar, H. Peter Anvin,
	Yinghai Lu, Len Brown, Rafael J. Wysocki, linux-kernel

Emit warning when "mem=nopentium" is specified on any arch other
than x86_32 (the only that arch supports it).

BugLink: http://bugs.launchpad.net/bugs/553464
Signed-off-by: Kamal Mostafa <kamal@canonical.com>
Cc: <stable@kernel.org>
---
 arch/x86/kernel/e820.c |    8 ++++++--
 1 files changed, 6 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 55a59d8..0429ad0 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -847,12 +847,16 @@ static int __init parse_memopt(char *p)
 	if (!p)
 		return -EINVAL;
 
-#ifdef CONFIG_X86_32
 	if (!strcmp(p, "nopentium")) {
+#ifdef CONFIG_X86_32
 		setup_clear_cpu_cap(X86_FEATURE_PSE);
 		return 0;
-	}
+#else
+		printk(KERN_WARNING
+			"mem=nopentium ignored! (only supported on x86_32)\n");
+		return -EINVAL;
 #endif
+	}
 
 	userdef = 1;
 	mem_size = memparse(p, &p);
-- 
1.7.1


^ permalink raw reply related	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] x86: fix panic when handling "mem={invalid}" param
  2011-02-04  1:38 [PATCH 1/2] x86: fix panic when handling "mem={invalid}" param Kamal Mostafa
  2011-02-04  1:38 ` [PATCH 2/2] x86: "mem=nopentium ignored" warning when not supported Kamal Mostafa
@ 2011-02-04 19:44 ` Yinghai Lu
  2011-02-04 20:09   ` H. Peter Anvin
  2011-02-14 13:54 ` [tip:x86/mm] x86: Fix " tip-bot for Kamal Mostafa
  2 siblings, 1 reply; 8+ messages in thread
From: Yinghai Lu @ 2011-02-04 19:44 UTC (permalink / raw)
  To: Kamal Mostafa
  Cc: x86, Thomas Gleixner, Ingo Molnar, H. Peter Anvin, Len Brown,
	Rafael J. Wysocki, linux-kernel

On Thu, Feb 3, 2011 at 5:38 PM, Kamal Mostafa <kamal@canonical.com> wrote:
> Avoid removing all of memory and panicing when "mem={invalid}" is
> specified, e.g. mem=blahblah, mem=0, or mem=nopentium (on platforms
> other than x86_32).
>
> BugLink: http://bugs.launchpad.net/bugs/553464
> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
> Cc: <stable@kernel.org>
> ---
>  arch/x86/kernel/e820.c |    3 +++
>  1 files changed, 3 insertions(+), 0 deletions(-)
>
> diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
> index 294f26d..55a59d8 100644
> --- a/arch/x86/kernel/e820.c
> +++ b/arch/x86/kernel/e820.c
> @@ -856,6 +856,9 @@ static int __init parse_memopt(char *p)
>
>        userdef = 1;
>        mem_size = memparse(p, &p);
> +       /* don't remove all of memory when handling "mem={invalid}" param */
> +       if (mem_size == 0)
> +               return -EINVAL;
>        e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1);
>
>        return 0;
> --

then how about some one pass mem=32M etc?

or total wrongly usermap?

Yinghai

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] x86: fix panic when handling "mem={invalid}" param
  2011-02-04 19:44 ` [PATCH 1/2] x86: fix panic when handling "mem={invalid}" param Yinghai Lu
@ 2011-02-04 20:09   ` H. Peter Anvin
  2011-02-04 20:19     ` Yinghai Lu
  0 siblings, 1 reply; 8+ messages in thread
From: H. Peter Anvin @ 2011-02-04 20:09 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Kamal Mostafa, x86, Thomas Gleixner, Ingo Molnar, Len Brown,
	Rafael J. Wysocki, linux-kernel

On 02/04/2011 11:44 AM, Yinghai Lu wrote:
> On Thu, Feb 3, 2011 at 5:38 PM, Kamal Mostafa <kamal@canonical.com> wrote:
>> Avoid removing all of memory and panicing when "mem={invalid}" is
>> specified, e.g. mem=blahblah, mem=0, or mem=nopentium (on platforms
>> other than x86_32).
>>
>> BugLink: http://bugs.launchpad.net/bugs/553464
>> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
>> Cc: <stable@kernel.org>
>> ---
>>  arch/x86/kernel/e820.c |    3 +++
>>  1 files changed, 3 insertions(+), 0 deletions(-)
>>
>> diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
>> index 294f26d..55a59d8 100644
>> --- a/arch/x86/kernel/e820.c
>> +++ b/arch/x86/kernel/e820.c
>> @@ -856,6 +856,9 @@ static int __init parse_memopt(char *p)
>>
>>        userdef = 1;
>>        mem_size = memparse(p, &p);
>> +       /* don't remove all of memory when handling "mem={invalid}" param */
>> +       if (mem_size == 0)
>> +               return -EINVAL;
>>        e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1);
>>
>>        return 0;
>> --
> 
> then how about some one pass mem=32M etc?
> 
> or total wrongly usermap?
> 

All he looks at is when the value returned is zero.  It wouldn't be zero
for any actual value, including mem=32M.

	-hpa

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] x86: fix panic when handling "mem={invalid}" param
  2011-02-04 20:09   ` H. Peter Anvin
@ 2011-02-04 20:19     ` Yinghai Lu
  2011-02-04 20:20       ` H. Peter Anvin
  0 siblings, 1 reply; 8+ messages in thread
From: Yinghai Lu @ 2011-02-04 20:19 UTC (permalink / raw)
  To: H. Peter Anvin
  Cc: Kamal Mostafa, x86, Thomas Gleixner, Ingo Molnar, Len Brown,
	Rafael J. Wysocki, linux-kernel

On Fri, Feb 4, 2011 at 12:09 PM, H. Peter Anvin <hpa@zytor.com> wrote:
> On 02/04/2011 11:44 AM, Yinghai Lu wrote:
>> On Thu, Feb 3, 2011 at 5:38 PM, Kamal Mostafa <kamal@canonical.com> wrote:
>>> Avoid removing all of memory and panicing when "mem={invalid}" is
>>> specified, e.g. mem=blahblah, mem=0, or mem=nopentium (on platforms
>>> other than x86_32).
>>>
>>> BugLink: http://bugs.launchpad.net/bugs/553464
>>> Signed-off-by: Kamal Mostafa <kamal@canonical.com>
>>> Cc: <stable@kernel.org>
>>> ---
>>>  arch/x86/kernel/e820.c |    3 +++
>>>  1 files changed, 3 insertions(+), 0 deletions(-)
>>>
>>> diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
>>> index 294f26d..55a59d8 100644
>>> --- a/arch/x86/kernel/e820.c
>>> +++ b/arch/x86/kernel/e820.c
>>> @@ -856,6 +856,9 @@ static int __init parse_memopt(char *p)
>>>
>>>        userdef = 1;
>>>        mem_size = memparse(p, &p);
>>> +       /* don't remove all of memory when handling "mem={invalid}" param */
>>> +       if (mem_size == 0)
>>> +               return -EINVAL;
>>>        e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1);
>>>
>>>        return 0;
>>> --
>>
>> then how about some one pass mem=32M etc?
>>
>> or total wrongly usermap?
>>
>
> All he looks at is when the value returned is zero.  It wouldn't be zero
> for any actual value, including mem=32M.
>

when user pass wrong parameter like less 128M, kernel will not boot either.
Do we need to sanity check for that?

Yinghai

^ permalink raw reply	[flat|nested] 8+ messages in thread

* Re: [PATCH 1/2] x86: fix panic when handling "mem={invalid}" param
  2011-02-04 20:19     ` Yinghai Lu
@ 2011-02-04 20:20       ` H. Peter Anvin
  0 siblings, 0 replies; 8+ messages in thread
From: H. Peter Anvin @ 2011-02-04 20:20 UTC (permalink / raw)
  To: Yinghai Lu
  Cc: Kamal Mostafa, x86, Thomas Gleixner, Ingo Molnar, Len Brown,
	Rafael J. Wysocki, linux-kernel

On 02/04/2011 12:19 PM, Yinghai Lu wrote:
>>
>> All he looks at is when the value returned is zero.  It wouldn't be zero
>> for any actual value, including mem=32M.
>>
> 
> when user pass wrong parameter like less 128M, kernel will not boot either.
> Do we need to sanity check for that?
> 

We could check for the value being smaller than the relocated value of
_end.  That is probably the smallest *fixed* value we can assign.

	-hpa


^ permalink raw reply	[flat|nested] 8+ messages in thread

* [tip:x86/mm] x86: Fix panic when handling "mem={invalid}" param
  2011-02-04  1:38 [PATCH 1/2] x86: fix panic when handling "mem={invalid}" param Kamal Mostafa
  2011-02-04  1:38 ` [PATCH 2/2] x86: "mem=nopentium ignored" warning when not supported Kamal Mostafa
  2011-02-04 19:44 ` [PATCH 1/2] x86: fix panic when handling "mem={invalid}" param Yinghai Lu
@ 2011-02-14 13:54 ` tip-bot for Kamal Mostafa
  2 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Kamal Mostafa @ 2011-02-14 13:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, yinghai, kamal, tglx, rjw, mingo, len.brown

Commit-ID:  77eed821accf5dd962b1f13bed0680e217e49112
Gitweb:     http://git.kernel.org/tip/77eed821accf5dd962b1f13bed0680e217e49112
Author:     Kamal Mostafa <kamal@canonical.com>
AuthorDate: Thu, 3 Feb 2011 17:38:04 -0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 14 Feb 2011 13:15:43 +0100

x86: Fix panic when handling "mem={invalid}" param

Avoid removing all of memory and panicing when "mem={invalid}"
is specified, e.g. mem=blahblah, mem=0, or mem=nopentium (on
platforms other than x86_32).

Signed-off-by: Kamal Mostafa <kamal@canonical.com>
BugLink: http://bugs.launchpad.net/bugs/553464
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Len Brown <len.brown@intel.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
Cc: <stable@kernel.org> # .3x: as far back as it applies
LKML-Reference: <1296783486-23033-1-git-send-email-kamal@canonical.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
---
 arch/x86/kernel/e820.c |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 294f26d..55a59d8 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -856,6 +856,9 @@ static int __init parse_memopt(char *p)
 
 	userdef = 1;
 	mem_size = memparse(p, &p);
+	/* don't remove all of memory when handling "mem={invalid}" param */
+	if (mem_size == 0)
+		return -EINVAL;
 	e820_remove_range(mem_size, ULLONG_MAX - mem_size, E820_RAM, 1);
 
 	return 0;

^ permalink raw reply related	[flat|nested] 8+ messages in thread

* [tip:x86/mm] x86: Emit "mem=nopentium ignored" warning when not supported
  2011-02-04  1:38 ` [PATCH 2/2] x86: "mem=nopentium ignored" warning when not supported Kamal Mostafa
@ 2011-02-14 13:54   ` tip-bot for Kamal Mostafa
  0 siblings, 0 replies; 8+ messages in thread
From: tip-bot for Kamal Mostafa @ 2011-02-14 13:54 UTC (permalink / raw)
  To: linux-tip-commits
  Cc: linux-kernel, hpa, mingo, yinghai, kamal, stable, tglx, rjw,
	mingo, len.brown

Commit-ID:  9a6d44b9adb777ca9549e88cd55bd8f2673c52a2
Gitweb:     http://git.kernel.org/tip/9a6d44b9adb777ca9549e88cd55bd8f2673c52a2
Author:     Kamal Mostafa <kamal@canonical.com>
AuthorDate: Thu, 3 Feb 2011 17:38:05 -0800
Committer:  Ingo Molnar <mingo@elte.hu>
CommitDate: Mon, 14 Feb 2011 13:15:43 +0100

x86: Emit "mem=nopentium ignored" warning when not supported

Emit warning when "mem=nopentium" is specified on any arch other
than x86_32 (the only that arch supports it).

Signed-off-by: Kamal Mostafa <kamal@canonical.com>
BugLink: http://bugs.launchpad.net/bugs/553464
Cc: Yinghai Lu <yinghai@kernel.org>
Cc: Len Brown <len.brown@intel.com>
Cc: Rafael J. Wysocki <rjw@sisk.pl>
LKML-Reference: <1296783486-23033-2-git-send-email-kamal@canonical.com>
Signed-off-by: Ingo Molnar <mingo@elte.hu>
Cc: <stable@kernel.org>
---
 arch/x86/kernel/e820.c |    7 +++++--
 1 files changed, 5 insertions(+), 2 deletions(-)

diff --git a/arch/x86/kernel/e820.c b/arch/x86/kernel/e820.c
index 55a59d8..0b5e2b5 100644
--- a/arch/x86/kernel/e820.c
+++ b/arch/x86/kernel/e820.c
@@ -847,12 +847,15 @@ static int __init parse_memopt(char *p)
 	if (!p)
 		return -EINVAL;
 
-#ifdef CONFIG_X86_32
 	if (!strcmp(p, "nopentium")) {
+#ifdef CONFIG_X86_32
 		setup_clear_cpu_cap(X86_FEATURE_PSE);
 		return 0;
-	}
+#else
+		printk(KERN_WARNING "mem=nopentium ignored! (only supported on x86_32)\n");
+		return -EINVAL;
 #endif
+	}
 
 	userdef = 1;
 	mem_size = memparse(p, &p);

^ permalink raw reply related	[flat|nested] 8+ messages in thread

end of thread, other threads:[~2011-02-14 18:07 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-02-04  1:38 [PATCH 1/2] x86: fix panic when handling "mem={invalid}" param Kamal Mostafa
2011-02-04  1:38 ` [PATCH 2/2] x86: "mem=nopentium ignored" warning when not supported Kamal Mostafa
2011-02-14 13:54   ` [tip:x86/mm] x86: Emit " tip-bot for Kamal Mostafa
2011-02-04 19:44 ` [PATCH 1/2] x86: fix panic when handling "mem={invalid}" param Yinghai Lu
2011-02-04 20:09   ` H. Peter Anvin
2011-02-04 20:19     ` Yinghai Lu
2011-02-04 20:20       ` H. Peter Anvin
2011-02-14 13:54 ` [tip:x86/mm] x86: Fix " tip-bot for Kamal Mostafa

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).