SRU: Fix libtsan0 (10.5.0-1ubuntu1~20.04) missing libtsan_preinit.o

Bug #2029910 reported by Anton Martinsen
66
This bug affects 11 people
Affects Status Importance Assigned to Milestone
gcc-9 (Ubuntu)
Confirmed
Undecided
Unassigned
Focal
Confirmed
Undecided
Unassigned

Bug Description

The libtsan0 package built from gcc-10 used to ship the libtsan_preinit.o file in the shared library package libtsan0. That was correctly fixed with the update to GCC 10.5.0, moving it into libgcc-10-dev's private GCC libdir, however then making it unavailable for gcc-9. This patch ships the .o file in libgcc-9-dev as well.

Test case:
echo "int main(){}" | gcc -fsanitize=thread -x c -

fails linking before the fix, and succeeds after.

The regression potential is low, there are no changes to code, and the change only affects the thread sanitizer which is not in use by default.

The packages are pre-built in a PPA with just the security pocket enabled.

Original report:
================

When running sudo apt-get install libtsan0, the file libtsan_preinit.o which is supposed to be installed is not installed.

I had to compile it from gcc source code and add it manually.

I am running unfortunately running Pop!
But the same issue happens on my friends Ubuntu.
And it has been re-created on several Docker images of Ubuntu 20.04.

$ lsb_release -rd
Description: Pop!_OS 20.04 LTS
Release: 20.04

$ apt-cache policy libtsan0
libtsan0:
  Installed: 10.5.0-1ubuntu1~20.04
  Candidate: 10.5.0-1ubuntu1~20.04
  Version table:
 *** 10.5.0-1ubuntu1~20.04 500
        500 http://us.archive.ubuntu.com/ubuntu focal-security/main amd64 Packages
        500 http://us.archive.ubuntu.com/ubuntu focal-updates/main amd64 Packages
        100 /var/lib/dpkg/status
     10-20200411-0ubuntu1 500
        500 http://us.archive.ubuntu.com/ubuntu focal/main amd64 Packages

Let me know if you need any more info or if this is sufficient to re-create the issue.

Best regards,
A

Revision history for this message
Launchpad Janitor (janitor) wrote :

Status changed to 'Confirmed' because the bug affects multiple users.

Changed in gcc-10 (Ubuntu):
status: New → Confirmed
Revision history for this message
Robert N (bert-n) wrote :

Can confirm - the file in question is simply not contained in the archive in question for version 10.5.0 (e.g. https://packages.ubuntu.com/focal/amd64/libtsan0/download)

Revision history for this message
Maxim Egorushkin (max0x7ba) wrote (last edit ):

I hit this bug in Ubuntu-20.04 in Github actions environment: https://github.com/orgs/community/discussions/63391

Revision history for this message
Clément Peron (peron-clem) wrote (last edit ):

I also hit this bug on Ubuntu 20.04.

@Matthias Klose

It seems to come from the merge with latest Debian upstream

The changelog mention this: + * Fix libtsan0 build (when building the libs built by newer GCC versions).

And the binary-libtsan.mk remove the libtsan_preinit.o

- $(usr_lib$(2))/libtsan.so.* \
- $(usr_lib$(2))/libtsan_preinit.o
+ $(usr_lib$(2))/libtsan.so.*

Revision history for this message
Matthias Klose (doko) wrote :

please install libgcc-10-dev

$ dpkg -S libtsan_preinit.o
libgcc-10-dev:amd64: /usr/lib/gcc/x86_64-linux-gnu/10/libtsan_preinit.o

the libtsan0 package only contains the shared runtime library

Revision history for this message
Matthias Klose (doko) wrote :

however if you have the default gcc/g++ installed, the file should be available by default.

Revision history for this message
Markus (greenrobot42) wrote :

Just wanted to note that this also happens on an aarch64 Ubuntu 20.04 image with default versions (build-essentials installed).

# gcc --version
gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0

Revision history for this message
Matthias Klose (doko) wrote :

confirmed, needs an update, however cant't do that immediately

Changed in gcc-10 (Ubuntu Focal):
status: New → Confirmed
Revision history for this message
Clément Peron (peron-clem) wrote (last edit ):

@doko I tested with libgcc-9-dev on both AMD64 and ARM64 Ubuntu 20.04 but It doesn't fix the issue :(

$> sudo apt intall libgcc-9-dev
$> dpkg -S libtsan_preinit.o
0.257 dpkg-query: no path found matching pattern *libtsan_preinit.o*

Dockerfile

```
from ubuntu:20.04

RUN apt update && apt install -y gcc libgcc-9-dev

RUN uname -m && gcc --version

RUN echo "int main(){}" | gcc -fsanitize=thread -x c -
```

$> docker --platform XXXX build .

#7 [3/4] RUN uname -m && gcc --version
#7 0.153 x86_64 / aarch64
#7 0.175 gcc (Ubuntu 9.4.0-1ubuntu1~20.04.2) 9.4.0

 > [4/4] RUN echo "int main(){}" | gcc -fsanitize=thread -x c -:
0.205 /usr/bin/ld: cannot find libtsan_preinit.o: No such file or directory
0.205 collect2: error: ld returned 1 exit status

Matthias Klose (doko)
affects: gcc-10 (Ubuntu) → gcc-9 (Ubuntu)
Matthias Klose (doko)
summary: - libtsan0 (10.5.0-1ubuntu1~20.04) missing libtsan_preinit.o
+ SRU: Fix libtsan0 (10.5.0-1ubuntu1~20.04) missing libtsan_preinit.o
Matthias Klose (doko)
description: updated
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.