Bug 26517 - glibc isn't properly stripped off debuginfo which then leaks in rpm testsuite
Summary: glibc isn't properly stripped off debuginfo which then leaks in rpm testsuite
Status: RESOLVED FIXED
Alias: None
Product: Mageia
Classification: Unclassified
Component: RPM Packages (show other bugs)
Version: Cauldron
Hardware: All Linux
Priority: Normal normal
Target Milestone: ---
Assignee: Thomas Backlund
QA Contact:
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2020-04-21 16:35 CEST by Thierry Vignaud
Modified: 2020-05-19 11:44 CEST (History)
0 users

See Also:
Source RPM: glibc
CVE:
Status comment:


Attachments
we never ever ship glibc-debug in mga... (3.33 KB, patch)
2020-05-08 07:14 CEST, Thierry Vignaud
Details | Diff
kill very old obsoletes (874 bytes, patch)
2020-05-08 07:15 CEST, Thierry Vignaud
Details | Diff
Generating debuginfo like FC does remove most references to CSU ( "C start up") but one (3.37 KB, application/mbox)
2020-05-09 15:10 CEST, Thierry Vignaud
Details
"readelf --debug-dump=info" of bogus minimal C program on Fedora (1.26 KB, text/plain)
2020-05-09 15:19 CEST, Thierry Vignaud
Details
"readelf --debug-dump=info" of bogus minimal C program on Centos7 (1.16 KB, text/plain)
2020-05-09 15:20 CEST, Thierry Vignaud
Details
"readelf --debug-dump=info" of bogus minimal C program on Debian (1.20 KB, text/plain)
2020-05-09 15:20 CEST, Thierry Vignaud
Details
"readelf --debug-dump=info" of bogus minimal C program on Mageia (10x bigger output!) (12.50 KB, text/plain)
2020-05-09 15:21 CEST, Thierry Vignaud
Details
"readelf --debug-dump=info" of bogus minimal C program on Mageia (patched glibc) (9.43 KB, text/plain)
2020-05-09 15:22 CEST, Thierry Vignaud
Details
strip debug from libc_nonshared.a (684 bytes, patch)
2020-05-09 16:10 CEST, Thierry Vignaud
Details | Diff
"readelf --debug-dump=info" of bogus minimal C program on Mageia (uber-patched glibc) (1.27 KB, text/plain)
2020-05-09 16:12 CEST, Thierry Vignaud
Details

Description Thierry Vignaud 2020-04-21 16:35:59 CEST
See https://github.com/rpm-software-management/rpm/pull/1156

rpm testsuite it consistently fails on Mageia b/c readelf returns more stuff:

$ readelf --debug-dump=info ./usr/lib/debug/usr/local/bin/hello2*.debug | grep comp_dir
<24> DW_AT_comp_dir : (indirect string, offset: 0x52a): /home/iurt/rpmbuild/BUILD/glibc-2.31/csu
<43> DW_AT_comp_dir : (indirect string, offset: 0x52a): /home/iurt/rpmbuild/BUILD/glibc-2.31/csu
<86> DW_AT_comp_dir : (indirect string, offset: 0x52a): /home/iurt/rpmbuild/BUILD/glibc-2.31/csu
DW_AT_comp_dir : (indirect string, offset: 0x0): /usr/src/debug/hello-1.0
<3ff> DW_AT_comp_dir : (indirect string, offset: 0x52a): /home/iurt/rpmbuild/BUILD/glibc-2.31/csu
<5dd> DW_AT_comp_dir : (indirect string, offset: 0x52a): /home/iurt/rpmbuild/BUILD/glibc-2.31/csu

$ readelf --debug-dump=info ./usr/lib/debug/usr/local/bin/hello2*.debug | grep csu
<24> DW_AT_comp_dir : (indirect string, offset: 0x52a): /home/iurt/rpmbuild/BUILD/glibc-2.31/csu
<43> DW_AT_comp_dir : (indirect string, offset: 0x52a): /home/iurt/rpmbuild/BUILD/glibc-2.31/csu
<86> DW_AT_comp_dir : (indirect string, offset: 0x52a): /home/iurt/rpmbuild/BUILD/glibc-2.31/csu
<3ff> DW_AT_comp_dir : (indirect string, offset: 0x52a): /home/iurt/rpmbuild/BUILD/glibc-2.31/csu
<4df> DW_AT_name : (indirect string, offset: 0x391): __libc_csu_fini
<4f9> DW_AT_name : (indirect string, offset: 0x474): __libc_csu_init
<5dd> DW_AT_comp_dir : (indirect string, offset: 0x52a): /home/iurt/rpmbuild/BUILD/glibc-2.31/csu

I've workarounded by filtering glibc's csu in rpm testsuite but upstream says:
"glibc hasn't been properly stripped off debuginfo which is then leaking elsewhere.
Fix glibc packaging and it should go away."

