From mboxrd@z Thu Jan 1 00:00:00 1970 Return-path: Received: from kirsty.vergenet.net ([202.4.237.240]) by bombadil.infradead.org with esmtp (Exim 4.80.1 #2 (Red Hat Linux)) id 1ZqZQY-00072x-9m for kexec@lists.infradead.org; Mon, 26 Oct 2015 04:30:34 +0000 Date: Mon, 26 Oct 2015 13:30:11 +0900 From: Simon Horman Subject: Re: [PATCH] Revert "kexec: use mmap instead of read for slurp_file()" Message-ID: <20151026043010.GA2411@verge.net.au> References: <20151023031000.GA15557@dhcp-129-115.nay.redhat.com> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20151023031000.GA15557@dhcp-129-115.nay.redhat.com> List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "kexec" Errors-To: kexec-bounces+dwmw2=infradead.org@lists.infradead.org To: Dave Young Cc: Michael Holzheu , kexec@lists.infradead.org On Fri, Oct 23, 2015 at 11:10:00AM +0800, Dave Young wrote: > 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 Thanks, applied. > --- > 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 > #include > #include > -#include > #include > #include > #include > @@ -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