linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [RESEND PATCH 0/4] kdump: make saved_max_pfn exlusive
@ 2013-02-04  6:42 HATAYAMA Daisuke
  2013-02-04  6:42 ` [RESEND PATCH 1/4] kdump, mips: make saved_max_pfn exclusive HATAYAMA Daisuke
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: HATAYAMA Daisuke @ 2013-02-04  6:42 UTC (permalink / raw)
  To: ralf, michael, benh, paulus, holzheu, schwidefsky,
	heiko.carstens, vgoyal
  Cc: kexec, linux-kernel

# I emailed to Vivek at old email address so resend. Please reply to
# this RESEND patch series. Sorry for this noise...
    
First, there are two kinds of notation to represent a map: inclusive
and exclusive. Here are the examples:
    
  1)  [mem 0x0000000100000000-0x000000013fffffff]
  2)  [mem 0x0000000100000000-0x0000000140000000]
    
1) is inclusive and 2) is exclusive. In case of 1), the pfn calculated
from the end address belongs to the map, while in case of 2), it
doesn't.

Currently, saved_max_pfn is used in read_oldmem() as inclusive for a
check to see if a given request is to within kernel's memory mapping
regions.
    
	while (count) {
		pfn = *ppos / PAGE_SIZE;
		if (pfn > saved_max_pfn)
		   	return read;
    
Unfortunately, on x86 and ia64, there are bugs below:
    
- On the 1st kernel, saved_max_pfn is not initialized so 0. Then, read
  to pfn 0 is not guarded by the condition and the execution goes into
  ioremap path.
    
- On the 2nd kernel, x86 and ia64 wrongly initializes saved_max_pfn by
  exclusive value, on x86 as:
    
	saved_max_pfn = e820_end_of_ram_pfn();
    
  by which via /dev/oldmem we can read max_pfn that is not kernel's
  memory.
    
To fix this, fixing x86 and ia64 part needs smaller change, but
max_pfn is originally treated as exclusive so saved_max_pfn should
normally be exclusive. Also, the memory map information passed from
kexec is all exclusive on every architectures; it's possible to make
saved_max_pfn exclusive now.

However, ppc and ppc64 on kexec doesn't increment end address now and
this should be done as an insurance when map passed from firmware is
inclusive, for which I'll post a patch later.

---

HATAYAMA Daisuke (4):
      kdump, oldmem: compare with saved_max_pfn exclusively
      kdump, s390: make saved_max_pfn exclusive
      kdump, ppc: make saved_max_pfn exclusive
      kdump, mips: make saved_max_pfn exclusive


 arch/mips/kernel/crash_dump.c    |    2 +-
 arch/powerpc/kernel/crash_dump.c |    2 +-
 arch/s390/kernel/setup.c         |    4 ++--
 drivers/char/mem.c               |    2 +-
 4 files changed, 5 insertions(+), 5 deletions(-)

-- 

Thanks.
HATAYAMA, Daisuke

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

* [RESEND PATCH 1/4] kdump, mips: make saved_max_pfn exclusive
  2013-02-04  6:42 [RESEND PATCH 0/4] kdump: make saved_max_pfn exlusive HATAYAMA Daisuke
@ 2013-02-04  6:42 ` HATAYAMA Daisuke
  2013-02-04  6:42 ` [RESEND PATCH 2/4] kdump, ppc: " HATAYAMA Daisuke
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: HATAYAMA Daisuke @ 2013-02-04  6:42 UTC (permalink / raw)
  To: ralf, michael, benh, paulus, holzheu, schwidefsky,
	heiko.carstens, vgoyal
  Cc: kexec, linux-kernel

Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
---

 arch/mips/kernel/crash_dump.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/mips/kernel/crash_dump.c b/arch/mips/kernel/crash_dump.c
index 35bed0d..6621211 100644
--- a/arch/mips/kernel/crash_dump.c
+++ b/arch/mips/kernel/crash_dump.c
@@ -6,7 +6,7 @@
 static int __init parse_savemaxmem(char *p)
 {
 	if (p)
-		saved_max_pfn = (memparse(p, &p) >> PAGE_SHIFT) - 1;
+		saved_max_pfn = (memparse(p, &p) >> PAGE_SHIFT);
 
 	return 1;
 }


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

* [RESEND PATCH 2/4] kdump, ppc: make saved_max_pfn exclusive
  2013-02-04  6:42 [RESEND PATCH 0/4] kdump: make saved_max_pfn exlusive HATAYAMA Daisuke
  2013-02-04  6:42 ` [RESEND PATCH 1/4] kdump, mips: make saved_max_pfn exclusive HATAYAMA Daisuke
