Gentoo Websites Logo
Go to: Gentoo Home Documentation Forums Lists Bugs Planet Store Wiki Get Gentoo!
Bug 929063 - dev-util/debugedit-5.0-r3: generate broken DWARF5 debug info
Summary: dev-util/debugedit-5.0-r3: generate broken DWARF5 debug info
Status: UNCONFIRMED
Alias: None
Product: Gentoo Linux
Classification: Unclassified
Component: Current packages (show other bugs)
Hardware: All Linux
: Normal normal (vote)
Assignee: Michał Górny
URL:
Whiteboard:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-04-10 14:01 UTC by 12101111
Modified: 2024-04-10 14:16 UTC (History)
2 users (show)

See Also:
Package list:
Runtime testing required: ---


Attachments
DWARF dump of edited file (hello.dwarf,7.19 KB, text/plain)
2024-04-10 14:02 UTC, 12101111
Details
DWARF dump of original file (hello.orig.dwarf,7.03 KB, text/plain)
2024-04-10 14:03 UTC, 12101111
Details
emerge --info (emerge-info,7.86 KB, text/plain)
2024-04-10 14:07 UTC, 12101111
Details

Note You need to log in before you can comment on or make changes to this bug.
Description 12101111 2024-04-10 14:01:31 UTC
I found that after upgrading to debugedit 5.0-r3, many packages had corrupted or truncated debug symbols.

example 1: a backtrace of clang in lldb

https://github.com/llvm/llvm-project/issues/84062#issuecomment-2042168153

example 2: gdb /usr/bin/telegram-desktop

Offset from DW_FORM_GNU_str_index or DW_FORM_strx pointing outside of .debug_str.dwo section in CU at offset 0x27e6b732 [in module /usr/bin/telegram-desktop]
Offset from DW_FORM_GNU_str_index or DW_FORM_strx pointing outside of .debug_str.dwo section in CU at offset 0x2802d4d8 [in module /usr/bin/telegram-desktop]
Offset from DW_FORM_GNU_str_index or DW_FORM_strx pointing outside of .debug_str.dwo section in CU at offset 0x281cedd9 [in module /usr/bin/telegram-desktop]
...
(gdb) bt
#0  0x00007ffff7e62cad in __cp_end () at /lib/ld-musl-x86_64.so.1
#1  0x00007ffff7e5dbc0 in __syscall_cp_c (nr=7, u=<optimized out>, v=140737352445101, w=<optimized out>, x=<optimized out>, y=<optimized out>, z=<optimized out>) at src/thread/pthread_cancel.c:33
#2  0x00007ffff7e49f05 in poll (fds=<optimized out>, n=<optimized out>, timeout=<optimized out>) at src/select/poll.c:9
#3  0x00007ffff0073b3d in g_main_context_poll_unlocked (context=0x7ffbe7c03090, timeout=<optimized out>, n_fds=4, priority=<optimized out>, fds=<optimized out>) at ../glib-2.78.4/glib/gmain.c:4653
#4  g_main_context_iterate_unlocked (context=0x7ffbe7c03090, block=<optimized out>, dispatch=1, self=<optimized out>) at ../glib-2.78.4/glib/gmain.c:4344
#5  0x00007ffff0073d1d in g_main_context_iteration (context=0x7ffbe7c03090, may_block=1) at ../glib-2.78.4/glib/gmain.c:4414
#6  0x00007ffff062d2c3 in QEventDispatcherGlib::processEvents (this=0x7fd6e7c26190, this@entry=<error reading variable: value has been optimized out>, flags=<error reading variable: value has been optimized out>)
    at /tmp/portage/dev-qt/qtbase-6.7.0-r1/work/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qeventdispatcher_glib.cpp:394
