Blame SOURCES/kexec-tools-2.0.8-makedumpfile-Make-get_elf64_phdr-get_elf32_phdr-publ.patch

a6d77e
Return-Path: yishimat@redhat.com
a6d77e
Received: from zmta04.collab.prod.int.phx2.redhat.com (LHLO
a6d77e
 zmta04.collab.prod.int.phx2.redhat.com) (10.5.81.11) by
a6d77e
 zmail24.collab.prod.int.phx2.redhat.com with LMTP; Thu, 2 Jul 2015 01:14:06
a6d77e
 -0400 (EDT)
a6d77e
Received: from int-mx10.intmail.prod.int.phx2.redhat.com (int-mx10.intmail.prod.int.phx2.redhat.com [10.5.11.23])
a6d77e
	by zmta04.collab.prod.int.phx2.redhat.com (Postfix) with ESMTP id 08529DA114;
a6d77e
	Thu,  2 Jul 2015 01:14:06 -0400 (EDT)
a6d77e
Received: from [10.3.112.13] ([10.3.112.13])
a6d77e
	by int-mx10.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id t625E1nH006506;
a6d77e
	Thu, 2 Jul 2015 01:14:03 -0400
a6d77e
Subject: [RHEL7.2 PATCH resend v3 1/4] Make get_elf64_phdr()/get_elf32_phdr()
a6d77e
 public.
a6d77e
To: kexec-kdump-list@redhat.com
a6d77e
References: <55929BD5.7050709@redhat.com> <5594C856.6050503@redhat.com>
a6d77e
Cc: Minfei Huang <mhuang@redhat.com>, bhe@redhat.com, yishimat@redhat.com
a6d77e
From: Yasuaki Ishimatsu <yishimat@redhat.com>
a6d77e
Message-ID: <5594C899.1070106@redhat.com>
a6d77e
Date: Thu, 2 Jul 2015 01:14:01 -0400
a6d77e
User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:38.0) Gecko/20100101
a6d77e
 Thunderbird/38.0.1
a6d77e
MIME-Version: 1.0
a6d77e
In-Reply-To: <5594C856.6050503@redhat.com>
a6d77e
Content-Type: text/plain; charset=utf-8
a6d77e
Content-Transfer-Encoding: 7bit
a6d77e
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.23
a6d77e
Content-Length: 3805
a6d77e
a6d77e
https://bugzilla.redhat.com/show_bug.cgi?id=1182377
a6d77e
a6d77e
The patch is back ported directory from the following upstream commit:
a6d77e
a6d77e
commit 3182be907d27584cd04dfb03d0ec5bf7134da87f
a6d77e
Author: Wang Xiao <wangx.fnst@cn.fujitsu.com>
a6d77e
Date:   Mon Oct 20 13:38:45 2014 +0900
a6d77e
a6d77e
    [PATCH v4 1/4] Make get_elf64_phdr()/get_elf32_phdr() public.
a6d77e
a6d77e
    Move the following two functions from internal function to external
a6d77e
    function.
a6d77e
a6d77e
    get_elf64_phdr(int fd, char *filename, int index, Elf64_Phdr *phdr)
a6d77e
    get_elf32_phdr(int fd, char *filename, int index, Elf32_Phdr *phdr)
a6d77e
a6d77e
    Signed-of-by: Wang Xiao <wangx.fnst@cn.fujitsu.com>
a6d77e
a6d77e
Resolves: rhbz#1182377
a6d77e
Signed-off-by: Yasuaki Ishimatsu <yishimat@redhat.com>
a6d77e
Acked-by: Minfei Huang <mhuang@redhat.com>
a6d77e
a6d77e
---
a6d77e
 makedumpfile-1.5.7/elf_info.c |   71 ++++++++++++++++++++---------------------
a6d77e
 makedumpfile-1.5.7/elf_info.h |    2 +
a6d77e
 2 files changed, 37 insertions(+), 36 deletions(-)
a6d77e
a6d77e
diff --git a/makedumpfile-1.5.7/elf_info.c b/makedumpfile-1.5.7/elf_info.c
a6d77e
index 5be1990..24936d4 100644
a6d77e
--- a/makedumpfile-1.5.7/elf_info.c
a6d77e
+++ b/makedumpfile-1.5.7/elf_info.c
a6d77e
@@ -95,42 +95,6 @@ static unsigned long		size_xen_crash_info;
a6d77e
  * Internal functions.
a6d77e
  */
a6d77e
 static int