@ 2013-02-04  6:42 ` HATAYAMA Daisuke
  2013-02-04  6:42 ` [RESEND PATCH 3/4] kdump, s390: " HATAYAMA Daisuke
  2013-02-04  6:42 ` [RESEND PATCH 4/4] kdump, oldmem: compare with saved_max_pfn exclusively HATAYAMA Daisuke
  3 siblings, 0 replies; 5+ messages in thread
From: HATAYAMA Daisuke @ 2013-02-04  6:42 UTC (permalink / raw)
  To: ralf, michael, benh, paulus, holzheu, schwidefsky,
	heiko.carstens, vgoyal
  Cc: kexec, linux-kernel

Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
---

 arch/powerpc/kernel/crash_dump.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/kernel/crash_dump.c b/arch/powerpc/kernel/crash_dump.c
index b3ba516..fa64170 100644
--- a/arch/powerpc/kernel/crash_dump.c
+++ b/arch/powerpc/kernel/crash_dump.c
@@ -72,7 +72,7 @@ void __init setup_kdump_trampoline(void)
 static int __init parse_savemaxmem(char *p)
 {
 	if (p)
-		saved_max_pfn = (memparse(p, &p) >> PAGE_SHIFT) - 1;
+		saved_max_pfn = (memparse(p, &p) >> PAGE_SHIFT);
 
 	return 1;
 }


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

* [RESEND PATCH 3/4] kdump, s390: make saved_max_pfn exclusive
  2013-02-04  6:42 [RESEND PATCH 0/4] kdump: make saved_max_pfn exlusive HATAYAMA Daisuke
  2013-02-04  6:42 ` [RESEND PATCH 1/4] kdump, mips: make saved_max_pfn exclusive HATAYAMA Daisuke
  2013-02-04  6:42 ` [RESEND PATCH 2/4] kdump, ppc: " HATAYAMA Daisuke
@ 2013-02-04  6:42 ` HATAYAMA Daisuke
  2013-02-04  6:42 ` [RESEND PATCH 4/4] kdump, oldmem: compare with saved_max_pfn exclusively HATAYAMA Daisuke
  3 siblings, 0 replies; 5+ messages in thread
From: HATAYAMA Daisuke @ 2013-02-04  6:42 UTC (permalink / raw)
  To: ralf, michael, benh, paulus, holzheu, schwidefsky,
	heiko.carstens, vgoyal
  Cc: kexec, linux-kernel

Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
---

 arch/s390/kernel/setup.c |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/s390/kernel/setup.c b/arch/s390/kernel/setup.c
index a5360de..3357566 100644
--- a/arch/s390/kernel/setup.c
+++ b/arch/s390/kernel/setup.c
@@ -729,9 +729,9 @@ static void reserve_oldmem(void)
 	reserve_kdump_bootmem(OLDMEM_SIZE, memory_end - OLDMEM_SIZE,
 			      CHUNK_OLDMEM);
 	if (OLDMEM_BASE + OLDMEM_SIZE == real_memory_size)
-		saved_max_pfn = PFN_DOWN(OLDMEM_BASE) - 1;
+		saved_max_pfn = PFN_DOWN(OLDMEM_BASE);
 	else
-		saved_max_pfn = PFN_DOWN(real_memory_size) - 1;
+		saved_max_pfn = PFN_DOWN(real_memory_size);
 #endif
 }
 


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

* [RESEND PATCH 4/4] kdump, oldmem: compare with saved_max_pfn exclusively
  2013-02-04  6:42 [RESEND PATCH 0/4] kdump: make saved_max_pfn exlusive HATAYAMA Daisuke
                   ` (2 preceding siblings ...)
  2013-02-04  6:42 ` [RESEND PATCH 3/4] kdump, s390: " HATAYAMA Daisuke
@ 2013-02-04  6:42 ` HATAYAMA Daisuke
  3 siblings, 0 replies; 5+ messages in thread
From: HATAYAMA Daisuke @ 2013-02-04  6:42 UTC (permalink / raw)
  To: ralf, michael, benh, paulus, holzheu, schwidefsky,
	heiko.carstens, vgoyal
  Cc: kexec, linux-kernel

Signed-off-by: HATAYAMA Daisuke <d.hatayama@jp.fujitsu.com>
---

 drivers/char/mem.c |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/drivers/char/mem.c b/drivers/char/mem.c
index c6fa3bc..5da737c 100644
--- a/drivers/char/mem.c
+++ b/drivers/char/mem.c
@@ -369,7 +369,7 @@ static ssize_t read_oldmem(struct file *file, char __user *buf,
 
 	while (count) {
 		pfn = *ppos / PAGE_SIZE;
-		if (pfn > saved_max_pfn)
+		if (!(pfn < saved_max_pfn))
 			return read;
 
 		offset = (unsigned long)(*ppos % PAGE_SIZE);


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

end of thread, other threads:[~2013-02-04  6:42 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2013-02-04  6:42 [RESEND PATCH 0/4] kdump: make saved_max_pfn exlusive HATAYAMA Daisuke
2013-02-04  6:42 ` [RESEND PATCH 1/4] kdump, mips: make saved_max_pfn exclusive HATAYAMA Daisuke
2013-02-04  6:42 ` [RESEND PATCH 2/4] kdump, ppc: " HATAYAMA Daisuke
2013-02-04  6:42 ` [RESEND PATCH 3/4] kdump, s390: " HATAYAMA Daisuke
2013-02-04  6:42 ` [RESEND PATCH 4/4] kdump, oldmem: compare with saved_max_pfn exclusively HATAYAMA Daisuke

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).