Bug 207170 - sysutils/xen-tools: build fails with ELF Tool Chain objcopy because it creates an invalid ELF file
Summary: sysutils/xen-tools: build fails with ELF Tool Chain objcopy because it create...
Status: Closed FIXED
Alias: None
Product: Ports & Packages
Classification: Unclassified
Component: Individual Port(s) (show other bugs)
Version: Latest
Hardware: Any Any
: --- Affects Only Me
Assignee: Roger Pau Monné
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2016-02-13 22:49 UTC by Ed Maste
Modified: 2016-03-31 20:47 UTC (History)
1 user (show)

See Also:
bugzilla: maintainer-feedback? (royger)


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Ed Maste freebsd_committer 2016-02-13 22:49:15 UTC
% readelf -S work/xen-4.5.2/tools/firmware/seabios-dir/out/rom.o
There are 13 section headers, starting at offset 0x86d68:

Section Headers:
  [Nr] Name              Type            Addr     Off    Size   ES Flg Lk Inf Al
  [ 0] (null)            NULL            00000000 000000 000000 00      0   0  0
  [ 1] .text             PROGBITS        000dd04c 00104c 022fb4 00  AX  0   0 16
  [ 2] .comment          PROGBITS        00000000 024000 000026 01  MS  0   0  1
  [ 3] .debug_aranges    PROGBITS        00000000 024026 000988 00      0   0  1
  [ 4] .debug_info       PROGBITS        00000000 0249ae 031584 00      0   0  1
  [ 5] .debug_abbrev     PROGBITS        00000000 055f32 00097a 00      0   0  1
  [ 6] .debug_line       PROGBITS        00000000 0568ac 006393 00      0   0  1
  [ 7] .debug_str        PROGBITS        00000000 05cc3f 0082f0 01  MS  0   0  1
  [ 8] .debug_loc        PROGBITS        00000000 064f2f 0206cb 00      0   0  1
  [ 9] .debug_ranges     PROGBITS        00000000 0855fa 0016e8 00      0   0  1
  [10] .shstrtab         STRTAB          00000000 086ce2 000083 00      0   0  1
  [11] .symtab           SYMTAB          00000000 086f70 002790 10     12 488  4
  [12] .strtab           STRTAB          00000000 089700 0022ee 00      0   0  1
Key to Flags:
  W (write), A (alloc), X (execute), M (merge), S (strings)
  I (info), L (link order), G (group), x (unknown)
  O (extra OS processing required) o (OS specific), p (processor specific)

Note .text specifies 16-byte alignment, while the address (0x000dd04c) is not 16-byte aligned.
Comment 1 Ed Maste freebsd_committer 2016-02-13 22:57:34 UTC
Oops, accidentally submitted before I finished providing all of the information.

I am planning to switch to ELF Tool Chain's objcopy, and xen-tools fails to build with it -- see exp-run in PR 207091.

ELF Tool Chain's objcopy rejects malformed ELF files, as with rom.o above.

exp-run build log:
http://package22.nyi.freebsd.org/data/headamd64PR207091-default/2016-02-10_23h02m06s/logs/errors/xen-tools-4.5.2_1.log

excerpt:
Compilation complete. 0 Errors, 0 Warnings, 2 Remarks, 445 Optimizations
Compile checking out/src/fw/acpi.o
Compile checking out/src/fw/mptable.o
Compile checking out/src/fw/pirtable.o
Compile checking out/src/fw/smbios.o
Compile checking out/src/fw/romfile_loader.o
Compiling whole program out/ccode32flat.o
Compiling whole program out/code32seg.o
Compiling whole program out/ccode16.o
Compiling to assembler out/src/asm-offsets.s
Generating offset file out/asm-offsets.h
Compiling (16bit) out/romlayout.o
Building ld scripts
Version: 1.8.1
Fixed space: 0xe05b-0x10000 total: 8101 slack: 12 Percent slack: 0.1%
16bit size: 35992
32bit segmented size: 2127
32bit flat size: 27209
32bit flat init size: 70480
Lowmem size: 2176
f-segment var size: 1200
Linking out/rom16.o
Stripping out/rom16.strip.o
Linking out/rom32seg.o
Stripping out/rom32seg.strip.o
Linking out/rom.o
Prepping out/bios.bin.prep
objcopy: elf_update() failed: Layout constraint violation
Makefile:184: recipe for target 'out/bios.bin.prep' failed
Comment 2 Roger Pau Monné freebsd_committer 2016-02-16 13:11:51 UTC
I've proposed a patch upstream, since I think new versions can still be affected by this issue:

http://www.seabios.org/pipermail/seabios/2016-February/010510.html
Comment 3 Roger Pau Monné freebsd_committer 2016-02-23 15:03:10 UTC
This has now been fixed upstream, I plan to cherry-pick the fix and apply it to our version of xen-tools/SeaBIOS tomorrow probably.