a6d77e
-get_elf64_phdr(int fd, char *filename, int index, Elf64_Phdr *phdr)
a6d77e
-{
a6d77e
-	off_t offset;
a6d77e
-
a6d77e
-	offset = sizeof(Elf64_Ehdr) + sizeof(Elf64_Phdr) * index;
a6d77e
-
a6d77e
-	if (lseek(fd, offset, SEEK_SET) < 0) {
a6d77e
-		ERRMSG("Can't seek %s. %s\n", filename, strerror(errno));
a6d77e
-		return FALSE;
a6d77e
-	}
a6d77e
-	if (read(fd, phdr, sizeof(Elf64_Phdr)) != sizeof(Elf64_Phdr)) {
a6d77e
-		ERRMSG("Can't read %s. %s\n", filename, strerror(errno));
a6d77e
-		return FALSE;
a6d77e
-	}
a6d77e
-	return TRUE;
a6d77e
-}
a6d77e
-
a6d77e
-static int
a6d77e
-get_elf32_phdr(int fd, char *filename, int index, Elf32_Phdr *phdr)
a6d77e
-{
a6d77e
-	off_t offset;
a6d77e
-
a6d77e
-	offset = sizeof(Elf32_Ehdr) + sizeof(Elf32_Phdr) * index;
a6d77e
-
a6d77e
-	if (lseek(fd, offset, SEEK_SET) < 0) {
a6d77e
-		ERRMSG("Can't seek %s. %s\n", filename, strerror(errno));
a6d77e
-		return FALSE;
a6d77e
-	}
a6d77e
-	if (read(fd, phdr, sizeof(Elf32_Phdr)) != sizeof(Elf32_Phdr)) {
a6d77e
-		ERRMSG("Can't read %s. %s\n", filename, strerror(errno));
a6d77e
-		return FALSE;
a6d77e
-	}
a6d77e
-	return TRUE;
a6d77e
-}
a6d77e
-
a6d77e
-static int
a6d77e
 check_elf_format(int fd, char *filename, int *phnum, unsigned int *num_load)
a6d77e
 {
a6d77e
 	int i;
a6d77e
@@ -446,6 +410,41 @@ int set_kcore_vmcoreinfo(uint64_t vmcoreinfo_addr, uint64_t vmcoreinfo_len)
a6d77e
 /*
a6d77e
  * External functions.
a6d77e
  */
a6d77e
+int
a6d77e
+get_elf64_phdr(int fd, char *filename, int index, Elf64_Phdr *phdr)
a6d77e
+{
a6d77e
+	off_t offset;
a6d77e
+
a6d77e
+	offset = sizeof(Elf64_Ehdr) + sizeof(Elf64_Phdr) * index;
a6d77e
+
a6d77e
+	if (lseek(fd, offset, SEEK_SET) < 0) {
a6d77e
+		ERRMSG("Can't seek %s. %s\n", filename, strerror(errno));
a6d77e
+		return FALSE;
a6d77e
+	}
a6d77e
+	if (read(fd, phdr, sizeof(Elf64_Phdr)) != sizeof(Elf64_Phdr)) {
a6d77e
+		ERRMSG("Can't read %s. %s\n", filename, strerror(errno));
a6d77e
+		return FALSE;
a6d77e
+	}
a6d77e
+	return TRUE;
a6d77e
+}
a6d77e
+
a6d77e
+int
a6d77e
+get_elf32_phdr(int fd, char *filename, int index, Elf32_Phdr *phdr)
a6d77e
+{
a6d77e
+	off_t offset;
a6d77e
+
a6d77e
+	offset = sizeof(Elf32_Ehdr) + sizeof(Elf32_Phdr) * index;
a6d77e
+
a6d77e
+	if (lseek(fd, offset, SEEK_SET) < 0) {
a6d77e
+		ERRMSG("Can't seek %s. %s\n", filename, strerror(errno));
a6d77e
+		return FALSE;
a6d77e
+	}
a6d77e
+	if (read(fd, phdr, sizeof(Elf32_Phdr)) != sizeof(Elf32_Phdr)) {
a6d77e
+		ERRMSG("Can't read %s. %s\n", filename, strerror(errno));
a6d77e
+		return FALSE;
a6d77e
+	}
a6d77e
+	return TRUE;
a6d77e
+}
a6d77e
a6d77e
 /*
a6d77e
  * Convert Physical Address to File Offset.
a6d77e
diff --git a/makedumpfile-1.5.7/elf_info.h b/makedumpfile-1.5.7/elf_info.h
a6d77e
index cbabf8a..e712253 100644
a6d77e
--- a/makedumpfile-1.5.7/elf_info.h
a6d77e
+++ b/makedumpfile-1.5.7/elf_info.h
a6d77e
@@ -27,6 +27,8 @@
a6d77e
a6d77e
 #define MAX_SIZE_NHDR	MAX(sizeof(Elf64_Nhdr), sizeof(Elf32_Nhdr))
a6d77e
a6d77e
+int get_elf64_phdr(int fd, char *filename, int index, Elf64_Phdr *phdr);
a6d77e
+int get_elf32_phdr(int fd, char *filename, int index, Elf32_Phdr *phdr);
a6d77e
a6d77e
 off_t paddr_to_offset(unsigned long long paddr);
a6d77e
 off_t paddr_to_offset2(unsigned long long paddr, off_t hint);
a6d77e
-- 
a6d77e
1.7.1
a6d77e