aboutsummaryrefslogtreecommitdiffstats
path: root/sysutils
diff options
context:
space:
mode:
authorroyger <royger@FreeBSD.org>2015-06-19 18:41:31 +0800
committerroyger <royger@FreeBSD.org>2015-06-19 18:41:31 +0800
commit838c970c305c34fa659546f6369d63044006c59f (patch)
tree47f0ac38fc4f44b491495d1bd5d78a627ff644fb /sysutils
parent1612a2844a2ca17dfcb64df3d470f3f149c4fc98 (diff)
downloadfreebsd-ports-gnome-838c970c305c34fa659546f6369d63044006c59f.tar.gz
freebsd-ports-gnome-838c970c305c34fa659546f6369d63044006c59f.tar.zst
freebsd-ports-gnome-838c970c305c34fa659546f6369d63044006c59f.zip
xen: add two symtab/strtab loading fixes from upstream
Those are upstream commits: 06ee60 libxc: fix xc_dom_load_elf_symtab 90b18f libelf: fix elf_parse_bsdsyms call Reviewed by: bapt Sponsored by: Citrix Systems R&D
Diffstat (limited to 'sysutils')
-rw-r--r--sysutils/xen-tools/Makefile6
-rw-r--r--sysutils/xen-tools/files/0001-libelf-fix-elf_parse_bsdsyms-call.patch36
-rw-r--r--sysutils/xen-tools/files/0002-libxc-fix-xc_dom_load_elf_symtab.patch125
3 files changed, 165 insertions, 2 deletions
diff --git a/sysutils/xen-tools/Makefile b/sysutils/xen-tools/Makefile
index 03a24ac23c63..b8a685d37d25 100644
--- a/sysutils/xen-tools/Makefile
+++ b/sysutils/xen-tools/Makefile
@@ -3,7 +3,7 @@
PORTNAME= xen
PKGNAMESUFFIX= -tools
PORTVERSION= 4.5.0
-PORTREVISION= 6
+PORTREVISION= 7
CATEGORIES= sysutils emulators
MASTER_SITES= http://bits.xensource.com/oss-xen/release/${PORTVERSION}/ \
http://code.coreboot.org/p/seabios/downloads/get/:seabios
@@ -48,7 +48,9 @@ QEMU_ARGS= --disable-gtk \
--cxx=c++
EXTRA_PATCHES= ${FILESDIR}/xsa119-unstable.patch:-p1 \
- ${FILESDIR}/xsa125.patch:-p1
+ ${FILESDIR}/xsa125.patch:-p1 \
+ ${FILESDIR}/0001-libelf-fix-elf_parse_bsdsyms-call.patch:-p1 \
+ ${FILESDIR}/0002-libxc-fix-xc_dom_load_elf_symtab.patch:-p1
CONFIGURE_ARGS+= --with-extra-qemuu-configure-args="${QEMU_ARGS}"
SHEBANG_FILES= tools/misc/xencov_split \
diff --git a/sysutils/xen-tools/files/0001-libelf-fix-elf_parse_bsdsyms-call.patch b/sysutils/xen-tools/files/0001-libelf-fix-elf_parse_bsdsyms-call.patch
new file mode 100644
index 000000000000..ddab05badaed
--- /dev/null
+++ b/sysutils/xen-tools/files/0001-libelf-fix-elf_parse_bsdsyms-call.patch
@@ -0,0 +1,36 @@
+From c2da83662498a5cd66512c684a0af178228f9d5a Mon Sep 17 00:00:00 2001
+From: Roger Pau Monne <roger.pau@citrix.com>
+Date: Thu, 11 Jun 2015 17:08:26 +0200
+Subject: [PATCH 1/2] libelf: fix elf_parse_bsdsyms call
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+elf_parse_bsdsyms expects the second paramater to be a physical address, not
+a virtual one.
+
+Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
+Cc: Ian Campbell <ian.campbell@citrix.com>
+Cc: Ian Jackson <ian.jackson@eu.citrix.com>
+Cc: Jan Beulich <jbeulich@suse.com>
+Cc: Tim Deegan <tim@xen.org>
+---
+ xen/common/libelf/libelf-dominfo.c | 2 +-
+ 1 file changed, 1 insertion(+), 1 deletion(-)
+
+diff --git a/xen/common/libelf/libelf-dominfo.c b/xen/common/libelf/libelf-dominfo.c
+index 6120dd4..86403b9 100644
+--- a/xen/common/libelf/libelf-dominfo.c
++++ b/xen/common/libelf/libelf-dominfo.c
+@@ -438,7 +438,7 @@ static elf_errorstatus elf_xen_addr_calc_check(struct elf_binary *elf,
+
+ if ( parms->bsd_symtab )
+ {
+- elf_parse_bsdsyms(elf, parms->virt_kend);
++ elf_parse_bsdsyms(elf, elf->pend);
+ if ( elf->bsd_symtab_pend )
+ parms->virt_kend = elf->bsd_symtab_pend + parms->virt_offset;
+ }
+--
+1.9.5 (Apple Git-50.3)
+
diff --git a/sysutils/xen-tools/files/0002-libxc-fix-xc_dom_load_elf_symtab.patch b/sysutils/xen-tools/files/0002-libxc-fix-xc_dom_load_elf_symtab.patch
new file mode 100644
index 000000000000..da1e53524a2d
--- /dev/null
+++ b/sysutils/xen-tools/files/0002-libxc-fix-xc_dom_load_elf_symtab.patch
@@ -0,0 +1,125 @@
+From e438f954ae3c6685ccf83b3bd01983f3224af3ab Mon Sep 17 00:00:00 2001
+From: Roger Pau Monne <roger.pau@citrix.com>
+Date: Thu, 11 Jun 2015 17:31:43 +0200
+Subject: [PATCH 2/2] libxc: fix xc_dom_load_elf_symtab
+MIME-Version: 1.0
+Content-Type: text/plain; charset=UTF-8
+Content-Transfer-Encoding: 8bit
+
+xc_dom_load_elf_symtab was incorrectly trying to perform the same
+calculations already done in elf_parse_bsdsyms when load == 0 is used.
+Instead of trying to repeat the calculations, just trust what
+elf_parse_bsdsyms has already accounted for.
+
+This also simplifies the code by allowing the non-load case to return
+earlier.
+
+Signed-off-by: Roger Pau Monné <roger.pau@citrix.com>
+Cc: Ian Jackson <ian.jackson@eu.citrix.com>
+Cc: Stefano Stabellini <stefano.stabellini@eu.citrix.com>
+Cc: Ian Campbell <ian.campbell@citrix.com>
+Cc: Wei Liu <wei.liu2@citrix.com>
+---
+ tools/libxc/xc_dom_elfloader.c | 33 ++++++++++++++-------------------
+ 1 file changed, 14 insertions(+), 19 deletions(-)
+
+diff --git a/tools/libxc/xc_dom_elfloader.c b/tools/libxc/xc_dom_elfloader.c
+index 9843b1f..6ce1062 100644
+--- a/tools/libxc/xc_dom_elfloader.c
++++ b/tools/libxc/xc_dom_elfloader.c
+@@ -128,6 +128,8 @@ static elf_errorstatus xc_dom_load_elf_symtab(struct xc_dom_image *dom,
+ return 0;
+ }
+
++ size = elf->bsd_symtab_pend - elf->bsd_symtab_pstart;
++
+ if ( load )
+ {
+ char *hdr_ptr;
+@@ -135,11 +137,10 @@ static elf_errorstatus xc_dom_load_elf_symtab(struct xc_dom_image *dom,
+
+ if ( !dom->bsd_symtab_start )
+ return 0;
+- size = dom->kernel_seg.vend - dom->bsd_symtab_start;
+ hdr_ptr = xc_dom_vaddr_to_ptr(dom, dom->bsd_symtab_start, &allow_size);
+ if ( hdr_ptr == NULL )
+ {
+- DOMPRINTF("%s/load: xc_dom_vaddr_to_ptr(dom,dom->bsd_symtab_start"
++ DOMPRINTF("%s: xc_dom_vaddr_to_ptr(dom,dom->bsd_symtab_start"
+ " => NULL", __FUNCTION__);
+ return -1;
+ }
+@@ -152,8 +153,6 @@ static elf_errorstatus xc_dom_load_elf_symtab(struct xc_dom_image *dom,
+ {
+ char *hdr_ptr;
+
+- size = sizeof(unsigned) + elf_size(elf, elf->ehdr) +
+- elf_shdr_count(elf) * elf_size(elf, shdr);
+ hdr_ptr = xc_dom_malloc(dom, size);
+ if ( hdr_ptr == NULL )
+ return 0;
+@@ -161,6 +160,8 @@ static elf_errorstatus xc_dom_load_elf_symtab(struct xc_dom_image *dom,
+ elf->caller_xdest_size = size;
+ hdr = ELF_REALPTR2PTRVAL(hdr_ptr);
+ dom->bsd_symtab_start = elf_round_up(elf, dom->kernel_seg.vend);
++ dom->kernel_seg.vend = elf_round_up(elf, dom->bsd_symtab_start + size);
++ return 0;
+ }
+
+ elf_memcpy_safe(elf, hdr + sizeof(unsigned),
+@@ -189,9 +190,8 @@ static elf_errorstatus xc_dom_load_elf_symtab(struct xc_dom_image *dom,
+ }
+ if ( elf->caller_xdest_size < sizeof(unsigned) )
+ {
+- DOMPRINTF("%s/%s: header size %"PRIx64" too small",
+- __FUNCTION__, load ? "load" : "parse",
+- (uint64_t)elf->caller_xdest_size);
++ DOMPRINTF("%s: header size %"PRIx64" too small",
++ __FUNCTION__, (uint64_t)elf->caller_xdest_size);
+ return -1;
+ }
+ if ( elf_init(&syms, elf->caller_xdest_base + sizeof(unsigned),
+@@ -219,10 +219,9 @@ static elf_errorstatus xc_dom_load_elf_symtab(struct xc_dom_image *dom,
+ maxaddr = elf_round_up(&syms, symtab + elf_size(&syms, syms.ehdr) +
+ elf_shdr_count(&syms) * elf_size(&syms, shdr));
+
+- DOMPRINTF("%s/%s: bsd_symtab_start=%" PRIx64 ", kernel.end=0x%" PRIx64
++ DOMPRINTF("%s: bsd_symtab_start=%" PRIx64 ", kernel.end=0x%" PRIx64
+ " -- symtab=0x%" PRIx64 ", maxaddr=0x%" PRIx64 "",
+- __FUNCTION__, load ? "load" : "parse",
+- dom->bsd_symtab_start, dom->kernel_seg.vend,
++ __FUNCTION__, dom->bsd_symtab_start, dom->kernel_seg.vend,
+ symtab, maxaddr);
+
+ count = elf_shdr_count(&syms);
+@@ -279,13 +278,10 @@ static elf_errorstatus xc_dom_load_elf_symtab(struct xc_dom_image *dom,
+ type == SHT_SYMTAB ? "symtab" : "strtab",
+ size, maxaddr);
+
+- if ( load )
+- {
+- shdr2 = elf_shdr_by_index(elf, h);
+- elf_memcpy_safe(elf, elf_section_start(&syms, shdr),
+- elf_section_start(elf, shdr2),
+- size);
+- }
++ shdr2 = elf_shdr_by_index(elf, h);
++ elf_memcpy_safe(elf, elf_section_start(&syms, shdr),
++ elf_section_start(elf, shdr2),
++ size);
+ }
+
+ /* Name is NULL. */
+@@ -308,8 +304,7 @@ static elf_errorstatus xc_dom_load_elf_symtab(struct xc_dom_image *dom,
+ dom->bsd_symtab_start = 0;
+ return 0;
+ }
+- if ( !load )
+- dom->kernel_seg.vend = maxaddr;
++
+ return 0;
+ }
+
+--
+1.9.5 (Apple Git-50.3)
+