Incomplete support for DT_RELR relocations on Ubuntu 22.04

Bug #1978129 reported by bugproxy
10
This bug affects 1 person
Affects Status Importance Assigned to Milestone
The Ubuntu-power-systems project
Fix Released
Medium
Ubuntu on IBM Power Systems Bug Triage
binutils (Ubuntu)
Fix Released
Medium
Canonical Foundations Team
Jammy
Fix Released
Medium
Matthias Klose
Kinetic
Fix Released
Medium
Canonical Foundations Team

Bug Description

SRU Justification:
==================

[Impact]

 * The latest glibc uses DT_RELR relocations,
   but it turned out that the linker support is still incomplete,
   as of binutils-2.38-3ubuntu1 on Ubuntu 22.04.

 * It lacks the fix/commit 'PowerPC64 DT_RELR relative reloc addresses'.

 * As discussed at the binutils mailing list:
   https://sourceware.org/pipermail/binutils/2022-March/119921.html
   this fixes several (glibc) regressions (from 574 to 17).

 * Instead of stashing r_offset final address calculations in
   ppc64_elf_size_stubs for use by ppc64_elf_build_stubs,
   section/offset pairs need to be kept.

[Test Plan]

 * Build and run the official (make) check:
   git clone git://sourceware.org/git/glibc.git
   mkdir build && cd build
   ../glibc/configure --prefix=/usr && make -j8 && make check

[Where problems could occur]

 * In case relr_addr is not replaced everywhere it's deletion in
   elf64-ppc.c can cause problems, which will mainly occur at build time.

 * The relr section/offset array may lead to problems if the array is not
   properly handled or used.

 * The rewrite of append_relr_off may cause issues due to wrong allocs
   erroneous pointer arithmetic or array handling.

 * The entirely new sort_relr function may introduce new code issues
   or performance issues.

 * The adjustments of ppc64_elf_size_stubs and ppc64_elf_build_stubs to
   the new relr code could be done wrong
   in which case the linker support is still not working.

 * But the patch was discussed at the upstream mailing list:
   https://sourceware.org/pipermail/binutils/2022-March/thread.html#119921

 * and is limited to ppc, and even to file 'elf64-ppc.c'.
__________

== Comment: #0 - Matheus Salgueiro Castanho <email address hidden> - 2022-06-09 09:32:29 ==
---Problem Description---
Latest glibc uses DT_RELR relocations, but linker support is incomplete as of binutils-2.38-3ubuntu1 on Ubuntu 22.04. It lacks the following fix integrated into the upstream 2.38 branch:

PowerPC64 DT_RELR relative reloc addresses
https://sourceware.org/git/?p=binutils-gdb.git;a=commit;h=e4a35c7319628045302d4c597cb27f1b0a08c858

As mentioned in the binutils mailing list when this patch was discussed, this fixes several glibc regressions:
https://sourceware.org/pipermail/binutils/2022-March/119921.html

Contact Information = Matheus <email address hidden>

---uname output---
N/A

Machine Type = N/A

---Debugger---
A debugger is not configured

---Steps to Reproduce---
 git clone git://sourceware.org/git/glibc.git
mkdir build && cd build
../glibc/configure --prefix=/usr && make -j8 && make check

Userspace tool common name: binutils

The userspace tool has the following bit modes: 64-bit

Userspace rpm: binutils

Userspace tool obtained from project website: na

*Additional Instructions for Matheus <email address hidden>:
-Attach ltrace and strace of userspace application.

bugproxy (bugproxy)
tags: added: architecture-ppc64le bugnameltc-198498 severity-medium targetmilestone-inin2210
Changed in ubuntu:
assignee: nobody → Ubuntu on IBM Power Systems Bug Triage (ubuntu-power-triage)
affects: ubuntu → glibc (Ubuntu)
Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2022-06-09 11:13 EDT-------
This fix is needed into Ubuntu 22.04.x releases.
Fix is already available in Ubuntu 22.10

