diff --git a/makedumpfile-fix-64bit-on-32bit b/makedumpfile-fix-64bit-on-32bit new file mode 100644 index 0000000..b2e0746 --- /dev/null +++ b/makedumpfile-fix-64bit-on-32bit @@ -0,0 +1,179 @@ +From: Bernhard Walle +Subject: [PATCH] Fix vmcoreinfo generation on 32bit hosts for 64bit kernels + +This bug fixes the generation of vmcoreinfo files on 32bit hosts for ELF64 +files, i.e. 64bit kernels. The concrete problem was PPC64 which is built in a +32bit environment at SUSE. + + +Signed-off-by: Bernhard Walle + +--- + makedumpfile.c | 37 ++++++++++++++++++----------------- + makedumpfile.h | 60 ++++++++++++++++++++++++++++----------------------------- + 2 files changed, 49 insertions(+), 48 deletions(-) + +--- a/makedumpfile.c ++++ b/makedumpfile.c +@@ -123,7 +123,7 @@ vaddr_to_offset_general(unsigned long lo + * It is useful at few calls like get_str_osrelease_from_vmlinux(). + */ + off_t +-vaddr_to_offset_slow(int fd, char *filename, unsigned long vaddr) ++vaddr_to_offset_slow(int fd, char *filename, unsigned long long vaddr) + { + off_t offset = 0; + int i, phnum, num_load, flag_elf64, elf_format; +@@ -170,6 +170,7 @@ vaddr_to_offset_slow(int fd, char *filen + break; + } + } ++ + return offset; + } + +@@ -937,11 +938,11 @@ out: + return ret; + } + +-unsigned long ++unsigned long long + get_symbol_addr(char *symname) + { + int i; +- unsigned long symbol = NOT_FOUND_SYMBOL; ++ unsigned long long symbol = NOT_FOUND_SYMBOL; + Elf *elfd = NULL; + GElf_Shdr shdr; + GElf_Sym sym; +@@ -1900,7 +1901,7 @@ int + get_str_osrelease_from_vmlinux() + { + struct utsname system_utsname; +- unsigned long utsname; ++ unsigned long long utsname; + off_t offset; + const off_t failed = (off_t)-1; + +@@ -1919,7 +1920,7 @@ get_str_osrelease_from_vmlinux() + dwarf_info.vmlinux_name, utsname); + + if (!offset) { +- ERRMSG("Can't convert vaddr (%lx) of utsname to an offset.\n", ++ ERRMSG("Can't convert vaddr (%llx) of utsname to an offset.\n", + utsname); + return FALSE; + } +@@ -5431,19 +5432,19 @@ show_data_xen() + * Show data for debug + */ + MSG("\n"); +- MSG("SYMBOL(dom_xen): %lx\n", SYMBOL(dom_xen)); +- MSG("SYMBOL(dom_io): %lx\n", SYMBOL(dom_io)); +- MSG("SYMBOL(domain_list): %lx\n", SYMBOL(domain_list)); +- MSG("SYMBOL(xen_heap_start): %lx\n", SYMBOL(xen_heap_start)); +- MSG("SYMBOL(frame_table): %lx\n", SYMBOL(frame_table)); +- MSG("SYMBOL(alloc_bitmap): %lx\n", SYMBOL(alloc_bitmap)); +- MSG("SYMBOL(max_page): %lx\n", SYMBOL(max_page)); +- MSG("SYMBOL(pgd_l2): %lx\n", SYMBOL(pgd_l2)); +- MSG("SYMBOL(pgd_l3): %lx\n", SYMBOL(pgd_l3)); +- MSG("SYMBOL(pgd_l4): %lx\n", SYMBOL(pgd_l4)); +- MSG("SYMBOL(xenheap_phys_end): %lx\n", SYMBOL(xenheap_phys_end)); +- MSG("SYMBOL(xen_pstart): %lx\n", SYMBOL(xen_pstart)); +- MSG("SYMBOL(frametable_pg_dir): %lx\n", SYMBOL(frametable_pg_dir)); ++ MSG("SYMBOL(dom_xen): %llx\n", SYMBOL(dom_xen)); ++ MSG("SYMBOL(dom_io): %llx\n", SYMBOL(dom_io)); ++ MSG("SYMBOL(domain_list): %llx\n", SYMBOL(domain_list)); ++ MSG("SYMBOL(xen_heap_start): %llx\n", SYMBOL(xen_heap_start)); ++ MSG("SYMBOL(frame_table): %llx\n", SYMBOL(frame_table)); ++ MSG("SYMBOL(alloc_bitmap): %llx\n", SYMBOL(alloc_bitmap)); ++ MSG("SYMBOL(max_page): %llx\n", SYMBOL(max_page)); ++ MSG("SYMBOL(pgd_l2): %llx\n", SYMBOL(pgd_l2)); ++ MSG("SYMBOL(pgd_l3): %llx\n", SYMBOL(pgd_l3)); ++ MSG("SYMBOL(pgd_l4): %llx\n", SYMBOL(pgd_l4)); ++ MSG("SYMBOL(xenheap_phys_end): %llx\n", SYMBOL(xenheap_phys_end)); ++ MSG("SYMBOL(xen_pstart): %llx\n", SYMBOL(xen_pstart)); ++ MSG("SYMBOL(frametable_pg_dir): %llx\n", SYMBOL(frametable_pg_dir)); + + MSG("SIZE(page_info): %ld\n", SIZE(page_info)); + MSG("OFFSET(page_info.count_info): %ld\n", OFFSET(page_info.count_info)); +--- a/makedumpfile.h ++++ b/makedumpfile.h +@@ -258,7 +258,7 @@ do { \ + #define WRITE_SYMBOL(str_symbol, symbol) \ + do { \ + if (SYMBOL(symbol) != NOT_FOUND_SYMBOL) { \ +- fprintf(info->file_vmcoreinfo, "%s%lx\n", \ ++ fprintf(info->file_vmcoreinfo, "%s%llx\n", \ + STR_SYMBOL(str_symbol), SYMBOL(symbol)); \ + } \ + } while (0) +@@ -790,39 +790,39 @@ struct vm_table { + extern struct vm_table vt; + + struct symbol_table { +- unsigned long mem_map; +- unsigned long mem_section; +- unsigned long pkmap_count; +- unsigned long pkmap_count_next; +- unsigned long system_utsname; +- unsigned long init_uts_ns; +- unsigned long _stext; +- unsigned long swapper_pg_dir; +- unsigned long init_level4_pgt; +- unsigned long phys_base; +- unsigned long node_online_map; +- unsigned long node_states; +- unsigned long node_memblk; +- unsigned long node_data; +- unsigned long pgdat_list; +- unsigned long contig_page_data; ++ unsigned long long mem_map; ++ unsigned long long mem_section; ++ unsigned long long pkmap_count; ++ unsigned long long pkmap_count_next; ++ unsigned long long system_utsname; ++ unsigned long long init_uts_ns; ++ unsigned long long _stext; ++ unsigned long long swapper_pg_dir; ++ unsigned long long init_level4_pgt; ++ unsigned long long phys_base; ++ unsigned long long node_online_map; ++ unsigned long long node_states; ++ unsigned long long node_memblk; ++ unsigned long long node_data; ++ unsigned long long pgdat_list; ++ unsigned long long contig_page_data; + + /* + * for Xen extraction + */ +- unsigned long dom_xen; +- unsigned long dom_io; +- unsigned long domain_list; +- unsigned long frame_table; +- unsigned long xen_heap_start; +- unsigned long pgd_l2; +- unsigned long pgd_l3; +- unsigned long pgd_l4; +- unsigned long xenheap_phys_end; +- unsigned long xen_pstart; +- unsigned long frametable_pg_dir; +- unsigned long max_page; +- unsigned long alloc_bitmap; ++ unsigned long long dom_xen; ++ unsigned long long dom_io; ++ unsigned long long domain_list; ++ unsigned long long frame_table; ++ unsigned long long xen_heap_start; ++ unsigned long long pgd_l2; ++ unsigned long long pgd_l3; ++ unsigned long long pgd_l4; ++ unsigned long long xenheap_phys_end; ++ unsigned long long xen_pstart; ++ unsigned long long frametable_pg_dir; ++ unsigned long long max_page; ++ unsigned long long alloc_bitmap; + }; + + struct size_table { diff --git a/makedumpfile.changes b/makedumpfile.changes index 9c042fa..52a45f2 100644 --- a/makedumpfile.changes +++ b/makedumpfile.changes @@ -1,3 +1,8 @@ +------------------------------------------------------------------- +Mon Dec 10 18:23:53 CET 2007 - bwalle@suse.de + +- Fix generation of vmcoreinfo for ELF64 kernels on 32bit machines + ------------------------------------------------------------------- Thu Nov 29 13:41:09 CET 2007 - bwalle@suse.de diff --git a/makedumpfile.spec b/makedumpfile.spec index d4bca81..40f66cd 100644 --- a/makedumpfile.spec +++ b/makedumpfile.spec @@ -15,12 +15,13 @@ BuildRequires: gcc-c++ libdw-devel libdw1 libelf-devel libelf0 libelf1 zlib-dev %define elfutils_version 0.124 License: GPL v2 or later Version: 1.2.3 -Release: 1 +Release: 4 Summary: Partial kernel dump Group: System/Kernel Url: https://sourceforge.net/projects/makedumpfile/ Source: makedumpfile-%{version}.tar.bz2 Patch: makedumpfile-coptflags.diff +Patch1: makedumpfile-fix-64bit-on-32bit BuildRoot: %{_tmppath}/%{name}-%{version}-build %description @@ -38,6 +39,7 @@ Authors: %prep %setup -n makedumpfile -q %patch -p1 +%patch1 -p1 %build make COPTFLAGS="$RPM_OPT_FLAGS" @@ -59,6 +61,8 @@ install -c -m 0644 makedumpfile.8 $RPM_BUILD_ROOT%{_mandir}/man8 /bin/* %changelog +* Mon Dec 10 2007 - bwalle@suse.de +- Fix generation of vmcoreinfo for ELF64 kernels on 32bit machines * Thu Nov 29 2007 - bwalle@suse.de - updated to 1.2.3 o Add the filtering feature for free_pages of linux-2.6.24.