#7  0x00007ffff08a8f76 in QEventLoop::processEvents (this=0x7fffffffac78, flags=...) at /tmp/portage/dev-qt/qtbase-6.7.0-r1/work/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qeventloop.cpp:100
#8  QEventLoop::exec (this=0x7fffffffac78, flags=...) at /tmp/portage/dev-qt/qtbase-6.7.0-r1/work/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qeventloop.cpp:182
#9  0x00007ffff08a8bb7 in QCoreApplication::exec () at /tmp/portage/dev-qt/qtbase-6.7.0-r1/work/qtbase-everywhere-src-6.7.0/src/corelib/kernel/qcoreapplication.cpp:1478
#10 0x000055555c7f690c in _ZNS4_ISV_S2_ZNKS5_ISV_S2_E6eventsEvEUlS9_E_EclISV_S2_ZNSD_IRKSV_S2_EEDaSG_EUlS9_E_SV_S2_EEDaSM_EUlS9_E_EES1K_EEES1D_EEDaSM_EUlS9_E_EEDaONSI_ISL_SJ_T2_EEENUlS9_E_clINSP_IS1A_S2_NS3_IS1A_S2_ZNS10_18CreateWorkingHoursES15_S18_E4$_15ZNS0_orIS1A_S2_S28_S2A_vEEvSM_ONS0_18lifetime_with_nextIS25_EEEUlvE_ZNS2B_IS1A_S2_S28_S2A_vEEvSM_S2E_EUlvE0_EEEEEEDaS9_EUlOS1D_E_ZZNKS1F_IS1A_S2_S1C_S24_EEDaS27_ENS29_IS2I_EEDaS9_EUlSG_E_ZZNKS1F_IS1A_S2_S1C_S24_EEDaS27_ENS29_IS2I_EEDaS9_EUlvE_EEEEZZNS1I_ISW_S2_S23_S1D_EEDaSM_ENS24_clINSP_IS1D_S2_S2N_EEEEDaS9_EUlSG_E_ZZNS1I_ISW_S2_S23_S1D_EEDaSM_ENS2P_IS2Q_EEDaS9_EUlvE_EEEEJbSU_SV_bEE9subscribeIbS2_SN_EEvSM_EUlObE_ZNS2W_IbS2_SN_EEvSM_EUlSG_E_ZNS2W_IbS2_SN_EEvSM_EUlvE_EEEEEEDaS9_EUlSG_E_ZZNSC_IbS2_SH_bS2_EEDaSM_ENSO_IS32_EEDaS9_EUlSG_E0_ZZNSC_IbS2_SH_bS2_EEDaSM_ENSO_IS32_EEDaS9_EUlvE_EEE13take_handlersEv (EEDaS15_ENS34_IS35_EEDaST_EUlvE_EEE10terminatorEvENUlvE_D2Ev=0x7fffffffaea0)
    at /usr/src/debug/net-im/telegram-desktop-4.16.4/tdesktop-4.16.4-full/Telegram/SourceFiles/core/sandbox.cpp:174
#11 0x000055555c7cc4e4 in 1type_erased_generatorIbS7_EEZNS5_10map_helperIZNSB_15waitForLikeIconESH_SI_E3$_0EclINS4_11empty_valueES7_ZNS5_11then_helperIS10_S7_NSU_IS10_S7_EEEclIS10_S7_ZNS4_6singleIRKS10_S7_EEDaOT_EUlRKS18_E_S10_S7_EEDaONS4_8producerIS18_T0_T1_EEEUlS1B_E_NS1D_IbS7_SV_EEEEDaS1H_EUlS1B_E_EEDaONS1D_IS1G_S1E_T2_EEEUlS1B_E_vEEDaS1H_EUlS1B_E_EEDaS1H_EUlS1B_E_SJ_vEENS4_8lifetimeES1H_ONS5_9with_nextIS1L_EEEUlvE_ZNSK_IbS7_S1Q_SJ_vEES1R_S1H_S1U_EUlvE0_EEE10terminatorEvEUlvE_EES19_NSt3__117integral_constantIbLb1EEE
    (EEDaS15_ENS34_IS35_EEDaST_EUlvE_EEE10terminatorEvENUlvE_D2Ev=EEDaS15_ENS34_IS35_EEDaST_EUlvE_EEE10terminatorEvENUlvE_D2Ev@entry=0x7ffbe7c03b10) at /usr/src/debug/net-im/telegram-desktop-4.16.4/tdesktop-4.16.4-full/Telegram/SourceFiles/core/launcher.cpp:582
#12 0x000055555c7cc05d in ducer.h:798:3), (lambda at /tmp/portage/net-im/telegram-desktop-4.16.4/work/tdesktop-4.16.4-full/Telegram/lib_rpl/rpl/producer.h:799:3)> > (EEDaS15_ENS34_IS35_EEDaST_EUlvE_EEE10terminatorEvENUlvE_D2Ev=0x7ffbe7c03b10)
    at /usr/src/debug/net-im/telegram-desktop-4.16.4/tdesktop-4.16.4-full/Telegram/SourceFiles/core/launcher.cpp:388
#13 0x000055555e71073e in 8_NS5_20type_erased_handlersIiS8_EEEEEEDaSS_EUlOSM_E_ZZNKSF_IiS8_ST_EEDaSQ_ENSV_ISZ_EEDaSS_EUlS10_E0_ZZNKSF_IiS8_ST_EEDaSQ_ENSV_ISZ_EEDaSS_EUlvE_EEEEZZNSI_IS7_S8_SK_iEEDaSQ_ENST_clINSW_IiS8_S14_EEEEDaSS_EUlS10_E_ZZNSI_IS7_S8_SK_iEEDaSQ_ENS16_IS17_EEDaSS_EUlvE_EEE10terminatorEvEUlvE_NS1_IS1C_EEFvvEEEEEEclB8ne180100EPS1F_ (EEDaS15_ENS34_IS35_EEDaST_EUlvE_EEE10terminatorEvENUlvE_D2Ev=0x7ffbe7c03b10, EEDaS15_ENS34_IS35_EEDaST_EUlvE_EEE10terminatorEvENUlvE_D2Ev@entry=<error reading variable: value has been optimized out>)
    at /usr/src/debug/net-im/telegram-desktop-4.16.4/tdesktop-4.16.4-full/Telegram/SourceFiles/platform/linux/launcher_linux.cpp:33
