2.35.50 breaks ld -no-pie
Affects | Status | Importance | Assigned to | Milestone | |
---|---|---|---|---|---|
| Ubuntu on IBM z Systems |
Undecided
|
Unassigned | ||
| binutils |
Fix Released
|
Medium
|
||
| binutils (Ubuntu) |
Undecided
|
Unassigned | ||
| qemu (Ubuntu) |
High
|
Christian Ehrhardt | ||
| s390-tools (Ubuntu) |
Undecided
|
Lukas Märdian |
Bug Description
The qemu build reaches (and always did) a step where it tries to link some
img files. That is done via the command:
$ ld -m elf_i386 -T /<<PKGBUILDDIR>
Recently that still works in Debian [1] but no more in Ubuntu [2].
I think that the new binutils broke me.
In hirsute proposed those are at 2.35.50.
The issue is easily isolated, and by copying the two files around I found the following:
Hirsute: 2.35.50.
Hirsute: 2.35.50.
Sid: 2.35.1-4 - good
Groovy: 2.35.1-1ubuntu1 - good
Focal: 2.34-6ubuntu1 - good
I'll attach these two files to the bug, just thro them into a directory and
run the command:
$ ld -m elf_i386 -T ./flat.lds -no-pie -s -o linuxboot.img linuxboot.o
If that is an intentional change please guide how this is now supposed to work.
[1]: https:/
[2]: https:/
Related branches
- Lucas Kanashiro: Approve on 2021-02-22
- Canonical Server packageset reviewers: Pending requested 2021-02-22
- Canonical Server Team: Pending requested 2021-02-22
-
Diff: 6465 lines (+5793/-30)17 files modifieddebian/changelog (+4288/-4)
debian/control (+88/-17)
debian/control-in (+59/-8)
debian/patches/series (+7/-0)
debian/patches/ubuntu/define-ubuntu-machine-types.patch (+784/-0)
debian/patches/ubuntu/enable-svm-by-default.patch (+34/-0)
debian/patches/ubuntu/lp-1907789-build-no-pie-is-no-functional-liker-flag.patch (+76/-0)
debian/patches/ubuntu/lp-1916230-hw-s390x-fix-build-for-virtio-9p-ccw.patch (+56/-0)
debian/patches/ubuntu/pre-bionic-256k-ipxe-efi-roms.patch (+62/-0)
debian/qemu-kvm-init (+89/-0)
debian/qemu-system-common.install (+1/-0)
debian/qemu-system-common.qemu-kvm.default (+8/-0)
debian/qemu-system-common.qemu-kvm.service (+16/-0)
debian/qemu-system-gui.prerm (+42/-0)
debian/qemu-system-x86.NEWS (+80/-0)
debian/qemu-system-x86.README.Debian (+47/-0)
debian/rules (+56/-1)
- Paride Legovini (community): Approve on 2021-01-06
- Canonical Server Team: Pending requested 2021-01-05
- Ubuntu Server Dev import team: Pending requested 2021-01-05
-
Diff: 6336 lines (+5677/-30)16 files modifieddebian/changelog (+4229/-4)
debian/control (+88/-17)
debian/control-in (+59/-8)
debian/patches/series (+6/-0)
debian/patches/ubuntu/define-ubuntu-machine-types.patch (+784/-0)
debian/patches/ubuntu/enable-svm-by-default.patch (+34/-0)
debian/patches/ubuntu/lp-1907789-build-no-pie-is-no-functional-liker-flag.patch (+76/-0)
debian/patches/ubuntu/pre-bionic-256k-ipxe-efi-roms.patch (+62/-0)
debian/qemu-kvm-init (+89/-0)
debian/qemu-system-common.install (+1/-0)
debian/qemu-system-common.qemu-kvm.default (+8/-0)
debian/qemu-system-common.qemu-kvm.service (+16/-0)
debian/qemu-system-gui.prerm (+42/-0)
debian/qemu-system-x86.NEWS (+80/-0)
debian/qemu-system-x86.README.Debian (+47/-0)
debian/rules (+56/-1)
Christian Ehrhardt (paelzer) wrote : | #1 |
Christian Ehrhardt (paelzer) wrote : | #2 |
Changed in binutils (Ubuntu): | |
status: | New → Fix Committed |
|
#4 |
It is caused by
commit 983d925db6a09ac
Author: Nick Clifton <email address hidden>
Date: Mon Oct 5 13:53:59 2020 +0100
Update the BFD linker so that it deprecates grouped short options.
* lexsup.c (parse_args): Generate an error or warning message when
|
#5 |
$ valgrind ./ld/ld-new -no-pie
==290969== Memcheck, a memory error detector
==290969== Copyright (C) 2002-2017, and GNU GPL'd, by Julian Seward et al.
==290969== Using Valgrind-3.16.1 and LibVEX; rerun with -h for copyright info
==290969== Command: ./ld/ld-new -no-pie
==290969==
==290969== Conditional jump or move depends on uninitialised value(s)
==290969== at 0x409A96: parse_args (lexsup.c:749)
==290969== by 0x403DC6: main (ldmain.c:370)
==290969==
./ld/ld-new: Error: unable to disambiguate: -no-pie (did you mean --no-pie ?)
==290969==
==290969== HEAP SUMMARY:
==290969== in use at exit: 21,161 bytes in 10 blocks
==290969== total heap usage: 72 allocs, 62 frees, 43,232 bytes allocated
==290969==
==290969== LEAK SUMMARY:
==290969== definitely lost: 0 bytes in 0 blocks
==290969== indirectly lost: 0 bytes in 0 blocks
==290969== possibly lost: 0 bytes in 0 blocks
==290969== still reachable: 21,161 bytes in 10 blocks
==290969== suppressed: 0 bytes in 0 blocks
==290969== Rerun with --leak-check=full to see details of leaked memory
==290969==
==290969== Use --track-origins=yes to see where uninitialised values come from
==290969== For lists of detected and suppressed errors, rerun with: -s
==290969== ERROR SUMMARY: 2 errors from 1 contexts (suppressed: 0 from 0)
|
#6 |
longind may not be set by getopt_long_only:
diff --git a/ld/lexsup.c b/ld/lexsup.c
index 0d10bc6fba.
--- a/ld/lexsup.c
+++ b/ld/lexsup.c
@@ -735,6 +735,7 @@ parse_args (unsigned argc, char **argv)
/* getopt_long_only is like getopt_long, but '-' as well as '--'
can indicate a long option. */
opterr = 0;
+ longind = -1;
last_optind = optind;
optc = getopt_long_only (argc, argv, shortopts, longopts, &longind);
if (optc == '?')
|
#7 |
LONGIND returns the index in LONGOPT of the long-named option found.
It is only valid when a long-named option has been found by the most
recent call.
Since the long option isn't found, LONGIND is undefined.
|
#8 |
Not to be facetious but did we ever really support -no-pie ?
It does not appear to be documented, and it looks like it is treated internally as two options: -n and -o-pie.
I have a patch that fixes the uninitialised memory problem detected by valgrind, but I am wondering whether it is better to add explicit support for -no-pie as an option to turn off -pie, or else keep the linker's error message, and maybe add a --no-pie option instead.
|
#9 |
(In reply to Nick Clifton from comment #5)
> Not to be facetious but did we ever really support -no-pie ?
>
ld/testsuite/
|
#10 |
that was reported for qemu:
./configure:# Check we support --no-pie first; we will need this for building ROMs.
./configure:if compile_prog "-Werror -fno-pie" "-no-pie"; then
./configure: LDFLAGS_
That's the *compiler* flag.
|
#12 |
The master branch has been updated by Nick Clifton <email address hidden>:
https:/
commit 3991c7acb29aa8d
Author: Nick Clifton <email address hidden>
Date: Mon Dec 14 12:40:13 2020 +0000
Fix a use of an uninitialised variable in the bfd linker.
PR 27050
* lexsup.c (parse_args): Ensure that the longind local variable is
set.
|
#13 |
Right - I have checked in the patch to fix the use of an unitialised variable.
Frankly I do not see any need to go any further. The linker does not have a -no-pie or a --no-pie command line option, so the error message is correct. Hence I am going to close this PR. If anyone has any strong objections they can reopen it and tell us what they think.
Cheers
Nick
Changed in qemu (Ubuntu): | |
status: | New → In Progress |
assignee: | nobody → Christian Ehrhardt (paelzer) |
importance: | Undecided → High |
Changed in binutils: | |
importance: | Unknown → Medium |
status: | Unknown → Fix Released |
Christian Ehrhardt (paelzer) wrote : | #14 |
FYI - fix submitted to qemu upstream and for now added to the qemu package. If upstream eventually prefers a different solution I can refresh it accordingly.
=> https:/
Launchpad Janitor (janitor) wrote : | #15 |
This bug was fixed in the package binutils - 2.35.50.
---------------
binutils (2.35.50.
* Revert linker options parsing patch. LP: #1907789.
-- Matthias Klose <email address hidden> Fri, 11 Dec 2020 11:29:47 +0100
Changed in binutils (Ubuntu): | |
status: | Fix Committed → Fix Released |
Launchpad Janitor (janitor) wrote : | #16 |
This bug was fixed in the package qemu - 1:5.2+dfsg-2ubuntu1
---------------
qemu (1:5.2+
* Merge with Debian unstable
- includes fix for CVE-2020-17380
- includes a fix for s390x PCI device reset (LP: #1907656)
Remaining changes:
- qemu-kvm to systemd unit
- d/qemu-kvm-init: script for QEMU KVM preparation modules, ksm,
hugepages and architecture specifics
- d/qemu-
- d/qemu-
- d/qemu-
- d/rules: call dh_installinit and dh_installsystemd for qemu-kvm
- Distribution specific machine type (LP: 1304107 1621042)
- d/p/ubuntu/
- d/qemu-
for host-phys-bits=true (LP: 1776189)
- add an info about -hpb machine type in debian/
- provide pseries-
- ubuntu-q35 alias added to auto-select the most recent q35 ubuntu type
- Enable nesting by default
- d/p/ubuntu/
in qemu64 on amd
[ No more strictly needed, but required for backward compatibility ]
- improved dependencies
- Make qemu-system-common depend on qemu-block-extra
- Make qemu-utils depend on qemu-block-extra
- let qemu-utils recommend sharutils
- tolerate ipxe size change on migrations to >=18.04 (LP: 1713490)
- d/p/ubuntu/
reference 256k path
- d/control-in: depend on ipxe-qemu-
handle incoming migrations from former releases.
- d/control-in: Disable capstone disassembler library support (universe)
- d/qemu-
- d/control*, d/rules: disable xen by default, but provide universe
package qemu-system-x86-xen as alternative
[includes compat links changes of 5.0-5ubuntu4]
- allow qemu to load old modules post upgrade (LP 1847361)
- Drop d/qemu-
- d/rules: Drop generating package version into maintainer scripts
- d/qemu-
the bad old prerm (LP 1906245 1905377)
* Dropped Changes:
- d/control, d/rules: build with gcc-9 on armhf as workaround until
resolved in gcc-10 (LP: 1890435) [it is flaky still, but no more 100%
fails]
* Added Changes:
- Refreshed ubuntu machine types for hirsute@5.2
- d/control: regenerated from d/control-in
- d/p/ubuntu/
ld usage of -no-pie (LP: #1907789)
qemu (1:5.2+dfsg-2) unstable; urgency=medium
* move ui-opengl.so module from qemu-system-gui to qemu-system-common,
as other ...
Changed in qemu (Ubuntu): | |
status: | In Progress → Fix Released |
Changed in s390-tools (Ubuntu): | |
assignee: | nobody → Lukas Märdian (slyon) |
status: | New → In Progress |
Lukas Märdian (slyon) wrote : | #17 |
Proposed to drop the -no-pie flag at upstream s390-tools:
https:/
Launchpad Janitor (janitor) wrote : | #18 |
This bug was fixed in the package s390-tools - 2.15.1-0ubuntu6
---------------
s390-tools (2.15.1-0ubuntu6) hirsute; urgency=medium
* debian/
zcryptstats: Fix handling of partial results with many domains
Thanks to Ingo Franzki (LP: #1903984)
-- Frank Heimes <email address hidden> Tue, 19 Jan 2021 18:58:26 +0100
Changed in s390-tools (Ubuntu): | |
status: | In Progress → Fix Released |
Changed in ubuntu-z-systems: | |
status: | New → Fix Released |
works with the 2.35 branch, fails with the trunk:
$ ld.gold -pie
ld.gold: fatal error: no input files
$ ld.gold -no-pie
ld.gold: fatal error: no input files
$ ld.bfd -pie
ld.bfd: no input files
$ ld.bfd -no-pie
ld.bfd: Error: unable to disambiguate: -no-pie (did you mean --no-pie ?)