tags: added: targetmilestone-inin20041
removed: targetmilestone-inin2210
Revision history for this message
bugproxy (bugproxy) wrote :

------- Comment From <email address hidden> 2022-06-09 11:19 EDT-------
Hello Canonical,

This bug is for binutils package.
Wrongly mirrored for glibc package.
Please rectify accordingly in Launchpad.
Apologies for inconvenience.

Frank Heimes (fheimes)
Changed in ubuntu-power-systems:
assignee: nobody → Ubuntu on IBM Power Systems Bug Triage (ubuntu-power-triage)
importance: Undecided → Medium
Changed in glibc (Ubuntu):
importance: Undecided → Medium
affects: glibc (Ubuntu) → binutils (Ubuntu)
Simon Chopin (schopin)
tags: added: fr-2459
Frank Heimes (fheimes)
Changed in binutils (Ubuntu Jammy):
importance: Undecided → Medium
Changed in binutils (Ubuntu Kinetic):
assignee: Ubuntu on IBM Power Systems Bug Triage (ubuntu-power-triage) → Canonical Foundations Team (canonical-foundations)
Changed in binutils (Ubuntu Jammy):
assignee: nobody → Canonical Foundations Team (canonical-foundations)
Frank Heimes (fheimes)
description: updated
Matthias Klose (doko)
Changed in binutils (Ubuntu Kinetic):
status: New → Fix Released
Changed in binutils (Ubuntu Jammy):
status: New → In Progress
assignee: Canonical Foundations Team (canonical-foundations) → Matthias Klose (doko)
Frank Heimes (fheimes)
Changed in ubuntu-power-systems:
status: New → In Progress
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Please test proposed package

Hello bugproxy, or anyone else affected,

Accepted binutils into jammy-proposed. The package will build now and be available at https://launchpad.net/ubuntu/+source/binutils/2.38-4ubuntu2 in a few hours, and then in the -proposed repository.

Please help us by testing this new package. See https://wiki.ubuntu.com/Testing/EnableProposed for documentation on how to enable and use -proposed. Your feedback will aid us getting this update out to other Ubuntu users.

If this package fixes the bug for you, please add a comment to this bug, mentioning the version of the package you tested, what testing has been performed on the package and change the tag from verification-needed-jammy to verification-done-jammy. If it does not fix the bug for you, please add a comment stating that, and change the tag to verification-failed-jammy. In either case, without details of your testing we will not be able to proceed.

Further information regarding the verification process can be found at https://wiki.ubuntu.com/QATeam/PerformingSRUVerification . Thank you in advance for helping!

N.B. The updated package will be released to -updates after the bug(s) fixed by this package have been verified and the package has been in -proposed for a minimum of 7 days.

Changed in binutils (Ubuntu Jammy):
status: In Progress → Fix Committed
tags: added: verification-needed verification-needed-jammy
Frank Heimes (fheimes)
Changed in ubuntu-power-systems:
status: In Progress → Fix Committed
Revision history for this message
Ubuntu SRU Bot (ubuntu-sru-bot) wrote : Autopkgtest regression report (binutils/2.38-4ubuntu2)

All autopkgtests for the newly accepted binutils (2.38-4ubuntu2) for jammy have finished running.
The following regressions have been reported in tests triggered by the package:

glibc/2.35-0ubuntu3.1 (armhf)
sagemath/9.5-4 (amd64)

Please visit the excuses page listed below and investigate the failures, proceeding afterwards as per the StableReleaseUpdates policy regarding autopkgtest regressions [1].

https://people.canonical.com/~ubuntu-archive/proposed-migration/jammy/update_excuses.html#binutils

[1] https://wiki.ubuntu.com/StableReleaseUpdates#Autopkgtest_Regressions

Thank you!

Revision history for this message
Brian Murray (brian-murray) wrote :

The failing autopkgtests have been re-run and everything passed.

Revision history for this message
bugproxy (bugproxy) wrote : Comment bridged from LTC Bugzilla