#14 0x000055555f3d982e in _EUlvE_EEE10terminatorEvEUlvE_TnNS_9enable_ifIXntsr7is_sameIu7__decayISD_ES3_EE5valueEiE4typeELi0EEESM_
    (allocator_destructorINSA_ISM_EEEEEcvbB8ne180100Ev=<optimized out>, _EENSO_IS8_S5_NSS_IS8_S5_EEEEEEESL_vEEvSX_ONS3_18lifetime_with_nextIT2_EEEUlvE_ZNSM_IS8_S5_S14_SL_vEEvSX_S18_EUlvE0_EEEEE9subscribeIS8_S5_S10_EEvSX_EUlSA_E_ZNS1E_IS8_S5_S10_EEvSX_EUlSA_E0_ZNS1E_IS8_S5_S10_EEvSX_EUlvE_EEEEZZNSR_IbS5_ST_S8_EEDaSX_ENS10_clINSD_IS8_S5_S1I_EEEEDaSZ_EUlSA_E_ZZNSR_IbS5_ST_S8_EEDaSX_ENS1K_IS1L_EEDaSZ_EUlvE_EEEES1O_E17__get_second_baseB8ne180100EPS1Q_=<optimized out>) at /usr/src/debug/net-im/telegram-desktop-4.16.4/tdesktop-4.16.4-full/Telegram/SourceFiles/main.cpp:12


Reproducible: Always

Steps to Reproduce:
1.clang -g hello.c -o hello.orig
2.cp hello.orig hello
3.debugedit -i -b /tmp -d /var/tmp hello
4.llvm-dwarfdump hello > hello.dwarf
5.llvm-dwarfdump hello.orig > hello.orig.dwarf
Actual Results:  
strings in DWARF are broken:

 0x000000be: DW_TAG_compile_unit
-              DW_AT_producer	("clang version 18.1.3+libcxx")
+              DW_AT_producer	("har")
               DW_AT_language	(DW_LANG_C11)
-              DW_AT_name	("/home/han/misc/hello.c")
+              DW_AT_name	("e/han/misc/hello.c")
               DW_AT_str_offsets_base	(0x0000003c)
               DW_AT_stmt_list	(0x000000d6)
-              DW_AT_comp_dir	("/tmp")
+              DW_AT_comp_dir	("p/portage/sys-libs/musl-1.2.4-r1/work/musl-1.2.4")
               DW_AT_low_pc	(0x0000000000001620)
               DW_AT_high_pc	(0x0000000000001645)
               DW_AT_addr_base	(0x00000020)
Comment 1 12101111 2024-04-10 14:02:49 UTC
Created attachment 890150 [details]
DWARF dump of edited file
Comment 2 12101111 2024-04-10 14:03:42 UTC
Created attachment 890151 [details]
DWARF dump of original file
Comment 3 12101111 2024-04-10 14:07:06 UTC
Created attachment 890152 [details]
emerge --info
Comment 4 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-04-10 14:08:23 UTC
Thanks. Could you report it upstream at https://sourceware.org/bugzilla/?
Comment 5 Sam James archtester Gentoo Infrastructure gentoo-dev Security 2024-04-10 14:16:25 UTC
I can't reproduce the problematic difference with your example commands, but I tested on glibc.

```
$ diff -ruN hello.dwarf hello.orig.dwarf
--- hello.dwarf 2024-04-10 15:14:33.873715546 +0100
+++ hello.orig.dwarf    2024-04-10 15:14:36.557740520 +0100
@@ -1,4 +1,4 @@
-hello: file format elf64-x86-64
+hello.orig:    file format elf64-x86-64

 .debug_info contents:
 0x00000000: Compile Unit: length = 0x00000051, format = DWARF32, version = 0x0005, unit_type = DW_UT_compile, abbr_offset = 0x0000, addr_size = 0x08 (next unit at 0x00000055)
@@ -9,14 +9,14 @@
               DW_AT_name       ("hello.c")
               DW_AT_str_offsets_base   (0x00000008)
               DW_AT_stmt_list  (0x00000000)
-              DW_AT_comp_dir   ("/var/tmp")
+              DW_AT_comp_dir   ("/tmp")
[...]
```

with /tmp/hello.c:
```
#include <stdio.h>

int main() {
        printf("hi\n");
}
```

Also, where's dwo coming for you from? (are you using -gsplit-dwarf)?