From owner-svn-ports-all@FreeBSD.ORG Fri Jun 19 10:41:33 2015 Return-Path: Delivered-To: svn-ports-all@hub.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by hub.freebsd.org (Postfix) with ESMTPS id 7EACDA43; Fri, 19 Jun 2015 10:41:33 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from svn.freebsd.org (svn.freebsd.org [IPv6:2001:1900:2254:2068::e6a:0]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mx1.freebsd.org (Postfix) with ESMTPS id 5FE83BC3; Fri, 19 Jun 2015 10:41:33 +0000 (UTC) (envelope-from royger@FreeBSD.org) Received: from svn.freebsd.org ([127.0.1.70]) by svn.freebsd.org (8.14.9/8.14.9) with ESMTP id t5JAfX4Y052352; Fri, 19 Jun 2015 10:41:33 GMT (envelope-from royger@FreeBSD.org) Received: (from royger@localhost) by svn.freebsd.org (8.14.9/8.14.9/Submit) id t5JAfWP8052340; Fri, 19 Jun 2015 10:41:32 GMT (envelope-from royger@FreeBSD.org) Message-Id: <201506191041.t5JAfWP8052340@svn.freebsd.org> X-Authentication-Warning: svn.freebsd.org: royger set sender to royger@FreeBSD.org using -f From: Roger Pau Monné Date: Fri, 19 Jun 2015 10:41:32 +0000 (UTC) To: ports-committers@freebsd.org, svn-ports-all@freebsd.org, svn-ports-head@freebsd.org Subject: svn commit: r390112 - in head: emulators/xen-kernel emulators/xen-kernel/files sysutils/xen-tools sysutils/xen-tools/files X-SVN-Group: ports-head MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit X-BeenThere: svn-ports-all@freebsd.org X-Mailman-Version: 2.1.20 Precedence: list List-Id: SVN commit messages for the ports tree List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Fri, 19 Jun 2015 10:41:33 -0000 Author: royger (src committer) Date: Fri Jun 19 10:41:31 2015 New Revision: 390112 URL: https://svnweb.freebsd.org/changeset/ports/390112 Log: 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 Added: head/emulators/xen-kernel/files/0001-libelf-fix-elf_parse_bsdsyms-call.patch (contents, props changed) head/sysutils/xen-tools/files/0001-libelf-fix-elf_parse_bsdsyms-call.patch (contents, props changed) head/sysutils/xen-tools/files/0002-libxc-fix-xc_dom_load_elf_symtab.patch (contents, props changed) Modified: head/emulators/xen-kernel/Makefile head/sysutils/xen-tools/Makefile Modified: head/emulators/xen-kernel/Makefile ============================================================================== --- head/emulators/xen-kernel/Makefile Fri Jun 19 09:14:52 2015 (r390111) +++ head/emulators/xen-kernel/Makefile Fri Jun 19 10:41:31 2015 (r390112) @@ -3,7 +3,7 @@ PORTNAME= xen PKGNAMESUFFIX= -kernel PORTVERSION= 4.5.0 -PORTREVISION= 3 +PORTREVISION= 4 CATEGORIES= emulators MASTER_SITES= http://bits.xensource.com/oss-xen/release/${PORTVERSION}/ @@ -36,7 +36,8 @@ EXTRA_PATCHES= ${FILESDIR}/iommu_share_p ${FILESDIR}/xsa127-4.x.patch:-p2 \ ${FILESDIR}/xsa132.patch:-p2 \ ${FILESDIR}/xsa134.patch:-p2 \ - ${FILESDIR}/xsa136.patch:-p2 + ${FILESDIR}/xsa136.patch:-p2 \ + ${FILESDIR}/0001-libelf-fix-elf_parse_bsdsyms-call.patch:-p2 .include Added: head/emulators/xen-kernel/files/0001-libelf-fix-elf_parse_bsdsyms-call.patch ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/emulators/xen-kernel/files/0001-libelf-fix-elf_parse_bsdsyms-call.patch Fri Jun 19 10:41:31 2015 (r390112) @@ -0,0 +1,36 @@ +From c2da83662498a5cd66512c684a0af178228f9d5a Mon Sep 17 00:00:00 2001 +From: Roger Pau Monne +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é +Cc: Ian Campbell +Cc: Ian Jackson +Cc: Jan Beulich +Cc: Tim Deegan +--- + 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) + Modified: head/sysutils/xen-tools/Makefile ============================================================================== --- head/sysutils/xen-tools/Makefile Fri Jun 19 09:14:52 2015 (r390111) +++ head/sysutils/xen-tools/Makefile Fri Jun 19 10:41:31 2015 (r390112) @@ -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 \ Added: head/sysutils/xen-tools/files/0001-libelf-fix-elf_parse_bsdsyms-call.patch ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/xen-tools/files/0001-libelf-fix-elf_parse_bsdsyms-call.patch Fri Jun 19 10:41:31 2015 (r390112) @@ -0,0 +1,36 @@ +From c2da83662498a5cd66512c684a0af178228f9d5a Mon Sep 17 00:00:00 2001 +From: Roger Pau Monne +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é +Cc: Ian Campbell +Cc: Ian Jackson +Cc: Jan Beulich +Cc: Tim Deegan +--- + 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) + Added: head/sysutils/xen-tools/files/0002-libxc-fix-xc_dom_load_elf_symtab.patch ============================================================================== --- /dev/null 00:00:00 1970 (empty, because file is newly added) +++ head/sysutils/xen-tools/files/0002-libxc-fix-xc_dom_load_elf_symtab.patch Fri Jun 19 10:41:31 2015 (r390112) @@ -0,0 +1,125 @@ +From e438f954ae3c6685ccf83b3bd01983f3224af3ab Mon Sep 17 00:00:00 2001 +From: Roger Pau Monne +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é +Cc: Ian Jackson +Cc: Stefano Stabellini +Cc: Ian Campbell +Cc: Wei Liu +--- + 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) +