lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:	Wed, 20 Nov 2013 05:29:16 +0000
From:	Atsushi Kumagai <kumagai-atsushi@....nes.nec.co.jp>
To:	Vivek Goyal <vgoyal@...hat.com>
CC:	"bhe@...hat.com" <bhe@...hat.com>,
	"kexec@...ts.infradead.org" <kexec@...ts.infradead.org>,
	"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
	"d.hatayama@...fujitsu.com" <d.hatayama@...fujitsu.com>,
	"ebiederm@...ssion.com" <ebiederm@...ssion.com>,
	"dyoung@...hat.com" <dyoung@...hat.com>,
	"chaowang@...hat.com" <chaowang@...hat.com>
Subject: Re: /proc/vmcore mmap() failure issue

On 2013/11/18 22:56:10, kexec <kexec-bounces@...ts.infradead.org> wrote:
> On Mon, Nov 18, 2013 at 12:51:39AM +0000, Atsushi Kumagai wrote:
> 
> [..]
> > > Is there any chance that you could look into fixing this. I have no 
> > > experience writing code for makedumpfile.
> > 
> > I'll send a patch to fix this soon.
> 
> Thanks Atsushi.
> 
> Vivek

Vivek, could you test this patch ?

Thanks
Atsushi Kumagai


From: Atsushi Kumagai <kumagai-atsushi@....nes.nec.co.jp>
Date: Wed, 20 Nov 2013 10:05:03 +0900
Subject: [PATCH] Disable mmap() for reading fractional pages.

Since mmap() was introduced on /proc/vmcore, it fails
for fractional pages which don't start or end at page boundary
due to kernel issue.
This patch disables mmap() temporarily for fractional pages
to avoid this issue, so mmap() will be used only for aligned pages.

Signed-off-by: Atsushi Kumagai <kumagai-atsushi@....nes.nec.co.jp>
---
 makedumpfile.c | 12 ++++++++++--
 1 file changed, 10 insertions(+), 2 deletions(-)

diff --git a/makedumpfile.c b/makedumpfile.c
index 3746cf6..ca03440 100644
--- a/makedumpfile.c
+++ b/makedumpfile.c
@@ -368,6 +368,7 @@ readpage_elf(unsigned long long paddr, void *bufptr)
 	off_t offset1, offset2;
 	size_t size1, size2;
 	unsigned long long phys_start, phys_end, frac_head = 0;
+	int original_usemmap = info->flag_usemmap;
 
 	offset1 = paddr_to_offset(paddr);
 	offset2 = paddr_to_offset(paddr + info->page_size);
@@ -392,6 +393,7 @@ readpage_elf(unsigned long long paddr, void *bufptr)
 		offset1 = paddr_to_offset(phys_start);
 		frac_head = phys_start - paddr;
 		memset(bufptr, 0, frac_head);
+		info->flag_usemmap = FALSE;
 	}
 
 	/*
@@ -402,6 +404,7 @@ readpage_elf(unsigned long long paddr, void *bufptr)
 		phys_end = page_head_to_phys_end(paddr);
 		offset2 = paddr_to_offset(phys_end);
 		memset(bufptr + (phys_end - paddr), 0, info->page_size - (phys_end - paddr));
+		info->flag_usemmap = FALSE;
 	}
 
 	/*
@@ -420,7 +423,7 @@ readpage_elf(unsigned long long paddr, void *bufptr)
 	if(!read_from_vmcore(offset1, bufptr + frac_head, size1)) {
 		ERRMSG("Can't read the dump memory(%s).\n",
 		       info->name_memory);
-		return FALSE;
+		goto error;
 	}
 
 	if (size1 + frac_head != info->page_size) {
@@ -429,11 +432,16 @@ readpage_elf(unsigned long long paddr, void *bufptr)
 		if(!read_from_vmcore(offset2, bufptr + frac_head + size1, size2)) {
 			ERRMSG("Can't read the dump memory(%s).\n",
 			       info->name_memory);
-			return FALSE;
+			goto error;
 		}
 	}
 
+	info->flag_usemmap = original_usemmap;
 	return TRUE;
+
+error:
+	info->flag_usemmap = original_usemmap;
+	return FALSE;
 }
 
 static int
-- 
1.8.0.2
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