------- Comment From <email address hidden> 2022-09-29 10:33 EDT-------
The issue was reproduced on Ubuntu 22.04

---uname output---
Linux 5.15.0-48-generic #54-Ubuntu SMP Fri Aug 26 13:27:34 UTC 2022 ppc64le ppc64le ppc64le GNU/Linux

?Steps to recreate ---
install the following packages
dpkg -i libbinutils_2.38-3ubuntu1_ppc64el.deb
dpkg -i binutils-common_2.38-3ubuntu1_ppc64el.deb
dpkg -i binutils-powerpc64le-linux-gnu_2.38-3ubuntu1_ppc64el.deb

Clone the glibc repository and build glibc.
git clone git://sourceware.org/git/glibc.git
git reset ?hard 2d5ec6692f5746ccb11db60976a6481ef8e9d74f
mkdir build && cd build
../glibc/configure ?prefix=$HOME/prefix && make -j8 && make check

---Error Message---
Generating locale C.UTF-8: this might take a while...
Segmentation fault
Charmap: "UTF-8" Inputfile: "C" Outputdir: "C.UTF-8" failed

---Fix---
The latest binutils package on Ubuntu 22.04 has the above mentioned fix included, so updating to the below mentioned packages resolved the issue.

binutils-powerpc64le-linux-gnu_2.38-4ubuntu2_ppc64el.deb
libbinutils_2.38-4ubuntu2_ppc64el.deb
binutils-common_2.38-4ubuntu2_ppc64el.deb

tags: removed: verification-needed
tags: added: verification-done-jammy
removed: verification-needed-jammy
Revision history for this message
Launchpad Janitor (janitor) wrote :

This bug was fixed in the package binutils - 2.38-4ubuntu2

---------------
binutils (2.38-4ubuntu2) jammy-proposed; urgency=medium

  * SRU: LP: #1982105. Update from the binutils 2.38 branch:
    - IBM zSystems: Add support for z16 as CPU name. LP: #1974115.
    - Fix PR libctf/29242, linking together multiple objects derived from
      the same source.
    - PowerPC64: fix assertion in ppc_build_one_stub with -Os code.
    - Fix PR ld/29216, x86: Properly handle IFUNC function pointer reference.
    - AArch64: Enable FP16 by default for Armv9-A.
    - Fix PR binutils/29142, segv in ar with empty archive and libdeps
      specified.
    - M68K: avoid quadratic slowdlow in label alignment check.
    - Adjust ld ctf test for 32-bit targets.

binutils (2.38-4ubuntu1) kinetic; urgency=medium

  * Merge with Debian; remaining changes:
    - Build from upstream sources.

binutils (2.38-4) unstable; urgency=medium

  * Update from the binutils 2.38 branch:
    - Fix PR ld/29087, x86: invalid relocation against protected symbol.
    - s390: Add DT_JMPREL pointing to .rela.[i]plt with static-pie.
    - Fix PR ld/22263, s390: Avoid dynamic TLS relocs in PIE.
    - Fix PR libctf/28933: ld: diagnose corrupted CTF header cth_strlen.
    - Fix PR 28885.
    - PR28959, obdump doesn't disassemble mftb instruction.
    - PowerPC64 DT_RELR relative reloc addresses. LP: #1978129.
  * Fix reproducible builds: source tarball embeds build user and group.
    Closes: #1010238.

 -- Matthias Klose <email address hidden> Tue, 19 Jul 2022 12:17:47 +0200

Changed in binutils (Ubuntu Jammy):
status: Fix Committed → Fix Released
Revision history for this message
Łukasz Zemczak (sil2100) wrote : Update Released

The verification of the Stable Release Update for binutils has completed successfully and the package is now being released to -updates. Subsequently, the Ubuntu Stable Release Updates Team is being unsubscribed and will not receive messages about this bug report. In the event that you encounter a regression using the package from -updates please report a new bug using ubuntu-bug and tag the bug report regression-update so we can easily find any regressions.

Frank Heimes (fheimes)
Changed in ubuntu-power-systems:
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.