Kexec Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Dave Young <dyoung@redhat.com>
To: Simon Horman <horms@verge.net.au>
Cc: Michael Holzheu <holzheu@linux.vnet.ibm.com>, kexec@lists.infradead.org
Subject: [PATCH] Revert "kexec: use mmap instead of read for slurp_file()"
Date: Fri, 23 Oct 2015 11:10:00 +0800	[thread overview]
Message-ID: <20151023031000.GA15557@dhcp-129-115.nay.redhat.com> (raw)

This reverts commit 7ab842d8a004f6cd75a9d7b3528e4a70819ce4ef.

using mmap by default in slurp_file cause segment fault while later
reallocing dtb_buf during my arm kexec test.

Signed-off-by: Dave Young <dyoung@redhat.com>
---
 kexec/kexec.c |    8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

--- kexec-tools.orig/kexec/kexec.c
+++ kexec-tools/kexec/kexec.c
@@ -26,7 +26,6 @@
 #include <stdlib.h>
 #include <errno.h>
 #include <limits.h>
-#include <sys/mman.h>
 #include <sys/types.h>
 #include <sys/stat.h>
 #include <sys/reboot.h>
@@ -553,12 +552,11 @@ char *slurp_file(const char *filename, o
 		if (err < 0)
 			die("Can not seek to the begin of file %s: %s\n",
 					filename, strerror(errno));
-		buf = slurp_fd(fd, filename, size, &nread);
 	} else {
-		size = nread = stats.st_size;
-		buf = mmap(NULL, size,
-			   PROT_READ | PROT_WRITE, MAP_PRIVATE, fd, 0);
+		size = stats.st_size;
 	}
+
+	buf = slurp_fd(fd, filename, size, &nread);
 	if (!buf)
 		die("Cannot read %s", filename);
 

_______________________________________________
kexec mailing list
kexec@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/kexec

             reply	other threads:[~2015-10-23  3:10 UTC|newest]

Thread overview: 16+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2015-10-23  3:10 Dave Young [this message]
2015-10-23 15:09 ` [PATCH] Revert "kexec: use mmap instead of read for slurp_file()" Michael Holzheu
2015-10-26  7:31   ` Dave Young
2015-10-27 12:35     ` [PATCH v2] kexec/s390x: use mmap instead of read for slurp_file() Michael Holzheu
2015-10-28  6:46       ` Dave Young
2015-10-28  9:57         ` Michael Holzheu
2015-10-29  6:37           ` Dave Young
2015-10-29 15:26             ` Michael Holzheu
2015-10-30  2:03               ` Dave Young
2015-10-30 10:13                 ` Michael Holzheu
2015-10-30 13:39                   ` Dave Young
2015-10-30 15:02                     ` [PATCH v3] " Michael Holzheu
2015-11-09  1:59                       ` Simon Horman
2015-10-26  4:30 ` [PATCH] Revert "kexec: use mmap instead of read for slurp_file()" Simon Horman
2015-11-03  0:11 ` Geoff Levand
2015-11-03  1:15   ` Dave Young

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=20151023031000.GA15557@dhcp-129-115.nay.redhat.com \
    --to=dyoung@redhat.com \
    --cc=holzheu@linux.vnet.ibm.com \
    --cc=horms@verge.net.au \
    --cc=kexec@lists.infradead.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