Can you check glibc?
Comment 1 Thierry Vignaud 2020-05-08 06:44:51 CEST
I confirm that the behavior is consistent on Fedora/CentOs/Debian.
Only mga saw such "symbol leaks"
Comment 2 Thierry Vignaud 2020-05-08 06:50:27 CEST
You can test by using:
$ echo 'int main() {}'>test.c
$ gcc -o test test.c -g
$ LC_ALL=C readelf --debug-dump=info test|grep csu
    <24>   DW_AT_comp_dir    : (indirect string, offset: 0x1a): /home/iurt/rpmbuild/BUILD/glibc-2.31/csu
    <43>   DW_AT_comp_dir    : (indirect string, offset: 0x1a): /home/iurt/rpmbuild/BUILD/glibc-2.31/csu
    <86>   DW_AT_comp_dir    : (indirect string, offset: 0x1a): /home/iurt/rpmbuild/BUILD/glibc-2.31/csu
    <a5>   DW_AT_comp_dir    : (indirect string, offset: 0x1a): /home/iurt/rpmbuild/BUILD/glibc-2.31/csu
    <143>   DW_AT_name        : (indirect string, offset: 0x1c0): __libc_csu_fini
    <15d>   DW_AT_name        : (indirect string, offset: 0x2d5): __libc_csu_init
    <241>   DW_AT_comp_dir    : (indirect string, offset: 0x1a): /home/iurt/rpmbuild/BUILD/glibc-2.31/csu
Comment 3 Thierry Vignaud 2020-05-08 06:56:08 CEST
Humm, on second though, it might not be glibc, but it could be gcc/binutils or the combinaison of the lot of them, or our build flags when building glibc(?).

If you compile the same dumb test program (w/o any flags) under Fedora & on Mageia, using readelf against the same Mageia's glibc give different results:

$ LC_ALL=C readelf --debug-dump=info ~/t-FC|grep DW_AT_name
    <11>   DW_AT_name        : t.c
    <2e>   DW_AT_name        : (indirect string, offset: 0x6a): main
    <4e>   DW_AT_name        : int
$ LC_ALL=C readelf --debug-dump=info ~/t-mga|grep DW_AT_name
    <20>   DW_AT_name        : (indirect string, offset: 0x0): ../sysdeps/x86_64/start.S
    <3f>   DW_AT_name        : (indirect string, offset: 0x1a7): init.c
    <4c>   DW_AT_name        : (indirect string, offset: 0x13f): _IO_stdin_used
    <64>   DW_AT_name        : int
    <82>   DW_AT_name        : (indirect string, offset: 0x15d): ../sysdeps/x86_64/crti.S
    <a1>   DW_AT_name        : (indirect string, offset: 0x1a3): elf-init.c
    <c0>   DW_AT_name        : (indirect string, offset: 0x17b): long int
    <c5>   DW_AT_name        : (indirect string, offset: 0x197): size_t
    <d8>   DW_AT_name        : (indirect string, offset: 0x1ae): long unsigned int
    <df>   DW_AT_name        : int
    <e6>   DW_AT_name        : (indirect string, offset: 0x176): long long int
    <ed>   DW_AT_name        : (indirect string, offset: 0x2ea): long double
    <126>   DW_AT_name        : (indirect string, offset: 0x2c6): char
    <12b>   DW_AT_name        : (indirect string, offset: 0x184): __init_array_start
    <137>   DW_AT_name        : (indirect string, offset: 0x2f6): __init_array_end
    <143>   DW_AT_name        : (indirect string, offset: 0x1c0): __libc_csu_fini
    <15d>   DW_AT_name        : (indirect string, offset: 0x2d5): __libc_csu_init
    <17b>   DW_AT_name        : (indirect string, offset: 0x2cb): argc
    <18f>   DW_AT_name        : (indirect string, offset: 0x2e5): argv
    <1a3>   DW_AT_name        : (indirect string, offset: 0x19e): envp
    <1b7>   DW_AT_name        : (indirect string, offset: 0x2d0): size
    <1e0>   DW_AT_name        : i
    <221>   DW_AT_name        : (indirect string, offset: 0x2df): _init
    <23d>   DW_AT_name        : (indirect string, offset: 0x307): ../sysdeps/x86_64/crtn.S

Striping symbols make all of that disappear
Comment 4 Thierry Vignaud 2020-05-08 07:14:54 CEST
Created attachment 11622 [details]
we never ever ship glibc-debug in mga...
Comment 5 Thierry Vignaud 2020-05-08 07:15:37 CEST
Created attachment 11623 [details]
kill very old obsoletes
Comment 6 Thierry Vignaud 2020-05-09 15:10:38 CEST
Created attachment 11624 [details]
Generating debuginfo like FC does remove most references to CSU ( "C start up") but one
Comment 7 Thierry Vignaud 2020-05-09 15:19:40 CEST
Created attachment 11625 [details]
"readelf --debug-dump=info" of bogus minimal C program on Fedora

