commit libkdumpfile for openSUSE:Factory
Hello community,
here is the log from the commit of package libkdumpfile for openSUSE:Factory checked in at 2015-11-28 15:19:16
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Comparing /work/SRC/openSUSE:Factory/libkdumpfile (Old)
and /work/SRC/openSUSE:Factory/.libkdumpfile.new (New)
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Package is "libkdumpfile"
Changes:
--------
--- /work/SRC/openSUSE:Factory/libkdumpfile/libkdumpfile.changes 2015-08-27 08:56:50.000000000 +0200
+++ /work/SRC/openSUSE:Factory/.libkdumpfile.new/libkdumpfile.changes 2015-11-28 15:19:17.000000000 +0100
@@ -1,0 +2,22 @@
+Thu Nov 26 09:54:56 UTC 2015 - ptesarik@suse.com
+
+- Remove autoreconf invocation (fix build on SLE10).
+
+-------------------------------------------------------------------
+Wed Nov 25 13:29:56 UTC 2015 - ptesarik@suse.com
+
+- Add pkg-config to BuildRequires (adds back zlib support).
+- libkdumpfile-fallback-for-old-zlib.patch: Fall back to
+ AC_SEARCH_LIBS if there is no pkg-config file for zlib.
+
+-------------------------------------------------------------------
+Wed Nov 25 12:50:16 UTC 2015 - ptesarik@suse.cz
+
+- upgrade to libkdumpfile-0.1.5
+ * Improved support of Xen dumpcore files.
+ * Basic support for MIPS architecture.
+ * Fix support for LKCD dumps on s390x.
+- Add libkdumpfile.pc pkg-config file to -devel package.
+- libkdumpfile-remove-ARCH_PPC64LE.patch: Fix build on ppc64le.
+
+-------------------------------------------------------------------
Old:
----
libkdumpfile-0.1.4.tar.bz2
New:
----
libkdumpfile-0.1.5.tar.bz2
libkdumpfile-fallback-for-old-zlib.patch
libkdumpfile-remove-ARCH_PPC64LE.patch
++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
Other differences:
------------------
++++++ libkdumpfile.spec ++++++
--- /var/tmp/diff_new_pack.R6CIR7/_old 2015-11-28 15:19:18.000000000 +0100
+++ /var/tmp/diff_new_pack.R6CIR7/_new 2015-11-28 15:19:18.000000000 +0100
@@ -33,7 +33,7 @@
# End compatibility cruft
Name: libkdumpfile
-Version: 0.1.4
+Version: 0.1.5
Release: 0
Summary: Kernel dump file access library
License: LGPL-3.0+ or GPL-2.0+
@@ -41,8 +41,10 @@
Url: https://github.com/ptesarik/libkdumpfile
Source: https://github.com/ptesarik/libkdumpfile/releases/download/v%version/%name-%...
Patch1: %{name}-add-EM_AARCH64.patch
-BuildRequires: libtool >= 2
+Patch2: %{name}-remove-ARCH_PPC64LE.patch
+Patch3: %{name}-fallback-for-old-zlib.patch
BuildRequires: lzo-devel
+BuildRequires: pkgconfig
BuildRequires: zlib-devel
BuildRoot: %{_tmppath}/%{name}-%{version}-build
%if 0%{?suse_version} < 1030
@@ -81,11 +83,12 @@
%prep
%setup -q
%patch1 -p1
+%patch2 -p1
+%patch3 -p1
+# Avoid autotools recheck after patching config*
+touch aclocal.m4 Makefile.in config.h.in configure
%build
-if [ ! -e configure ]; then
- autoreconf -fiv
-fi
%configure --disable-static
make %{?_smp_mflags}
@@ -106,5 +109,6 @@
%defattr(-,root,root)
%{_libdir}/libkdumpfile.so
%{_includedir}/kdumpfile.h
+%{_libdir}/pkgconfig/libkdumpfile.pc
%changelog
++++++ libkdumpfile-0.1.4.tar.bz2 -> libkdumpfile-0.1.5.tar.bz2 ++++++
++++ 2013 lines of diff (skipped)
++++ retrying with extended exclude list
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/Makefile.am new/libkdumpfile-0.1.5/Makefile.am
--- old/libkdumpfile-0.1.4/Makefile.am 2014-12-05 17:29:35.000000000 +0100
+++ new/libkdumpfile-0.1.5/Makefile.am 2015-11-25 13:17:33.000000000 +0100
@@ -43,7 +43,7 @@
EXTRA_libkdumpfile_la_DEPENDENCIES = libkdumpfile.map
-libkdumpfile_la_LDFLAGS = -version-info 3:0:3
+libkdumpfile_la_LDFLAGS = -version-info 4:0:4
libkdumpfile_la_LDFLAGS += -Wl,--version-script=$(srcdir)/libkdumpfile.map
include_HEADERS = \
@@ -58,3 +58,6 @@
COPYING.LGPLv3 \
README.md \
libkdumpfile.map
+
+pkgconfigdir=$(libdir)/pkgconfig
+pkgconfig_DATA=libkdumpfile.pc
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/NEWS new/libkdumpfile-0.1.5/NEWS
--- old/libkdumpfile-0.1.4/NEWS 2014-12-05 17:27:29.000000000 +0100
+++ new/libkdumpfile-0.1.5/NEWS 2015-11-25 13:16:57.000000000 +0100
@@ -1,3 +1,9 @@
+0.1.5
+-----
+ * improved support of Xen dumpcore files
+ * basic support for MIPS architecture
+ * fix support for LKCD dumps on s390x
+
0.1.4
-----
* support for IA32 (32-bit x86) architecture
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/config.h.in new/libkdumpfile-0.1.5/config.h.in
--- old/libkdumpfile-0.1.4/config.h.in 2014-12-05 17:30:01.000000000 +0100
+++ new/libkdumpfile-0.1.5/config.h.in 2015-11-25 13:20:59.000000000 +0100
@@ -64,7 +64,7 @@
/* Define to enable support for snappy compression using -lsnappy */
#undef USE_SNAPPY
-/* Define to enable support for zlib compression using -lz */
+/* Define to enable support for zlib compression */
#undef USE_ZLIB
/* Version number of package */
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/configure.ac new/libkdumpfile-0.1.5/configure.ac
--- old/libkdumpfile-0.1.4/configure.ac 2014-12-05 17:29:10.000000000 +0100
+++ new/libkdumpfile-0.1.5/configure.ac 2015-11-25 13:17:52.000000000 +0100
@@ -19,7 +19,7 @@
dnl along with this program. If not, see http://www.gnu.org/licenses/.
AC_INIT([Library for reading kernel core dumps],
- [0.1.4],[ptesarik@suse.cz],[libkdumpfile])
+ [0.1.5],[ptesarik@suse.cz],[libkdumpfile])
AC_CONFIG_SRCDIR([diskdump.c])
AC_CONFIG_MACRO_DIR([m4])
@@ -32,13 +32,26 @@
LT_INIT
-kdump_COMPRESSION(zlib, ZLIB, z, uncompress)
+AC_SUBST(REQUIRES_PRIVATE)
+AC_SUBST(LIBS_PRIVATE)
+
+dnl This makes sure pkg.m4 is available.
+m4_pattern_forbid([^_?PKG_[A-Z_]+$],[*** pkg.m4 missing, please install pkg-config])
+
+PKG_CHECK_MODULES(ZLIB, zlib,
+ [ REQUIRES_PRIVATE="zlib $REQUIRES_PRIVATE"
+ AC_DEFINE(USE_ZLIB, 1, [Define to enable support for zlib compression])
+ ],[# ignore if missing])
+AS_VAR_APPEND([CFLAGS], " $ZLIB_CFLAGS")
+AS_VAR_APPEND([LIBS], " $ZLIB_LIBS")
+
kdump_COMPRESSION(lzo, LZO, lzo2, lzo1x_decompress_safe)
kdump_COMPRESSION(snappy, SNAPPY, snappy, snappy_uncompress)
AC_CONFIG_FILES([
Makefile
doc/Makefile
+ libkdumpfile.pc
])
AC_OUTPUT
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/context.c new/libkdumpfile-0.1.5/context.c
--- old/libkdumpfile-0.1.4/context.c 2014-11-28 17:21:04.000000000 +0100
+++ new/libkdumpfile-0.1.5/context.c 2015-07-23 11:50:55.000000000 +0200
@@ -66,9 +66,9 @@
[ARCH_ALPHA] = "alpha",
[ARCH_ARM] = "arm",
[ARCH_IA64] = "ia64",
+ [ARCH_MIPS] = "mips",
[ARCH_PPC] = "ppc",
[ARCH_PPC64] = "ppc64",
- [ARCH_PPC64LE] = "ppc64le",
[ARCH_S390] = "s390",
[ARCH_S390X] = "s390x",
[ARCH_X86] = "i386",
@@ -245,3 +245,11 @@
return vmcoreinfo_symbol(ctx, ctx->vmcoreinfo_xen, symname, symvalue);
}
+
+kdump_get_symbol_val_fn *
+kdump_cb_get_symbol_val(kdump_ctx *ctx, kdump_get_symbol_val_fn *cb)
+{
+ kdump_get_symbol_val_fn *ret = ctx->cb_get_symbol_val;
+ ctx->cb_get_symbol_val = cb ?: kdump_vmcoreinfo_symbol;
+ return ret;
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/diskdump.c new/libkdumpfile-0.1.5/diskdump.c
--- old/libkdumpfile-0.1.4/diskdump.c 2014-12-03 17:18:23.000000000 +0100
+++ new/libkdumpfile-0.1.5/diskdump.c 2015-07-23 12:30:58.000000000 +0200
@@ -150,6 +150,9 @@
struct disk_dump_priv {
unsigned char *bitmap; /* for compressed dumps */
off_t descoff; /* position of page descriptor table */
+
+ void *xen_map;
+ unsigned long xen_map_size;
};
struct setup_data {
@@ -170,6 +173,8 @@
| DUMP_DH_COMPRESSED_SNAPPY \
)
+static const struct format_ops xen_dom0_ops;
+
static void diskdump_cleanup(kdump_ctx *ctx);
static inline int
@@ -209,6 +214,7 @@
if (!page_is_dumpable(ctx, pfn)) {
memset(ctx->page, 0, ctx->page_size);
+ ctx->last_pfn = -(kdump_paddr_t)1;
return kdump_ok;
}
@@ -308,6 +314,166 @@
}
static kdump_status
+diskdump_read_xen_dom0(kdump_ctx *ctx, kdump_pfn_t pfn)
+{
+ struct disk_dump_priv *ddp = ctx->fmtdata;
+ unsigned fpp = ctx->page_size / ctx->ptr_size;
+ uint64_t mfn_idx, frame_idx;
+ kdump_status ret;
+
+ mfn_idx = pfn / fpp;
+ frame_idx = pfn % fpp;
+ if (mfn_idx >= ddp->xen_map_size)
+ return set_error(ctx, kdump_nodata, "Out-of-bounds PFN");
+
+ pfn = (ctx->ptr_size == 8)
+ ? ((uint64_t*)ddp->xen_map)[mfn_idx]
+ : ((uint32_t*)ddp->xen_map)[mfn_idx];
+ ret = diskdump_read_page(ctx, pfn);
+ if (ret != kdump_ok)
+ return set_error(ctx, ret, "Cannot read MFN %llx",
+ (unsigned long long) pfn);
+
+ pfn = (ctx->ptr_size == 8)
+ ? ((uint64_t*)ctx->page)[frame_idx]
+ : ((uint32_t*)ctx->page)[frame_idx];
+ ret = diskdump_read_page(ctx, pfn);
+ return set_error(ctx, ret, "Cannot read MFN %llx",
+ (unsigned long long) pfn);
+}
+
+static kdump_status
+initialize_xen_map64(kdump_ctx *ctx, void *dir)
+{
+ struct disk_dump_priv *ddp = ctx->fmtdata;
+ unsigned fpp = ctx->page_size / ctx->ptr_size;
+ uint64_t *dirp, *p, *map;
+ uint64_t pfn;
+ unsigned long mfns;
+ kdump_status ret;
+
+ mfns = 0;
+ for (dirp = dir, pfn = 0; *dirp && pfn < ctx->max_pfn;
+ ++dirp, pfn += fpp * fpp) {
+ ret = diskdump_read_page(ctx, *dirp);
+ if (ret == kdump_nodata)
+ ret = kdump_dataerr;
+ if (ret != kdump_ok)
+ return set_error(ctx, ret,
+ "Cannot read Xen P2M map MFN 0x%llx",
+ (unsigned long long) *dirp);
+
+ for (p = ctx->page; (void*)p < ctx->page + ctx->page_size; ++p)
+ if (*p)
+ ++mfns;
+ }
+
+ map = ctx_malloc(mfns * sizeof(uint64_t), ctx, "Xen P2M map");
+ if (!map)
+ return kdump_syserr;
+ ddp->xen_map = map;
+ ddp->xen_map_size = mfns;
+
+ for (dirp = dir; mfns; ++dirp) {
+ ret = diskdump_read_page(ctx, *dirp);
+ if (ret == kdump_nodata)
+ ret = kdump_dataerr;
+ if (ret != kdump_ok)
+ return set_error(ctx, ret,
+ "Cannot read Xen P2M map MFN 0x%llx",
+ (unsigned long long) *dirp);
+
+ for (p = ctx->page; (void*)p < ctx->page + ctx->page_size; ++p)
+ if (*p) {
+ *map++ = dump64toh(ctx, *p);
+ --mfns;
+ }
+ }
+
+ return kdump_ok;
+}
+
+static kdump_status
+initialize_xen_map32(kdump_ctx *ctx, void *dir)
+{
+ struct disk_dump_priv *ddp = ctx->fmtdata;
+ unsigned fpp = ctx->page_size / ctx->ptr_size;
+ uint32_t *dirp, *p, *map;
+ uint32_t pfn;
+ unsigned long mfns;
+ kdump_status ret;
+
+ mfns = 0;
+ for (dirp = dir, pfn = 0; *dirp && pfn < ctx->max_pfn;
+ ++dirp, pfn += fpp * fpp) {
+ ret = diskdump_read_page(ctx, *dirp);
+ if (ret == kdump_nodata)
+ ret = kdump_dataerr;
+ if (ret != kdump_ok)
+ return set_error(ctx, ret,
+ "Cannot read Xen P2M map MFN 0x%llx",
+ (unsigned long long) *dirp);
+
+ for (p = ctx->page; (void*)p < ctx->page + ctx->page_size; ++p)
+ if (*p)
+ ++mfns;
+ }
+
+ map = ctx_malloc(mfns * sizeof(uint32_t), ctx, "Xen P2M map");
+ if (!map)
+ return kdump_syserr;
+ ddp->xen_map = map;
+ ddp->xen_map_size = mfns;
+
+ for (dirp = dir; mfns; ++dirp) {
+ ret = diskdump_read_page(ctx, *dirp);
+ if (ret == kdump_nodata)
+ ret = kdump_dataerr;
+ if (ret != kdump_ok)
+ return set_error(ctx, ret,
+ "Cannot read Xen P2M map MFN 0x%llx",
+ (unsigned long long) *dirp);
+
+ for (p = ctx->page; (void*)p < ctx->page + ctx->page_size; ++p)
+ if (*p) {
+ *map++ = dump32toh(ctx, *p);
+ --mfns;
+ }
+ }
+
+ return kdump_ok;
+}
+
+static kdump_status
+initialize_xen_map(kdump_ctx *ctx)
+{
+ void *dir, *page;
+ kdump_status ret;
+
+ ret = diskdump_read_page(ctx, ctx->xen_p2m_mfn);
+ if (ret != kdump_ok)
+ return set_error(ctx, ret,
+ "Cannot read Xen P2M directory MFN 0x%llx",
+ (unsigned long long) ctx->xen_p2m_mfn);
+
+ dir = ctx->page;
+ page = ctx_malloc(ctx->page_size, ctx, "page buffer");
+ if (page == NULL)
+ return kdump_syserr;
+ ctx->page = page;
+
+ ret = (ctx->ptr_size == 8)
+ ? initialize_xen_map64(ctx, dir)
+ : initialize_xen_map32(ctx, dir);
+
+ if (ret == kdump_ok)
+ ctx->ops = &xen_dom0_ops;
+
+ free(dir);
+ return ret;
+}
+
+static kdump_status
read_vmcoreinfo(kdump_ctx *ctx, off_t off, size_t size)
{
void *info;
@@ -657,6 +823,12 @@
if (ret != kdump_ok)
goto err_cleanup;
+ if (ctx->xen_p2m_mfn) {
+ ret = initialize_xen_map(ctx);
+ if (ret != kdump_ok)
+ return ret;
+ }
+
return ret;
err_cleanup:
@@ -699,3 +871,9 @@
.read_page = diskdump_read_page,
.cleanup = diskdump_cleanup,
};
+
+static const struct format_ops xen_dom0_ops = {
+ .read_page = diskdump_read_xen_dom0,
+ .read_xenmach_page = diskdump_read_page,
+ .cleanup = diskdump_cleanup,
+};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/elfdump.c new/libkdumpfile-0.1.5/elfdump.c
--- old/libkdumpfile-0.1.4/elfdump.c 2014-11-28 17:17:52.000000000 +0100
+++ new/libkdumpfile-0.1.5/elfdump.c 2015-03-30 10:31:26.000000000 +0200
@@ -93,6 +93,7 @@
case EM_FAKE_ALPHA:
return ARCH_ALPHA;
case EM_IA_64: return ARCH_IA64;
+ case EM_MIPS: return ARCH_MIPS;
case EM_PPC: return ARCH_PPC;
case EM_PPC64: return ARCH_PPC64;
case EM_S390: return ARCH_S390;
@@ -173,7 +174,7 @@
}
static unsigned long
-pfn_to_mfn(struct elfdump_priv *edp, unsigned long pfn)
+pfn_to_idx(struct elfdump_priv *edp, kdump_pfn_t pfn)
{
unsigned long i;
@@ -193,19 +194,78 @@
}
static kdump_status
-elf_read_xen_domU(kdump_ctx *ctx, unsigned long pfn)
+elf_read_xen_domU(kdump_ctx *ctx, kdump_pfn_t pfn)
{
struct elfdump_priv *edp = ctx->fmtdata;
- unsigned long mfn;
+ unsigned long idx;
off_t offset;
ssize_t rd;
- if ((mfn = pfn_to_mfn(edp, pfn)) == ~0UL)
+ idx = pfn_to_idx(edp, pfn);
+ if (idx == ~0UL)
return set_error(ctx, kdump_nodata,
"No machine address for PFN: 0x%llx",
(unsigned long long) pfn);
- offset = edp->xen_pages_offset + (off_t)mfn * ctx->page_size;
+ offset = edp->xen_pages_offset + (off_t)idx * ctx->page_size;
+ rd = pread(ctx->fd, ctx->page, ctx->page_size, offset);
+ if (rd != ctx->page_size)
+ return set_error(ctx, read_error(rd),
+ "Cannot read page data at %llu: %s",
+ (unsigned long long) offset,
+ read_err_str(rd));
+
+ return 0;
+}
+
+static unsigned long
+mfn_to_idx(struct elfdump_priv *edp, kdump_pfn_t mfn)
+{
+ unsigned long i;
+
+ if (edp->xen_map_type == xen_map_p2m) {
+ struct xen_p2m *p = edp->xen_map;
+ for (i = 0; i < edp->xen_map_size; ++i, ++p)
+ if (p->gmfn == mfn)
+ return i;
+ }
+
+ return ~0UL;
+}
+
+static kdump_status
+elf_mfn_to_pfn(kdump_ctx *ctx, kdump_pfn_t mfn, kdump_pfn_t *pfn)
+{
+ struct elfdump_priv *edp = ctx->fmtdata;
+ unsigned long i;
+
+ if (edp->xen_map_type == xen_map_p2m) {
+ struct xen_p2m *p = edp->xen_map;
+ for (i = 0; i < edp->xen_map_size; ++i, ++p)
+ if (p->gmfn == mfn) {
+ *pfn = p->pfn;
+ return kdump_ok;
+ }
+ } else
+ return set_error(ctx, kdump_unsupported,
+ "No MFN-to-PFN translation table");
+
+ return set_error(ctx, kdump_nodata, "MFN not found");
+}
+
+static kdump_status
+elf_read_xenmach_domU(kdump_ctx *ctx, kdump_pfn_t mfn)
+{
+ struct elfdump_priv *edp = ctx->fmtdata;
+ unsigned long idx;
+ off_t offset;
+ ssize_t rd;
+
+ idx = mfn_to_idx(edp, mfn);
+ if (idx == ~0UL)
+ return set_error(ctx, kdump_nodata, "Page not found");
+
+ offset = edp->xen_pages_offset + (off_t)idx * ctx->page_size;
rd = pread(ctx->fd, ctx->page, ctx->page_size, offset);
if (rd != ctx->page_size)
return set_error(ctx, read_error(rd),
@@ -486,7 +546,7 @@
unsigned fpp = ctx->page_size / ctx->ptr_size;
uint64_t *dirp, *p, *map;
uint64_t pfn;
- unsigned mfns;
+ unsigned long mfns;
kdump_status ret;
mfns = 0;
@@ -537,7 +597,7 @@
unsigned fpp = ctx->page_size / ctx->ptr_size;
uint32_t *dirp, *p, *map;
uint32_t pfn;
- unsigned mfns;
+ unsigned long mfns;
kdump_status ret;
mfns = 0;
@@ -705,6 +765,7 @@
strerror(errno));
edp->xen_map_type = xen_map_p2m;
edp->xen_map_size = sect->size /sizeof(struct xen_p2m);
+ ctx->xen_pte_is_mach = 1;
} else if (!strcmp(name, ".xen_pfn")) {
edp->xen_map = read_elf_sect(ctx, sect);
if (!edp->xen_map)
@@ -712,6 +773,17 @@
strerror(errno));
edp->xen_map_type = xen_map_pfn;
edp->xen_map_size = sect->size / sizeof(uint64_t);
+ ctx->xen_pte_is_mach = 0;
+ } else if (!strcmp(name, ".note.Xen")) {
+ notes = read_elf_sect(ctx, sect);
+ if (!notes)
+ return set_error(ctx, kdump_syserr,
+ strerror(errno));
+ ret = process_notes(ctx, notes, sect->size);
+ free(notes);
+ if (ret != kdump_ok)
+ return set_error(ctx, ret,
+ "Cannot process Xen notes");
}
}
@@ -815,6 +887,7 @@
static const struct format_ops xen_domU_ops = {
.read_page = elf_read_xen_domU,
- .read_xenmach_page = elf_read_page,
+ .read_xenmach_page = elf_read_xenmach_domU,
+ .mfn_to_pfn = elf_mfn_to_pfn,
.cleanup = elf_cleanup,
};
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/ia32.c new/libkdumpfile-0.1.5/ia32.c
--- old/libkdumpfile-0.1.4/ia32.c 2014-11-28 17:14:24.000000000 +0100
+++ new/libkdumpfile-0.1.5/ia32.c 2015-03-26 18:27:03.000000000 +0100
@@ -214,7 +214,7 @@
kdump_status ret;
size_t sz;
- ret = kdump_vmcoreinfo_symbol(ctx, "swapper_pg_dir", &pgtaddr);
+ ret = get_symbol_val(ctx, "swapper_pg_dir", &pgtaddr);
if (ret != kdump_ok)
return ret;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/kdumpfile-priv.h new/libkdumpfile-0.1.5/kdumpfile-priv.h
--- old/libkdumpfile-0.1.4/kdumpfile-priv.h 2014-12-04 11:05:34.000000000 +0100
+++ new/libkdumpfile-0.1.5/kdumpfile-priv.h 2015-07-23 11:50:55.000000000 +0200
@@ -55,9 +55,9 @@
ARCH_ALPHA,
ARCH_ARM,
ARCH_IA64,
+ ARCH_MIPS,
ARCH_PPC,
ARCH_PPC64,
- ARCH_PPC64LE,
ARCH_S390,
ARCH_S390X,
ARCH_X86,
@@ -107,6 +107,14 @@
*/
kdump_status (*read_xenmach_page)(kdump_ctx *, kdump_pfn_t);
+ /* Translate a machine frame number to physical frame number.
+ * ctx->fmtdata initialized in probe()
+ * Return:
+ * kdump_ok output variable contains translated PFN
+ * kdump_nodata given MFN was not found
+ */
+ kdump_status (*mfn_to_pfn)(kdump_ctx *, kdump_pfn_t, kdump_pfn_t *);
+
/* Clean up all private data.
*/
void (*cleanup)(kdump_ctx *);
@@ -230,10 +238,13 @@
kdump_xen_version_t xen_ver; /* Xen hypervisor version */
kdump_vaddr_t xen_extra_ver;
kdump_pfn_t xen_p2m_mfn;
+ int xen_pte_is_mach;
void *fmtdata; /* format-specific private data */
void *archdata; /* arch-specific private data */
+ kdump_get_symbol_val_fn *cb_get_symbol_val;
+
char *err_str; /* error string */
char err_buf[ERRBUF]; /* buffer for error string */
};
@@ -338,6 +349,10 @@
#define cksum32 INTERNAL_NAME(cksum32)
uint32_t cksum32(void *buffer, size_t size, uint32_t csum);
+#define get_symbol_val INTERNAL_NAME(get_symbol_val)
+kdump_status get_symbol_val(kdump_ctx *ctx, const char *name,
+ kdump_addr_t *val);
+
/* ELF notes */
#define process_notes INTERNAL_NAME(process_notes)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/kdumpfile.h new/libkdumpfile-0.1.5/kdumpfile.h
--- old/libkdumpfile-0.1.4/kdumpfile.h 2014-12-04 19:01:07.000000000 +0100
+++ new/libkdumpfile-0.1.5/kdumpfile.h 2015-07-23 11:50:56.000000000 +0200
@@ -294,9 +294,9 @@
* - arm
* - i386
* - ia64
+ * - mips
* - ppc
* - ppc64
- * - ppc64le
* - s390
* - s390x
* - x86_64
@@ -467,6 +467,25 @@
*/
void kdump_xen_version(kdump_ctx *ctx, kdump_xen_version_t *version);
+/** Type for the get_symbol_val callback function.
+ * @param ctx Dump file object of the caller.
+ * @param[in] name Name of the symbol.
+ * @param[out] val Symbol value.
+ * @returns Error status.
+ *
+ * This type is used for @ref kdump_cb_get_symbol_val.
+ */
+typedef kdump_status kdump_get_symbol_val_fn(
+ kdump_ctx *ctx, const char *name, kdump_addr_t *val);
+
+/** Set the get_symbol_val callback
+ * @param ctx Dump file object.
+ * @param cb New callback function.
+ * @return the Previous callback function.
+ */
+kdump_get_symbol_val_fn *
+kdump_cb_get_symbol_val(kdump_ctx *ctx, kdump_get_symbol_val_fn *cb);
+
#ifdef __cplusplus
}
#endif
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/libkdumpfile.map new/libkdumpfile-0.1.5/libkdumpfile.map
--- old/libkdumpfile-0.1.4/libkdumpfile.map 2014-12-03 17:49:52.000000000 +0100
+++ new/libkdumpfile-0.1.5/libkdumpfile.map 2015-07-23 11:50:56.000000000 +0200
@@ -34,6 +34,7 @@
kdump_vmcoreinfo_symbol;
kdump_vmcoreinfo_symbol_xen;
kdump_xen_version;
+ kdump_cb_get_symbol_val;
local:
*;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/libkdumpfile.pc.in new/libkdumpfile-0.1.5/libkdumpfile.pc.in
--- old/libkdumpfile-0.1.4/libkdumpfile.pc.in 1970-01-01 01:00:00.000000000 +0100
+++ new/libkdumpfile-0.1.5/libkdumpfile.pc.in 2015-09-24 09:53:41.000000000 +0200
@@ -0,0 +1,15 @@
+prefix=@prefix@
+exec_prefix=@exec_prefix@
+libdir=@libdir@
+includedir=@includedir@
+
+Name: libkdumpfile
+Description: Kernel coredump file access
+URL: https://github.com/ptesarik/libkdumpfile
+Version: @VERSION@
+
+Requires:
+Requires.private: @REQUIRES_PRIVATE@
+Libs: -L${libdir} -lkdumpfile
+Libs.private: @LIBS_PRIVATE@
+Cflags: -I${includedir}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/lkcd.c new/libkdumpfile-0.1.5/lkcd.c
--- old/libkdumpfile-0.1.4/lkcd.c 2014-11-28 17:15:04.000000000 +0100
+++ new/libkdumpfile-0.1.5/lkcd.c 2015-11-24 21:00:31.000000000 +0100
@@ -317,6 +317,8 @@
char format[MAX_FORMAT_NAME];
};
+static void lkcd_cleanup(kdump_ctx *ctx);
+
static off_t
find_page(kdump_ctx *ctx, off_t off, unsigned pfn, struct dump_page *dp)
{
@@ -656,10 +658,6 @@
if (ret != kdump_ok)
goto err_free;
- ret = set_arch(ctx, machine_arch(ctx->utsname.machine));
- if (ret != kdump_ok)
- goto err_free;
-
max_idx1 = pfn_idx1(ctx->max_pfn - 1) + 1;
lkcdp->pfn_level1 = calloc(max_idx1, sizeof(struct pfn_level2*));
if (!lkcdp->pfn_level1) {
@@ -669,10 +667,14 @@
goto err_free;
}
+ ret = set_arch(ctx, machine_arch(ctx->utsname.machine));
+ if (ret != kdump_ok)
+ goto err_free;
+
return kdump_ok;
err_free:
- free(lkcdp);
+ lkcd_cleanup(ctx);
return ret;
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/m4/compression.m4 new/libkdumpfile-0.1.5/m4/compression.m4
--- old/libkdumpfile-0.1.4/m4/compression.m4 2014-10-30 10:48:33.000000000 +0100
+++ new/libkdumpfile-0.1.5/m4/compression.m4 2015-09-24 10:10:35.000000000 +0200
@@ -7,6 +7,7 @@
[AC_SEARCH_LIBS([$4],[$3],
[AC_DEFINE(USE_$2, 1,
[Define to enable support for $1 compression using -l$3])
+ AS_VAR_APPEND(LIBS_PRIVATE, " -l$3")
],[
if test "x$with_$1" != xcheck; then
AC_MSG_FAILURE([--with-$1 was given, but test for $1 failed])
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/m4/libtool.m4 new/libkdumpfile-0.1.5/m4/libtool.m4
--- old/libkdumpfile-0.1.4/m4/libtool.m4 2014-12-05 17:11:38.000000000 +0100
+++ new/libkdumpfile-0.1.5/m4/libtool.m4 2015-09-24 10:10:51.000000000 +0200
@@ -1312,7 +1312,7 @@
rm -rf conftest*
;;
-x86_64-*kfreebsd*-gnu|x86_64-*linux*|ppc*-*linux*|powerpc*-*linux*| \
+x86_64-*kfreebsd*-gnu|x86_64-*linux*|powerpc*-*linux*| \
s390*-*linux*|s390*-*tpf*|sparc*-*linux*)
# Find out which ABI we are using.
echo 'int i;' > conftest.$ac_ext
@@ -1326,7 +1326,10 @@
x86_64-*linux*)
LD="${LD-ld} -m elf_i386"
;;
- ppc64-*linux*|powerpc64-*linux*)
+ powerpc64le-*linux*)
+ LD="${LD-ld} -m elf32lppclinux"
+ ;;
+ powerpc64-*linux*)
LD="${LD-ld} -m elf32ppclinux"
;;
s390x-*linux*)
@@ -1345,7 +1348,10 @@
x86_64-*linux*)
LD="${LD-ld} -m elf_x86_64"
;;
- ppc*-*linux*|powerpc*-*linux*)
+ powerpcle-*linux*)
+ LD="${LD-ld} -m elf64lppc"
+ ;;
+ powerpc-*linux*)
LD="${LD-ld} -m elf64ppc"
;;
s390*-*linux*|s390*-*tpf*)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/notes.c new/libkdumpfile-0.1.5/notes.c
--- old/libkdumpfile-0.1.4/notes.c 2014-11-28 16:02:16.000000000 +0100
+++ new/libkdumpfile-0.1.5/notes.c 2015-11-24 23:44:46.000000000 +0100
@@ -74,6 +74,50 @@
/* Additional arch-dependent and version-dependent fields */
};
+#define XEN_EXTRA_VERSION_SZ 16
+#define XEN_COMPILER_SZ 64
+#define XEN_COMPILE_BY_SZ 16
+#define XEN_COMPLE_DOMAIN_SZ 32
+#define XEN_COMPILE_DATE_SZ 32
+#define XEN_CAPABILITIES_SZ 1024
+#define XEN_CHANGESET_SZ 64
+
+struct xen_dumpcore_elfnote_xen_version_32 {
+ uint64_t major_version;
+ uint64_t minor_version;
+ char extra_version[XEN_EXTRA_VERSION_SZ];
+ struct {
+ char compiler[XEN_COMPILER_SZ];
+ char compile_by[XEN_COMPILE_BY_SZ];
+ char compile_domain[XEN_COMPLE_DOMAIN_SZ];
+ char compile_date[XEN_COMPILE_DATE_SZ];
+ } compile_info;
+ char capabilities[XEN_CAPABILITIES_SZ];
+ char changeset[XEN_CHANGESET_SZ];
+ struct {
+ uint32_t virt_start;
+ } platform_parameters;
+ uint64_t pagesize;
+};
+
+struct xen_dumpcore_elfnote_xen_version_64 {
+ uint64_t major_version;
+ uint64_t minor_version;
+ char extra_version[XEN_EXTRA_VERSION_SZ];
+ struct {
+ char compiler[XEN_COMPILER_SZ];
+ char compile_by[XEN_COMPILE_BY_SZ];
+ char compile_domain[XEN_COMPLE_DOMAIN_SZ];
+ char compile_date[XEN_COMPILE_DATE_SZ];
+ } compile_info;
+ char capabilities[XEN_CAPABILITIES_SZ];
+ char changeset[XEN_CHANGESET_SZ];
+ struct {
+ uint64_t virt_start;
+ } platform_parameters;
+ uint64_t pagesize;
+};
+
typedef kdump_status do_note_fn(kdump_ctx *ctx, Elf32_Word type,
const char *name, size_t namesz,
void *desc, size_t descsz);
@@ -100,7 +144,7 @@
* endian
* ptr_size
*/
-static void
+static kdump_status
process_xen_crash_info(kdump_ctx *ctx, void *data, size_t len)
{
unsigned words = len / ctx->ptr_size;
@@ -120,6 +164,41 @@
ctx->xen_extra_ver = dump32toh(ctx, info->xen_extra_version);
ctx->xen_p2m_mfn = dump32toh(ctx, ((uint32_t*)data)[words-1]);
}
+
+ return kdump_ok;
+}
+
+static kdump_status
+process_xen_dumpcore_version(kdump_ctx *ctx, void *data, size_t len)
+{
+ const char *ver_extra = NULL;
+
+ if (ctx->ptr_size == 8 &&
+ len >= sizeof(struct xen_dumpcore_elfnote_xen_version_64)) {
+ struct xen_dumpcore_elfnote_xen_version_64 *ver = data;
+ ctx->xen_ver.major = dump64toh(ctx, ver->major_version);
+ ctx->xen_ver.minor = dump64toh(ctx, ver->minor_version);
+ ver_extra = ver->extra_version;
+ } else if(ctx->ptr_size == 4 &&
+ len >= sizeof(struct xen_dumpcore_elfnote_xen_version_32)) {
+ struct xen_dumpcore_elfnote_xen_version_32 *ver = data;
+ ctx->xen_ver.major = dump64toh(ctx, ver->major_version);
+ ctx->xen_ver.minor = dump64toh(ctx, ver->minor_version);
+ ver_extra = ver->extra_version;
+ }
+
+ if (ver_extra) {
+ char *newextra;
+ newextra = ctx_malloc(XEN_EXTRA_VERSION_SZ + 1,
+ ctx, "Xen extra version");
+ if (!newextra)
+ return kdump_syserr;
+ memcpy(newextra, ver_extra, XEN_EXTRA_VERSION_SZ);
+ newextra[XEN_EXTRA_VERSION_SZ] = '\0';
+ ctx->xen_ver.extra = newextra;
+ }
+
+ return kdump_ok;
}
/* These fields in kdump_ctx must be initialised:
@@ -127,14 +206,19 @@
* endian
* ptr_size
*/
-static void
+static kdump_status
process_xen_note(kdump_ctx *ctx, uint32_t type,
void *desc, size_t descsz)
{
+ kdump_status ret = kdump_ok;
+
if (type == XEN_ELFNOTE_CRASH_INFO)
- process_xen_crash_info(ctx, desc, descsz);
+ ret = process_xen_crash_info(ctx, desc, descsz);
+ else if (type == XEN_ELFNOTE_DUMPCORE_XEN_VERSION)
+ process_xen_dumpcore_version(ctx, desc, descsz);
ctx->flags |= DIF_XEN;
+ return ret;
}
/* These fields in kdump_ctx must be initialised:
@@ -228,7 +312,7 @@
if (note_equal("CORE", name, namesz))
return process_core_note(ctx, type, desc, descsz);
else if (note_equal("Xen", name, namesz))
- process_xen_note(ctx, type, desc, descsz);
+ return process_xen_note(ctx, type, desc, descsz);
else if (note_equal(".note.Xen", name, namesz))
return process_xc_xen_note(ctx, type, desc, descsz);
@@ -247,6 +331,8 @@
return do_arch_note(ctx, type, name, namesz, desc, descsz);
}
+#define roundup_size(sz) (((size_t)(sz)+3) & ~(size_t)3)
+
static kdump_status
do_notes(kdump_ctx *ctx, void *data, size_t size, do_note_fn *do_note)
{
@@ -258,15 +344,19 @@
Elf32_Word namesz = dump32toh(ctx, hdr->n_namesz);
Elf32_Word descsz = dump32toh(ctx, hdr->n_descsz);
Elf32_Word type = dump32toh(ctx, hdr->n_type);
- size_t descoff = sizeof(Elf32_Nhdr) + ((namesz + 3) & ~3);
+ size_t descoff = sizeof(Elf32_Nhdr) + roundup_size(namesz);
- if (size < descoff + ((descsz + 3) & ~3))
+ if (size < descoff + descsz)
break;
- size -= descoff + ((descsz + 3) & ~3);
name = (char*) (hdr + 1);
desc = (char*)hdr + descoff;
- hdr = (Elf32_Nhdr*) (desc + ((descsz + 3) & ~3));
+ size -= descoff;
+
+ hdr = (Elf32_Nhdr*) (desc + roundup_size(descsz));
+ size = (size >= roundup_size(descsz))
+ ? size - roundup_size(descsz)
+ : 0;
ret = do_note(ctx, type, name, namesz, desc, descsz);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/open.c new/libkdumpfile-0.1.5/open.c
--- old/libkdumpfile-0.1.4/open.c 2014-12-03 18:05:49.000000000 +0100
+++ new/libkdumpfile-0.1.5/open.c 2015-11-24 21:20:11.000000000 +0100
@@ -63,6 +63,7 @@
return NULL;
ctx->last_pfn = -(kdump_paddr_t)1;
+ ctx->cb_get_symbol_val = kdump_vmcoreinfo_symbol;
return ctx;
}
@@ -157,7 +158,7 @@
size_t rd;
kdump_status ret;
- ret = kdump_vmcoreinfo_symbol(ctx, "init_uts_ns", &init_uts_ns);
+ ret = get_symbol_val(ctx, "init_uts_ns", &init_uts_ns);
if (ret != kdump_ok)
return ret;
@@ -184,7 +185,7 @@
size_t rd;
kdump_status ret;
- ret = kdump_vmcoreinfo_symbol(ctx, "system_utsname", &uts_name);
+ ret = get_symbol_val(ctx, "system_utsname", &uts_name);
if (ret == kdump_nodata) {
clear_error(ctx);
ret = uts_name_from_init_uts_ns(ctx, &uts_name);
@@ -261,5 +262,7 @@
free(ctx->vmcoreinfo);
if (ctx->vmcoreinfo_xen)
free(ctx->vmcoreinfo_xen);
+ if (ctx->xen_ver.extra)
+ free((void*)ctx->xen_ver.extra);
free(ctx);
}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/s390x.c new/libkdumpfile-0.1.5/s390x.c
--- old/libkdumpfile-0.1.4/s390x.c 2014-12-04 12:59:26.000000000 +0100
+++ new/libkdumpfile-0.1.5/s390x.c 2015-03-26 18:27:30.000000000 +0100
@@ -274,7 +274,7 @@
return ret;
}
- ret = kdump_vmcoreinfo_symbol(ctx, "high_memory", &addr);
+ ret = get_symbol_val(ctx, "high_memory", &addr);
if (ret == kdump_ok) {
uint64_t highmem;
size_t sz = sizeof(highmem);
@@ -466,7 +466,7 @@
process_lowcore_info(ctx);
clear_error(ctx);
- ret = kdump_vmcoreinfo_symbol(ctx, "swapper_pg_dir", &pgtaddr);
+ ret = get_symbol_val(ctx, "swapper_pg_dir", &pgtaddr);
if (ret == kdump_ok) {
ret = read_pgt(ctx, pgtaddr);
if (ret != kdump_ok)
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/util.c new/libkdumpfile-0.1.5/util.c
--- old/libkdumpfile-0.1.4/util.c 2014-12-04 11:05:52.000000000 +0100
+++ new/libkdumpfile-0.1.5/util.c 2015-07-23 11:50:56.000000000 +0200
@@ -103,13 +103,13 @@
case ARCH_ALPHA:
case ARCH_IA64:
case ARCH_PPC64:
- case ARCH_PPC64LE:
case ARCH_S390X:
case ARCH_X86_64:
return 8; /* 64 bits */
case ARCH_ARM:
case ARCH_PPC:
+ case ARCH_MIPS:
case ARCH_S390:
case ARCH_X86:
default:
@@ -125,12 +125,13 @@
return ARCH_ALPHA;
else if (!strcmp(machine, "ia64"))
return ARCH_IA64;
+ else if (!strcmp(machine, "mips"))
+ return ARCH_MIPS;
else if (!strcmp(machine, "ppc"))
return ARCH_PPC;
- else if (!strcmp(machine, "ppc64"))
+ else if (!strcmp(machine, "ppc64") ||
+ !strcmp(machine, "ppc64le"))
return ARCH_PPC64;
- else if (!strcmp(machine, "ppc64le"))
- return ARCH_PPC64LE;
else if (!strcmp(machine, "s390"))
return ARCH_S390;
else if (!strcmp(machine, "s390x"))
@@ -158,9 +159,9 @@
[ARCH_ALPHA]= 13,
[ARCH_ARM] = 12,
[ARCH_IA64] = 0,
+ [ARCH_MIPS] = 12,
[ARCH_PPC] = 0,
[ARCH_PPC64] = 0,
- [ARCH_PPC64LE] = 0,
[ARCH_S390] = 12,
[ARCH_S390X] = 12,
[ARCH_X86] = 12,
@@ -180,9 +181,9 @@
case ARCH_ALPHA:
case ARCH_ARM:
case ARCH_IA64:
+ case ARCH_MIPS:
case ARCH_PPC:
case ARCH_PPC64:
- case ARCH_PPC64LE:
case ARCH_S390:
/* TODO */
break;
@@ -446,3 +447,10 @@
return csum;
}
+
+kdump_status
+get_symbol_val(kdump_ctx *ctx, const char *name, kdump_addr_t *val)
+{
+ kdump_status ret = ctx->cb_get_symbol_val(ctx, name, val);
+ return set_error(ctx, ret, "Cannot resolve \"%s\"", name);
+}
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/vtop.c new/libkdumpfile-0.1.5/vtop.c
--- old/libkdumpfile-0.1.4/vtop.c 2014-11-28 16:31:26.000000000 +0100
+++ new/libkdumpfile-0.1.5/vtop.c 2015-03-30 11:02:05.000000000 +0200
@@ -182,7 +182,6 @@
"VTOP translation not initialized");
return ctx->arch_ops->vtop(ctx, vaddr, paddr);
- /* fall through */
case KDUMP_XLAT_DIRECT:
*paddr = vaddr - phys_off;
return kdump_ok;
diff -urN '--exclude=CVS' '--exclude=.cvsignore' '--exclude=.svn' '--exclude=.svnignore' --exclude Makefile.in --exclude configure --exclude config.guess --exclude '*.pot' --exclude mkinstalldirs --exclude aclocal.m4 --exclude config.sub --exclude depcomp --exclude install-sh --exclude ltmain.sh old/libkdumpfile-0.1.4/x86_64.c new/libkdumpfile-0.1.5/x86_64.c
--- old/libkdumpfile-0.1.4/x86_64.c 2014-11-28 17:17:33.000000000 +0100
+++ new/libkdumpfile-0.1.5/x86_64.c 2015-10-05 11:41:51.000000000 +0200
@@ -296,7 +296,7 @@
kdump_status ret;
size_t sz;
- ret = kdump_vmcoreinfo_symbol(ctx, "init_level4_pgt", &pgtaddr);
+ ret = get_symbol_val(ctx, "init_level4_pgt", &pgtaddr);
if (ret != kdump_ok)
return ret;
@@ -446,6 +446,8 @@
"Out-of-bounds register number: %u (max %u)",
index, ELF_NGREG);
+ cpu = ctx->num_cpus - cpu - 1;
+
for (i = 0, cs = archdata->cpu_state; i < cpu && cs; ++i)
cs = cs->next;
if (!cs)
@@ -488,7 +490,8 @@
}
static kdump_status
-x86_64_vtop(kdump_ctx *ctx, kdump_vaddr_t vaddr, kdump_paddr_t *paddr)
+x86_64_pt_walk(kdump_ctx *ctx, kdump_vaddr_t vaddr, kdump_paddr_t *paddr,
+ int rdflags)
{
struct x86_64_data *archdata = ctx->archdata;
uint64_t tbl[PTRS_PER_PAGE];
@@ -511,7 +514,7 @@
base = pgd & ~PHYSADDR_MASK & PAGE_MASK;
sz = PAGE_SIZE;
- ret = kdump_readp(ctx, base, tbl, &sz, KDUMP_PHYSADDR);
+ ret = kdump_readp(ctx, base, tbl, &sz, rdflags);
if (ret != kdump_ok)
return ret;
@@ -530,7 +533,7 @@
base = pud & ~PHYSADDR_MASK & PAGE_MASK;
sz = PAGE_SIZE;
- ret = kdump_readp(ctx, base, tbl, &sz, KDUMP_PHYSADDR);
+ ret = kdump_readp(ctx, base, tbl, &sz, rdflags);
if (ret != kdump_ok)
return ret;
@@ -548,7 +551,7 @@
base = pmd & ~PHYSADDR_MASK & PAGE_MASK;
sz = PAGE_SIZE;
- ret = kdump_readp(ctx, base, tbl, &sz, KDUMP_PHYSADDR);
+ ret = kdump_readp(ctx, base, tbl, &sz, rdflags);
if (ret != kdump_ok)
return ret;
@@ -564,6 +567,38 @@
return kdump_ok;
}
+static kdump_status
+x86_64_vtop(kdump_ctx *ctx, kdump_vaddr_t vaddr, kdump_paddr_t *paddr)
+{
+ kdump_status ret;
+
+ if (ctx->flags & DIF_XEN && ctx->xen_pte_is_mach) {
+ kdump_addr_t maddr;
+ kdump_pfn_t mfn, pfn;
+
+ if (!ctx->ops->mfn_to_pfn)
+ return set_error(ctx, kdump_nodata,
+ "No MFN-to-PFN translation method");
+
+ ret = x86_64_pt_walk(ctx, vaddr, &maddr, KDUMP_XENMACHADDR);
+ if (ret != kdump_ok)
+ return ret;
+
+ mfn = maddr >> ctx->page_shift;
+ ret = ctx->ops->mfn_to_pfn(ctx, mfn, &pfn);
+ if (ret != kdump_ok)
+ return set_error(ctx, ret,
+ "Cannot translate MFN 0x%llx",
+ (unsigned long long) mfn);
+
+ *paddr = (pfn << ctx->page_shift) |
+ (maddr & (ctx->page_size - 1));
+ return kdump_ok;
+ }
+
+ return x86_64_pt_walk(ctx, vaddr, paddr, KDUMP_PHYSADDR);
+}
+
const struct arch_ops x86_64_ops = {
.init = x86_64_init,
.vtop_init = x86_64_vtop_init,
++++++ libkdumpfile-fallback-for-old-zlib.patch ++++++
From: Petr Tesarik
participants (1)
-
root@hilbert.suse.de