SHA256
1
0
forked from pool/kexec-tools
OBS User unknown 2008-02-21 00:55:25 +00:00 committed by Git OBS Bridge
parent 48b0e40dcd
commit f195429c4b
9 changed files with 110 additions and 363 deletions

View File

@ -1,37 +0,0 @@
From b41eacb1069eeefd630d807b1587247e6d89628c Mon Sep 17 00:00:00 2001
From: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Date: Tue, 13 Nov 2007 19:29:16 +0900
Subject: [PATCH] Fix the feature determining ELF32/ELF64 automatically
Hi,
This patch fixes the problem that the kexec command cannot determine
ELF32/ELF64 automatically.
On i386 system, the kexec command always determined an ELF32 /proc/vmcore
even if the memory is 4GB or larger, because of referring the outside
of the array "range[]".
Thanks
Ken'ichi Ohmichi
Signed-off-by: Ken'ichi Ohmichi <oomichi@mxs.nes.nec.co.jp>
Signed-off-by: Simon Horman <horms@verge.net.au>
---
kexec/arch/i386/crashdump-x86.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/kexec/arch/i386/crashdump-x86.c
+++ b/kexec/arch/i386/crashdump-x86.c
@@ -528,7 +528,7 @@ static enum coretype get_core_type(struc
if (ranges == 0)
return CORE_TYPE_ELF64;
- if (range[ranges].end > 0xFFFFFFFFUL)
+ if (range[ranges - 1].end > 0xFFFFFFFFUL)
return CORE_TYPE_ELF64;
else
return CORE_TYPE_ELF32;

View File

@ -0,0 +1,25 @@
From: Bernhard Walle <bwalle@suse.de>
Subject: [PATCH] Fix compilation warning
This patch fixes following compilation warning:
purgatory/purgatory.c:21: warning: passing argument 2 of 'sha256_update' makes pointer from integer without a cast
Signed-off-by: Bernhard Walle <bwalle@suse.de>
---
purgatory/purgatory.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
--- a/purgatory/purgatory.c
+++ b/purgatory/purgatory.c
@@ -18,7 +18,7 @@ void verify_sha256_digest(void)
sha256_starts(&ctx);
end = &sha256_regions[sizeof(sha256_regions)/sizeof(sha256_regions[0])];
for(ptr = sha256_regions; ptr < end; ptr++) {
- sha256_update(&ctx, ptr->start, ptr->len);
+ sha256_update(&ctx, (uint8_t *)ptr->start, ptr->len);
}
sha256_finish(&ctx, digest);
if (memcmp(digest, sha256_digest, sizeof(digest)) != 0) {

View File

@ -1,3 +0,0 @@
version https://git-lfs.github.com/spec/v1
oid sha256:6468054ca33cdafb109fa6888cf35f497e277811f81d4278efc71706a5d874b6
size 211843

View File

@ -0,0 +1,3 @@
version https://git-lfs.github.com/spec/v1
oid sha256:b3ded4283e7b26e502c26dc6bf47ab6a562d004519c7244ff17c98d44dc33c93
size 300304

View File

@ -1,3 +1,28 @@
-------------------------------------------------------------------
Wed Feb 20 08:30:37 CET 2008 - bwalle@suse.de
- update to kexec-tools-testing v20080219-rc
o Fix the feature determining ELF32/ELF64 automatically
o Enable building a 32 bit binary for ppc64 platforms.
o Consolidate BOOTLOADER defines
o Use config.h for defines
o Add gamecube to config.h defines
o removed partially duplicated system headers
o Use general _SRCS and _OBJS, rather and _C_{SRCS, OBJS} and
_S_{SRCS, OBJS}
o build system fixes
o Add documentation on creating include/config.h.in to INSTALL
o Log unknown reloc name instead of its number
o Use zlib if present
o kexec buffer overflow on ppc platform
o sh: Remove hardcoded PAGE_SIZE in NetBSD loader
o Add ARM support to kexec
o Remove some extraneous whitespace
o kexec: Use target linker for purgatory
- removed kexec-tools-elf32-elf64-fix: mainline
- removed kexec-tools.ppc64-32bit-build.patch: mainline
- removed kexec-tools.fread-buffer-overflow.patch: mainline
------------------------------------------------------------------- -------------------------------------------------------------------
Wed Jan 30 15:17:18 CET 2008 - sassmann@suse.de Wed Jan 30 15:17:18 CET 2008 - sassmann@suse.de

View File

@ -1,36 +0,0 @@
Index: kexec-tools-testing-20071030/kexec/arch/ppc64/kexec-ppc64.c
===================================================================
--- kexec-tools-testing-20071030.orig/kexec/arch/ppc64/kexec-ppc64.c
+++ kexec-tools-testing-20071030/kexec/arch/ppc64/kexec-ppc64.c
@@ -160,7 +160,7 @@ static int get_base_ranges(void)
int local_memory_ranges = 0;
char device_tree[256] = "/proc/device-tree/";
char fname[256];
- char buf[MAXBYTES-1];
+ char buf[MAXBYTES];
DIR *dir, *dmem;
FILE *file;
struct dirent *dentry, *mentry;
@@ -258,7 +258,7 @@ static int get_devtree_details(unsigned
unsigned long long htab_base, htab_size;
unsigned long long kernel_end;
unsigned long long initrd_start, initrd_end;
- char buf[MAXBYTES-1];
+ char buf[MAXBYTES];
char device_tree[256] = "/proc/device-tree/";
char fname[256];
DIR *dir, *cdir;
Index: kexec-tools-testing-20071030/kexec/arch/ppc64/crashdump-ppc64.c
===================================================================
--- kexec-tools-testing-20071030.orig/kexec/arch/ppc64/crashdump-ppc64.c
+++ kexec-tools-testing-20071030/kexec/arch/ppc64/crashdump-ppc64.c
@@ -101,7 +101,7 @@ static int get_crash_memory_ranges(struc
int memory_ranges = 0;
char device_tree[256] = "/proc/device-tree/";
char fname[256];
- char buf[MAXBYTES-1];
+ char buf[MAXBYTES];
DIR *dir, *dmem;
FILE *file;
struct dirent *dentry, *mentry;

View File

@ -1,7 +1,7 @@
--- ---
kexec/arch/ppc64/crashdump-ppc64.h | 4 ++-- kexec/arch/ppc64/crashdump-ppc64.h | 4 ++--
purgatory/Makefile | 3 +++ purgatory/Makefile | 7 ++++++-
2 files changed, 5 insertions(+), 2 deletions(-) 2 files changed, 8 insertions(+), 3 deletions(-)
--- a/kexec/arch/ppc64/crashdump-ppc64.h --- a/kexec/arch/ppc64/crashdump-ppc64.h
+++ b/kexec/arch/ppc64/crashdump-ppc64.h +++ b/kexec/arch/ppc64/crashdump-ppc64.h
@ -19,13 +19,19 @@
#define MAXMEM (-KERNELBASE-VMALLOCBASE) #define MAXMEM (-KERNELBASE-VMALLOCBASE)
--- a/purgatory/Makefile --- a/purgatory/Makefile
+++ b/purgatory/Makefile +++ b/purgatory/Makefile
@@ -7,6 +7,9 @@ @@ -40,9 +40,14 @@ $(PURGATORY): CPPFLAGS+=-I$(srcdir)/purg
# should keep us from accidentially include unsafe library functions $(PURGATORY): LDFLAGS+=--no-undefined -nostartfiles -nostdlib -nodefaultlibs \
# or headers. -e purgatory_start -r
+ifeq ($(ARCH),ppc) +LDFLAGS_P = $(shell echo $(LDFLAGS) | sed -e 's/-lz//g')
+EXTRA_LDFLAGS = -melf64ppc +ifeq ($(ARCH),ppc64)
+LDFLAGS_P+=-melf64ppc -m64
+endif +endif
ifeq ($(ARCH),ppc64) +
EXTRA_LDFLAGS = -melf64ppc $(PURGATORY): $(PURGATORY_OBJS)
endif $(MKDIR) -p $(@D)
- $(CC) $(LDFLAGS) -o $@ $^
+ $(CC) $(LDFLAGS_P) -o $@ $^
# $(LD) $(LDFLAGS) $(EXTRA_LDFLAGS) --no-undefined -e purgatory_start -r -o $@ $(PURGATORY_OBJS) $(UTIL_LIB)

View File

@ -1,255 +0,0 @@
---
kexec/arch/ppc64/crashdump-ppc64.h | 4 ++--
kexec/arch/ppc64/kexec-elf-ppc64.c | 26 +++++++++++++-------------
kexec/arch/ppc64/kexec-elf-rel-ppc64.c | 4 ++--
kexec/arch/ppc64/kexec-ppc64.c | 20 ++++++++++----------
kexec/arch/ppc64/kexec-ppc64.h | 2 +-
kexec/kexec-sha256.h | 4 ++--
purgatory/arch/ppc64/Makefile | 2 ++
purgatory/purgatory.c | 4 +++-
8 files changed, 35 insertions(+), 31 deletions(-)
--- a/kexec/arch/ppc64/crashdump-ppc64.h
+++ b/kexec/arch/ppc64/crashdump-ppc64.h
@@ -23,8 +23,8 @@ void add_usable_mem_rgns(unsigned long l
#define _ALIGN_UP(addr,size) (((addr)+((size)-1))&(~((size)-1)))
#define _ALIGN_DOWN(addr,size) ((addr)&(~((size)-1)))
-extern unsigned long long crash_base;
-extern unsigned long long crash_size;
+extern uint64_t crash_base;
+extern uint64_t crash_size;
extern unsigned int rtas_base;
extern unsigned int rtas_size;
--- a/kexec/arch/ppc64/kexec-elf-ppc64.c
+++ b/kexec/arch/ppc64/kexec-elf-ppc64.c
@@ -42,7 +42,7 @@
#define BOOTLOADER "kexec"
#define BOOTLOADER_VERSION VERSION
-unsigned long initrd_base, initrd_size;
+uint64_t initrd_base, initrd_size;
unsigned char reuse_initrd = 0;
const char *ramdisk;
@@ -83,19 +83,19 @@ int elf_ppc64_load(int argc, char **argv
char *cmdline, *modified_cmdline;
const char *devicetreeblob;
int cmdline_len, modified_cmdline_len;
- unsigned long long max_addr, hole_addr;
+ uint64_t max_addr, hole_addr;
unsigned char *seg_buf = NULL;
off_t seg_size = 0;
struct mem_phdr *phdr;
size_t size;
- unsigned long long *rsvmap_ptr;
+ uint64_t *rsvmap_ptr;
struct bootblock *bb_ptr;
unsigned int nr_segments, i;
int result, opt;
- unsigned long my_kernel, my_dt_offset;
+ uint64_t my_kernel, my_dt_offset;
unsigned int my_panic_kernel;
- unsigned long my_stack, my_backup_start;
- unsigned long toc_addr;
+ uint64_t my_stack, my_backup_start;
+ uint64_t toc_addr;
unsigned int slave_code[256/sizeof (unsigned int)], master_entry;
#define OPT_APPEND (OPT_ARCH_MAX+0)
@@ -237,10 +237,10 @@ int elf_ppc64_load(int argc, char **argv
}
seg_buf = (unsigned char *)slurp_file(ramdisk, &seg_size);
add_buffer(info, seg_buf, seg_size, seg_size, 0, 0, max_addr, 1);
- hole_addr = (unsigned long long)
+ hole_addr = (uint64_t)
info->segment[info->nr_segments-1].mem;
initrd_base = hole_addr;
- initrd_size = (unsigned long long)
+ initrd_size = (uint64_t)
info->segment[info->nr_segments-1].memsz;
} /* ramdisk */
@@ -270,25 +270,25 @@ int elf_ppc64_load(int argc, char **argv
*/
bb_ptr = (struct bootblock *)(
(unsigned char *)info->segment[(info->nr_segments)-1].buf);
- rsvmap_ptr = (unsigned long long *)(
+ rsvmap_ptr = (uint64_t *)(
(unsigned char *)info->segment[(info->nr_segments)-1].buf +
bb_ptr->off_mem_rsvmap);
while (*rsvmap_ptr || *(rsvmap_ptr+1))
rsvmap_ptr += 2;
rsvmap_ptr -= 2;
- *rsvmap_ptr = (unsigned long long)(
+ *rsvmap_ptr = (uint64_t)(
info->segment[(info->nr_segments)-1].mem);
rsvmap_ptr++;
- *rsvmap_ptr = (unsigned long long)bb_ptr->totalsize;
+ *rsvmap_ptr = (uint64_t)bb_ptr->totalsize;
nr_segments = info->nr_segments;
/* Set kernel */
- my_kernel = (unsigned long )info->segment[0].mem;
+ my_kernel = (uint64_t)info->segment[0].mem;
elf_rel_set_symbol(&info->rhdr, "kernel", &my_kernel, sizeof(my_kernel));
/* Set dt_offset */
- my_dt_offset = (unsigned long )info->segment[nr_segments-1].mem;
+ my_dt_offset = (uint64_t)info->segment[nr_segments-1].mem;
elf_rel_set_symbol(&info->rhdr, "dt_offset", &my_dt_offset,
sizeof(my_dt_offset));
--- a/kexec/arch/ppc64/kexec-elf-rel-ppc64.c
+++ b/kexec/arch/ppc64/kexec-elf-rel-ppc64.c
@@ -101,10 +101,10 @@ void machine_apply_elf_rel(struct mem_eh
break;
case R_PPC64_ADDR16_HIGHEST:
- *(uint16_t *)location = ((value>>48) & 0xffff);
+ *(uint16_t *)location = (((uint64_t)value>>48) & 0xffff);
break;
case R_PPC64_ADDR16_HIGHER:
- *(uint16_t *)location = ((value>>32) & 0xffff);
+ *(uint16_t *)location = (((uint64_t)value>>32) & 0xffff);
break;
default:
--- a/kexec/arch/ppc64/kexec-ppc64.c
+++ b/kexec/arch/ppc64/kexec-ppc64.c
@@ -41,7 +41,7 @@ static struct memory_range *base_memory_
static unsigned long long rmo_top;
unsigned long long memory_max = 0;
static int nr_memory_ranges, nr_exclude_ranges;
-unsigned long long crash_base, crash_size;
+uint64_t crash_base, crash_size;
unsigned int rtas_base, rtas_size;
int max_memory_ranges;
@@ -203,10 +203,10 @@ static int get_base_ranges(void)
break;
}
base_memory_range[local_memory_ranges].start =
- ((unsigned long long *)buf)[0];
+ ((uint64_t *)buf)[0];
base_memory_range[local_memory_ranges].end =
base_memory_range[local_memory_ranges].start +
- ((unsigned long long *)buf)[1];
+ ((uint64_t *)buf)[1];
base_memory_range[local_memory_ranges].type = RANGE_RAM;
local_memory_ranges++;
dbgprintf("%016llx-%016llx : %x\n",
@@ -231,7 +231,7 @@ static int get_base_ranges(void)
static int sort_ranges(void)
{
int i, j;
- unsigned long long tstart, tend;
+ uint64_t tstart, tend;
for (i = 0; i < nr_exclude_ranges - 1; i++) {
for (j = 0; j < nr_exclude_ranges - i - 1; j++) {
if (exclude_range[j].start > exclude_range[j+1].start) {
@@ -292,7 +292,7 @@ static int get_devtree_details(unsigned
perror(fname);
goto error_opencdir;
}
- if (fread(&kernel_end, sizeof(unsigned long), 1, file) != 1) {
+ if (fread(&kernel_end, sizeof(uint64_t), 1, file) != 1) {
perror(fname);
goto error_openfile;
}
@@ -312,7 +312,7 @@ static int get_devtree_details(unsigned
perror(fname);
goto error_opencdir;
}
- if (fread(&crash_base, sizeof(unsigned long), 1,
+ if (fread(&crash_base, sizeof(uint64_t), 1,
file) != 1) {
perror(fname);
goto error_openfile;
@@ -327,7 +327,7 @@ static int get_devtree_details(unsigned
perror(fname);
goto error_opencdir;
}
- if (fread(&crash_size, sizeof(unsigned long), 1,
+ if (fread(&crash_size, sizeof(uint64_t), 1,
file) != 1) {
perror(fname);
goto error_openfile;
@@ -356,7 +356,7 @@ static int get_devtree_details(unsigned
perror(fname);
goto error_opendir;
}
- if (fread(&htab_base, sizeof(unsigned long), 1, file) != 1) {
+ if (fread(&htab_base, sizeof(uint64_t), 1, file) != 1) {
perror(fname);
goto error_openfile;
}
@@ -368,7 +368,7 @@ static int get_devtree_details(unsigned
perror(fname);
goto error_opencdir;
}
- if (fread(&htab_size, sizeof(unsigned long), 1, file) != 1) {
+ if (fread(&htab_size, sizeof(uint64_t), 1, file) != 1) {
perror(fname);
goto error_openfile;
}
@@ -487,7 +487,7 @@ static int get_devtree_details(unsigned
perror(fname);
goto error_opendir;
}
- if (fread(&tce_base, sizeof(unsigned long), 1, file) != 1) {
+ if (fread(&tce_base, sizeof(uint64_t), 1, file) != 1) {
perror(fname);
goto error_openfile;
return -1;
--- a/kexec/arch/ppc64/kexec-ppc64.h
+++ b/kexec/arch/ppc64/kexec-ppc64.h
@@ -14,7 +14,7 @@ int elf_ppc64_load(int argc, char **argv
void elf_ppc64_usage(void);
void reserve(unsigned long long where, unsigned long long length);
-extern unsigned long initrd_base, initrd_size;
+extern uint64_t initrd_base, initrd_size;
extern int max_memory_ranges;
extern unsigned char reuse_initrd;
--- a/kexec/kexec-sha256.h
+++ b/kexec/kexec-sha256.h
@@ -2,8 +2,8 @@
#define KEXEC_SHA256_H
struct sha256_region {
- const void *start;
- unsigned long len;
+ uint64_t start;
+ uint64_t len;
};
#define SHA256_REGIONS 16
--- a/purgatory/arch/ppc64/Makefile
+++ b/purgatory/arch/ppc64/Makefile
@@ -6,3 +6,5 @@ PURGATORY_S_SRCS+= purgatory/arch/ppc64/
PURGATORY_C_SRCS += purgatory/arch/ppc64/purgatory-ppc64.c
PURGATORY_C_SRCS += purgatory/arch/ppc64/console-ppc64.c
PURGATORY_C_SRCS += purgatory/arch/ppc64/crashdump_backup.c
+
+PCFLAGS += -m64 -mcall-aixdesc
--- a/purgatory/purgatory.c
+++ b/purgatory/purgatory.c
@@ -18,7 +18,7 @@ void verify_sha256_digest(void)
sha256_starts(&ctx);
end = &sha256_regions[sizeof(sha256_regions)/sizeof(sha256_regions[0])];
for(ptr = sha256_regions; ptr < end; ptr++) {
- sha256_update(&ctx, ptr->start, ptr->len);
+ sha256_update(&ctx, (char *)ptr->start, ptr->len);
}
sha256_finish(&ctx, digest);
if (memcmp(digest, sha256_digest, sizeof(digest)) != 0) {
@@ -46,3 +46,5 @@ void purgatory(void)
verify_sha256_digest();
post_verification_setup_arch();
}
+
+#include "../util_lib/sha256.c"

View File

@ -10,30 +10,29 @@
# norootforbuild # norootforbuild
Name: kexec-tools Name: kexec-tools
# kdump does not work yet, kexec-tools.ppc64.rpm still required for kdump # kdump does not work yet, kexec-tools.ppc64.rpm still required for kdump
%ifarch ppc %ifarch ppc
BuildRequires: gcc-64bit glibc-devel-64bit BuildRequires: gcc-64bit glibc-devel-64bit
%endif %endif
%define package_version testing-20071030 %define package_version testing-20080219-rc
License: GPL v2 or later License: GPL v2 or later
Group: System/Kernel Group: System/Kernel
Requires: %insserv_prereq %fillup_prereq Requires: %insserv_prereq %fillup_prereq
AutoReqProv: on AutoReqProv: on
Summary: Tools for fast kernel loading Summary: Tools for fast kernel loading
Version: 1.101 Version: 1.101
Release: 164 Release: 169
Source: %{name}-%{package_version}.tar.bz2 Source: %{name}-%{package_version}.tar.bz2
Source1: README.SUSE Source1: README.SUSE
Url: http://www.vergenet.net/linux/kexec/kexec-tools/ Url: http://ftp.kernel.org/pub/linux/kernel/people/horms/kexec-tools/
BuildRoot: %{_tmppath}/%{name}-%{version}-build BuildRoot: %{_tmppath}/%{name}-%{version}-build
BuildRequires: zlib-devel BuildRequires: zlib-devel
Patch1: kexec-longer-cmdline.diff Patch1: kexec-longer-cmdline.diff
Patch2: kexec-tools-elf32-elf64-fix Patch2: kexec-tools.ppc32-64bit-purgatory.patch
Patch20: kexec-tools.ppc64-32bit-build.patch Patch3: kexec-tools.gcc-bug.patch
Patch21: kexec-tools.ppc32-64bit-purgatory.patch Patch4: kexec-tools-portability-issue
Patch22: kexec-tools.gcc-bug.patch
Patch30: kexec-tools.fread-buffer-overflow.patch
%description %description
Kexec is a user space utility for loading another kernel and asking the Kexec is a user space utility for loading another kernel and asking the
@ -56,27 +55,25 @@ Authors:
%setup -q -n kexec-tools-%{package_version} %setup -q -n kexec-tools-%{package_version}
%patch1 -p1 %patch1 -p1
%patch2 -p1 %patch2 -p1
# %patch3 -p1
%patch20 -p1 %patch4 -p1
%patch21 -p1
%patch22 -p1
%patch30 -p1
%build %build
%{?suse_update_config -f} %{?suse_update_config -f}
cp %{SOURCE1} . cp %{SOURCE1} .
autoreconf -fi
./configure \
--prefix=/ \
%ifarch ppc
ARCH=ppc64 \
%endif
--sbindir=/sbin \
--libdir=/%_lib
%ifarch ia64 %ifarch ia64
RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS | sed -e 's/-fstack-protector//') RPM_OPT_FLAGS=$(echo $RPM_OPT_FLAGS | sed -e 's/-fstack-protector//')
%endif %endif
make CPPFLAGS="$RPM_OPT_FLAGS" CFLAGS=$RPM_OPT_FLAGS ./configure \
--prefix=/ \
%ifarch ppc
--host=powerpc64-suse-linux \
--build=powerpc64-suse-linux \
%endif
--sbindir=/sbin \
--libdir=/%_lib
make clean
make #CPPFLAGS="$RPM_OPT_FLAGS"
%install %install
make DESTDIR=$RPM_BUILD_ROOT install make DESTDIR=$RPM_BUILD_ROOT install
@ -96,6 +93,28 @@ install -c -m 0644 kexec/kexec.8 $RPM_BUILD_ROOT%{_mandir}/man8
%endif %endif
%changelog %changelog
* Wed Feb 20 2008 bwalle@suse.de
- update to kexec-tools-testing v20080219-rc
o Fix the feature determining ELF32/ELF64 automatically
o Enable building a 32 bit binary for ppc64 platforms.
o Consolidate BOOTLOADER defines
o Use config.h for defines
o Add gamecube to config.h defines
o removed partially duplicated system headers
o Use general _SRCS and _OBJS, rather and _C_{SRCS, OBJS} and
_S_{SRCS, OBJS}
o build system fixes
o Add documentation on creating include/config.h.in to INSTALL
o Log unknown reloc name instead of its number
o Use zlib if present
o kexec buffer overflow on ppc platform
o sh: Remove hardcoded PAGE_SIZE in NetBSD loader
o Add ARM support to kexec
o Remove some extraneous whitespace
o kexec: Use target linker for purgatory
- removed kexec-tools-elf32-elf64-fix: mainline
- removed kexec-tools.ppc64-32bit-build.patch: mainline
- removed kexec-tools.fread-buffer-overflow.patch: mainline
* Wed Jan 30 2008 sassmann@suse.de * Wed Jan 30 2008 sassmann@suse.de
- fix fread buffer overflow on ppc - fix fread buffer overflow on ppc
* Tue Jan 22 2008 ro@suse.de * Tue Jan 22 2008 ro@suse.de