http://code.coreboot.org/p/seabios/source/commit/3910de0dee216d5b5bf23cfa29bfc80d082b2ee7/
Comment 4 commit-hook freebsd_committer 2016-02-26 12:57:02 UTC
A commit references this bug:

Author: royger
Date: Fri Feb 26 12:56:37 UTC 2016
New revision: 409604
URL: https://svnweb.freebsd.org/changeset/ports/409604

Log:
  xen: update port and apply security fixes

   * Apply the following Xen security fixes (XSAs): 167, 168, 170.
   * Update SeaBIOS version to 1.8.2, and apply build fix so it builds with
     ELF toolchain objcopy [0].
   * Perform the backport of two functional changes to the Xen kernel in order
     to improve PVH Dom0 hardware support [1].

  Security:		CVE-2016-1570
  Security:		CVE-2016-1571
  Security:		CVE-2016-2271
  Sponsored by:		Citrix Systems R&D
  Requested by:		Gustau P?rez <gperez@entel.upc.edu> [1]
  PR:			207170 [0]
  Approved by:		bapt
  Differential revision:	https://reviews.freebsd.org/D5420

Changes:
  head/emulators/xen/Makefile
  head/emulators/xen-kernel/Makefile
  head/emulators/xen-kernel/files/0001-x86-pvh-use-a-custom-IO-bitmap-for-PVH-hardware-doma.patch
  head/emulators/xen-kernel/files/0002-x86-pvh-trap-access-to-sensitive-IO-ports.patch
  head/emulators/xen-kernel/files/xsa167-4.6.patch
  head/emulators/xen-kernel/files/xsa168.patch
  head/emulators/xen-kernel/files/xsa170-4.5.patch
  head/sysutils/xen-tools/Makefile
  head/sysutils/xen-tools/distinfo
  head/sysutils/xen-tools/files/0001-build-fix-.text-section-address-alignment.patch
  head/sysutils/xen-tools/files/patch-tools_firmware_seabios-dir_scripts_buildversion.sh
Comment 5 commit-hook freebsd_committer 2016-02-28 00:31:08 UTC
A commit references this bug:

Author: junovitch
Date: Sun Feb 28 00:31:02 UTC 2016
New revision: 409707
URL: https://svnweb.freebsd.org/changeset/ports/409707

Log:
  MFH: r409604

  xen: update port and apply security fixes

   * Apply the following Xen security fixes (XSAs): 167, 168, 170.
   * Update SeaBIOS version to 1.8.2, and apply build fix so it builds with
     ELF toolchain objcopy [0].
   * Perform the backport of two functional changes to the Xen kernel in order
     to improve PVH Dom0 hardware support [1].

  Security:	CVE-2016-1570
  Security:	CVE-2016-1571
  Security:	CVE-2016-2271
  Security:	https://vuxml.FreeBSD.org/freebsd/7ed7c36f-ddaf-11e5-b2bd-002590263bf5.html
  Security:	https://vuxml.FreeBSD.org/freebsd/80adc394-ddaf-11e5-b2bd-002590263bf5.html
  Security:	https://vuxml.FreeBSD.org/freebsd/81f9d6a4-ddaf-11e5-b2bd-002590263bf5.html
  Sponsored by:	Citrix Systems R&D
  Requested by:	Gustau P?rez <gperez@entel.upc.edu> [1]
  PR:		207170 [0]
  Approved by:	bapt
  Approved by:	ports-secteam (with hat)
  Differential revision:	https://reviews.freebsd.org/D5420

Changes:
_U  branches/2016Q1/
  branches/2016Q1/emulators/xen/Makefile
  branches/2016Q1/emulators/xen-kernel/Makefile
  branches/2016Q1/emulators/xen-kernel/files/0001-x86-pvh-use-a-custom-IO-bitmap-for-PVH-hardware-doma.patch
  branches/2016Q1/emulators/xen-kernel/files/0002-x86-pvh-trap-access-to-sensitive-IO-ports.patch
  branches/2016Q1/emulators/xen-kernel/files/xsa167-4.6.patch
  branches/2016Q1/emulators/xen-kernel/files/xsa168.patch
  branches/2016Q1/emulators/xen-kernel/files/xsa170-4.5.patch
  branches/2016Q1/sysutils/xen-tools/Makefile
  branches/2016Q1/sysutils/xen-tools/distinfo
  branches/2016Q1/sysutils/xen-tools/files/0001-build-fix-.text-section-address-alignment.patch
  branches/2016Q1/sysutils/xen-tools/files/patch-tools_firmware_seabios-dir_scripts_buildversion.sh
Comment 6 Ed Maste freebsd_committer 2016-03-31 20:47:09 UTC
Upstream patch has been applied to ports tree including quarterly.