Just run:
echo 'int main() {}'>t.c && gcc -o t t.c && readelf --debug-dump=info t
Comment 8 Thierry Vignaud 2020-05-09 15:20:32 CEST
Created attachment 11626 [details]
"readelf --debug-dump=info" of bogus minimal C program on Centos7
Comment 9 Thierry Vignaud 2020-05-09 15:20:51 CEST
Created attachment 11627 [details]
"readelf --debug-dump=info" of bogus minimal C program on Debian
Comment 10 Thierry Vignaud 2020-05-09 15:21:23 CEST
Created attachment 11628 [details]
"readelf --debug-dump=info" of bogus minimal C program on Mageia (10x bigger output!)
Comment 11 Thierry Vignaud 2020-05-09 15:22:55 CEST
Created attachment 11629 [details]
"readelf --debug-dump=info" of bogus minimal C program on Mageia (patched glibc)

Only one reference to /home/tv/mga/pkgs/glibc/BUILD/glibc-2.31/csu when glibc is patched with attached patch
Comment 12 Thierry Vignaud 2020-05-09 15:24:36 CEST
Thomas, are you OK if I run "git svn dcommit" for the first 2 patches?
- cleaning -debug subpkg which was never emitted (and thus never tested) for 10+ years
- killing very old obsoletes
Comment 13 Thierry Vignaud 2020-05-09 15:32:36 CEST
BTW Thomas, if you want to play with rpm's testsuite:
1) disable patch 183
2) build it
3) you can play with the 2 tests broken by glibc with:
./rpmtests 350
./rpmtests 351

You'll see the extra line that breaks the tests:
+pkgs/glibc/BUILD/glibc-2.31/csu


In the ./rpmtests.log file
Comment 14 Thierry Vignaud 2020-05-09 15:33:24 CEST
(one extra line with my patch over glibc.patch, quite a lot more if using Cauldron's glibc)
Comment 15 Thierry Vignaud 2020-05-09 15:34:42 CEST
$ rpm -ql glibc-devel|LC_ALL=C xargs fgrep 'pkgs/glibc/BUILD/glibc-2.31/csu'
Binary file /usr/lib/Mcrt1.o matches
Binary file /usr/lib/Scrt1.o matches
Binary file /usr/lib/crt1.o matches
Binary file /usr/lib/crti.o matches
Binary file /usr/lib/crtn.o matches
Binary file /usr/lib/gcrt1.o matches
Binary file /usr/lib/libc_nonshared.a matches
Binary file /usr/lib64/libc_nonshared.a matches
Comment 16 Thierry Vignaud 2020-05-09 16:10:22 CEST
Created attachment 11630 [details]
strip debug from libc_nonshared.a

This fixes the last reference of /home/tv/mga/pkgs/glibc/BUILD/glibc-2.31/csu (comparing with my previous glibc build, vs 5 "/home/iurt/rpmbuild/BUILD/glibc-2.31/csu" if comparing with Cauldron's glibc)

BTW the srtip loop above does nothing, at least on x86_64:

+ [[ x86_64 != \x\8\6\_\6\4 ]]
+ pushd /home/tv/mga/pkgs/glibc/BUILDROOT/glibc-2.31-8.1.mga8.x86_64/lib64
~/mga/pkgs/glibc/BUILDROOT/glibc-2.31-8.1.mga8.x86_64/lib64 ~/mga/pkgs/glibc/BUILD/glibc-2.31
+ for i in *.a
+ '[' -f '*.a' ']'
+ popd
Comment 17 Thierry Vignaud 2020-05-09 16:12:04 CEST
Created attachment 11631 [details]
"readelf --debug-dump=info" of bogus minimal C program on Mageia (uber-patched glibc)

Note that the readelf ouput is now similar to Fedora/CentOs/Debian:

-    <15>   DW_AT_comp_dir    : (indirect string, offset: 0x0): /home/tvignaud/Téléchargements
+    <11>   DW_AT_name        : (indirect string, offset: 0x47): /home/tv/t.c
+    <15>   DW_AT_comp_dir    : (indirect string, offset: 0x0): /home/tv/mga/pkgs/glibc
Comment 18 Thomas Backlund 2020-05-09 22:16:59 CEST
(In reply to Thierry Vignaud from comment #12)
> Thomas, are you OK if I run "git svn dcommit" for the first 2 patches?
> - cleaning -debug subpkg which was never emitted (and thus never tested) for
> 10+ years
> - killing very old obsoletes

Ack on theese two...

I will look at the rest soon-ish
Comment 19 Thomas Backlund 2020-05-19 11:44:27 CEST
fixes added in glibc-2.31-10.mga8

Status: NEW => RESOLVED
Resolution: (none) => FIXED


Note You need to log in before you can comment on or make changes to this bug.