Bug 31261 - [gdb] ThreadSanitizer: data race objfiles.c:648 in objfile_relocate1
Summary: [gdb] ThreadSanitizer: data race objfiles.c:648 in objfile_relocate1
Status: RESOLVED FIXED
Alias: None
Product: gdb
Classification: Unclassified
Component: gdb (show other bugs)
Version: HEAD
: P2 normal
Target Milestone: 15.1
Assignee: Tom Tromey
URL:
Keywords:
Depends on:
Blocks:
 
Reported: 2024-01-18 09:29 UTC by Tom de Vries
Modified: 2024-05-04 16:07 UTC (History)
2 users (show)

See Also:
Host:
Target:
Build:
Last reconfirmed:


Attachments

Note You need to log in before you can comment on or make changes to this bug.
Description Tom de Vries 2024-01-18 09:29:15 UTC
When building gdb with O0 fsanitize=thread, and running test-case gdb.base/break-interp.exp (and likewise in gdb.base/gcore-relro-pie.exp, gdb.base/gcore-tls-pie.exp,  gdb.base/jit-attach-pie.exp, gdb.base/pie-execl.exp and gdb.base/relocate.exp), I get: 
...
PASS: gdb.base/break-interp.exp: ldprelink=NO: ldsepdebug=NO: binprelink=NO: binsepdebug=IN: binpie=YES: INNER: core: seen displacement message as NONZERO
==================
[1m[31mWARNING: ThreadSanitizer: data race (pid=534320)
[1m[0m[1m[34m  Write of size 8 at 0xffffedcd4c20 by main thread:
[1m[0m    #0 objfile_relocate1 /home/vries/gdb/src/gdb/objfiles.c:648 (gdb+0xc50604) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #1 objfile_relocate(objfile*, std::vector<unsigned long, std::allocator<unsigned long> > const&) /home/vries/gdb/src/gdb/objfiles.c:681 (gdb+0xc507c0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #2 svr4_relocate_main_executable /home/vries/gdb/src/gdb/solib-svr4.c:3004 (gdb+0xed6d60) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #3 svr4_solib_create_inferior_hook /home/vries/gdb/src/gdb/solib-svr4.c:3048 (gdb+0xed6ef8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #4 solib_create_inferior_hook(int) /home/vries/gdb/src/gdb/solib.c:1217 (gdb+0xee78c4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #5 post_create_inferior(int) /home/vries/gdb/src/gdb/infcmd.c:275 (gdb+0xa76e9c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #6 core_target_open(char const*, int) /home/vries/gdb/src/gdb/corelow.c:723 (gdb+0x764080) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #7 core_file_command(char const*, int) /home/vries/gdb/src/gdb/corelow.c:409 (gdb+0x762f88) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #8 do_simple_func /home/vries/gdb/src/gdb/cli/cli-decode.c:95 (gdb+0x6e444c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #9 cmd_func(cmd_list_element*, char const*, int) /home/vries/gdb/src/gdb/cli/cli-decode.c:2735 (gdb+0x6ebb88) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #10 execute_command(char const*, int) /home/vries/gdb/src/gdb/top.c:575 (gdb+0xff748c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #11 command_handler(char const*) /home/vries/gdb/src/gdb/event-top.c:566 (gdb+0x942488) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #12 command_line_handler(std::unique_ptr<char, gdb::xfree_deleter<char> >&&) /home/vries/gdb/src/gdb/event-top.c:802 (gdb+0x942bc0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #13 tui_command_line_handler /home/vries/gdb/src/gdb/tui/tui-interp.c:104 (gdb+0x10365f8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #14 gdb_rl_callback_handler /home/vries/gdb/src/gdb/event-top.c:259 (gdb+0x941884) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #15 rl_callback_read_char /home/vries/gdb/src/readline/readline/callback.c:290 (gdb+0x11a2c7c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #16 gdb_rl_callback_read_char_wrapper_noexcept /home/vries/gdb/src/gdb/event-top.c:195 (gdb+0x9415f8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #17 gdb_rl_callback_read_char_wrapper /home/vries/gdb/src/gdb/event-top.c:234 (gdb+0x941720) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #18 stdin_event_handler /home/vries/gdb/src/gdb/ui.c:155 (gdb+0x1079320) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #19 handle_file_event /home/vries/gdb/src/gdbsupport/event-loop.cc:573 (gdb+0x1cf5678) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #20 gdb_wait_for_event /home/vries/gdb/src/gdbsupport/event-loop.cc:694 (gdb+0x1cf5d3c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #21 gdb_do_one_event(int) /home/vries/gdb/src/gdbsupport/event-loop.cc:264 (gdb+0x1cf4074) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #22 start_event_loop /home/vries/gdb/src/gdb/main.c:408 (gdb+0xb79354) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #23 captured_command_loop /home/vries/gdb/src/gdb/main.c:472 (gdb+0xb79584) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #24 captured_main /home/vries/gdb/src/gdb/main.c:1342 (gdb+0xb7b99c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #25 gdb_main(captured_main_args*) /home/vries/gdb/src/gdb/main.c:1361 (gdb+0xb7ba4c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #26 main /home/vries/gdb/src/gdb/gdb.c:39 (gdb+0x423ce8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)

[1m[34m  Previous read of size 8 at 0xffffedcd4c20 by thread T4:
[1m[0m    #0 objfile::text_section_offset() const /home/vries/gdb/src/gdb/objfiles.h:484 (gdb+0x51ee94) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #1 dwarf2_per_objfile::adjust(unrelocated_addr) /home/vries/gdb/src/gdb/dwarf2/read.c:1215 (gdb+0x89110c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #2 read_addrmap_from_aranges(dwarf2_per_objfile*, dwarf2_section_info*, addrmap_mutable*, deferred_warnings*) /home/vries/gdb/src/gdb/dwarf2/aranges.c:194 (gdb+0x7ee4c8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #3 cooked_index_worker::do_reading() /home/vries/gdb/src/gdb/dwarf2/read.c:4931 (gdb+0x89ed08) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #4 cooked_index_worker::start_reading() /home/vries/gdb/src/gdb/dwarf2/read.c:4911 (gdb+0x89ea8c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #5 operator() /home/vries/gdb/src/gdb/dwarf2/read.c:4849 (gdb+0x89e4f0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #6 __invoke_impl<void, cooked_index_worker::start()::<lambda()>&> /usr/include/c++/13/bits/invoke.h:61 (gdb+0x8deb58) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #7 __invoke_r<void, cooked_index_worker::start()::<lambda()>&> /usr/include/c++/13/bits/invoke.h:111 (gdb+0x8ddb60) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #8 _M_invoke /usr/include/c++/13/bits/std_function.h:290 (gdb+0x8dada0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #9 std::function<void ()>::operator()() const /usr/include/c++/13/bits/std_function.h:591 (gdb+0x70c308) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #10 void std::__invoke_impl<void, std::function<void ()>&>(std::__invoke_other, std::function<void ()>&) /usr/include/c++/13/bits/invoke.h:61 (gdb+0x810db4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #11 std::enable_if<is_invocable_r_v<void, std::function<void ()>&>, void>::type std::__invoke_r<void, std::function<void ()>&>(std::function<void ()>&) /usr/include/c++/13/bits/invoke.h:111 (gdb+0x810ad4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #12 std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}::operator()() const /usr/include/c++/13/future:1491 (gdb+0x8107a0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #13 std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>::operator()() const /usr/include/c++/13/future:1432 (gdb+0x811998) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #14 std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter> std::__invoke_impl<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&>(std::__invoke_other, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&) /usr/include/c++/13/bits/invoke.h:61 (gdb+0x811734) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #15 std::enable_if<is_invocable_r_v<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&>, std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> >::type std::__invoke_r<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&>(std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void>&) /usr/include/c++/13/bits/invoke.h:116 (gdb+0x811284) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #16 std::_Function_handler<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> (), std::__future_base::_Task_setter<std::unique_ptr<std::__future_base::_Result<void>, std::__future_base::_Result_base::_Deleter>, std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run()::{lambda()#1}, void> >::_M_invoke(std::_Any_data const&) /usr/include/c++/13/bits/std_function.h:291 (gdb+0x810eb8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #17 std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>::operator()() const /usr/include/c++/13/bits/std_function.h:591 (gdb+0x7fd404) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #18 std::__future_base::_State_baseV2::_M_do_set(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*) /usr/include/c++/13/future:589 (gdb+0x7fb8c0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #19 void std::__invoke_impl<void, void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::__invoke_memfun_deref, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/13/bits/invoke.h:74 (gdb+0x802ff8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #20 std::__invoke_result<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>::type std::__invoke<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) /usr/include/c++/13/bits/invoke.h:96 (gdb+0x7fff6c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #21 std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#1}::operator()() const <null> (gdb+0x7fcf64) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #22 std::once_flag::_Prepare_execution::_Prepare_execution<std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#1}>(void (std::__future_base::_State_baseV2::*&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*))::{lambda()#1}::operator()() const /usr/include/c++/13/mutex:836 (gdb+0x7fffe8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #23 std::once_flag::_Prepare_execution::_Prepare_execution<std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&)::{lambda()#1}>(void (std::__future_base::_State_baseV2::*&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*))::{lambda()#1}::_FUN() /usr/include/c++/13/mutex:836 (gdb+0x800034) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #24 pthread_once <null> (libtsan.so.2+0x66d3c) (BuildId: fe872cc4563474b7ad67d63a019aa94e1e0df888)
    #25 __gthread_once /usr/include/c++/13/aarch64-redhat-linux/bits/gthr-default.h:700 (gdb+0x7faef0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #26 void std::call_once<void (std::__future_base::_State_baseV2::*)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*>(std::once_flag&, void (std::__future_base::_State_baseV2::*&&)(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*, bool*), std::__future_base::_State_baseV2*&&, std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>*&&, bool*&&) <null> (gdb+0x7fd02c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #27 std::__future_base::_State_baseV2::_M_set_result(std::function<std::unique_ptr<std::__future_base::_Result_base, std::__future_base::_Result_base::_Deleter> ()>, bool) /usr/include/c++/13/future:428 (gdb+0x7fb4f8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #28 std::__future_base::_Task_state<std::function<void ()>, std::allocator<int>, void ()>::_M_run() /usr/include/c++/13/future:1494 (gdb+0x810834) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #29 std::packaged_task<void ()>::operator()() /usr/include/c++/13/future:1628 (gdb+0x1d0f4a0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #30 gdb::thread_pool::thread_function() /home/vries/gdb/src/gdbsupport/thread-pool.cc:246 (gdb+0x1d0e820) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #31 void std::__invoke_impl<void, void (gdb::thread_pool::*)(), gdb::thread_pool*>(std::__invoke_memfun_deref, void (gdb::thread_pool::*&&)(), gdb::thread_pool*&&) /usr/include/c++/13/bits/invoke.h:74 (gdb+0x1d12968) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #32 std::__invoke_result<void (gdb::thread_pool::*)(), gdb::thread_pool*>::type std::__invoke<void (gdb::thread_pool::*)(), gdb::thread_pool*>(void (gdb::thread_pool::*&&)(), gdb::thread_pool*&&) /usr/include/c++/13/bits/invoke.h:96 (gdb+0x1d12804) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #33 void std::thread::_Invoker<std::tuple<void (gdb::thread_pool::*)(), gdb::thread_pool*> >::_M_invoke<0ul, 1ul>(std::_Index_tuple<0ul, 1ul>) /usr/include/c++/13/bits/std_thread.h:292 (gdb+0x1d126e4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #34 std::thread::_Invoker<std::tuple<void (gdb::thread_pool::*)(), gdb::thread_pool*> >::operator()() /usr/include/c++/13/bits/std_thread.h:299 (gdb+0x1d1266c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #35 std::thread::_State_impl<std::thread::_Invoker<std::tuple<void (gdb::thread_pool::*)(), gdb::thread_pool*> > >::_M_run() /usr/include/c++/13/bits/std_thread.h:244 (gdb+0x1d12618) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #36 execute_native_thread_routine <null> (libstdc++.so.6+0xdda9c) (BuildId: 93e3778007c3847dd08373eb42577dc85c8750e4)

[1m[32m  Location is heap block of size 304 at 0xffffedcd4bc0 allocated by main thread:
[1m[0m    #0 operator new(unsigned long) <null> (libtsan.so.2+0x901f8) (BuildId: fe872cc4563474b7ad67d63a019aa94e1e0df888)
    #1 std::__new_allocator<unsigned long>::allocate(unsigned long, void const*) /usr/include/c++/13/bits/new_allocator.h:151 (gdb+0x45b284) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #2 std::allocator_traits<std::allocator<unsigned long> >::allocate(std::allocator<unsigned long>&, unsigned long) /usr/include/c++/13/bits/alloc_traits.h:482 (gdb+0x458a40) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #3 std::_Vector_base<unsigned long, std::allocator<unsigned long> >::_M_allocate(unsigned long) /usr/include/c++/13/bits/stl_vector.h:378 (gdb+0x458a40)
    #4 std::vector<unsigned long, std::allocator<unsigned long> >::_M_default_append(unsigned long) /usr/include/c++/13/bits/vector.tcc:663 (gdb+0xf576e4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #5 std::vector<unsigned long, std::allocator<unsigned long> >::resize(unsigned long) /usr/include/c++/13/bits/stl_vector.h:1013 (gdb+0xf547d8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #6 default_symfile_offsets(objfile*, std::vector<other_sections, std::allocator<other_sections> > const&) /home/vries/gdb/src/gdb/symfile.c:629 (gdb+0xf46e8c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #7 syms_from_objfile_1 /home/vries/gdb/src/gdb/symfile.c:962 (gdb+0xf47c78) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #8 syms_from_objfile /home/vries/gdb/src/gdb/symfile.c:981 (gdb+0xf47d58) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #9 symbol_file_add_with_addrs /home/vries/gdb/src/gdb/symfile.c:1084 (gdb+0xf4822c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #10 symbol_file_add_from_bfd(gdb::ref_ptr<bfd, gdb_bfd_ref_policy> const&, char const*, enum_flags<symfile_add_flag>, std::vector<other_sections, std::allocator<other_sections> >*, enum_flags<objfile_flag>, objfile*) /home/vries/gdb/src/gdb/symfile.c:1158 (gdb+0xf485a8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #11 symbol_file_add(char const*, enum_flags<symfile_add_flag>, std::vector<other_sections, std::allocator<other_sections> >*, enum_flags<objfile_flag>) /home/vries/gdb/src/gdb/symfile.c:1171 (gdb+0xf48634) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #12 symbol_file_add_main_1 /home/vries/gdb/src/gdb/symfile.c:1195 (gdb+0xf48748) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #13 symbol_file_command(char const*, int) /home/vries/gdb/src/gdb/symfile.c:1675 (gdb+0xf49e00) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #14 file_command /home/vries/gdb/src/gdb/exec.c:561 (gdb+0x94718c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #15 do_simple_func /home/vries/gdb/src/gdb/cli/cli-decode.c:95 (gdb+0x6e444c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #16 cmd_func(cmd_list_element*, char const*, int) /home/vries/gdb/src/gdb/cli/cli-decode.c:2735 (gdb+0x6ebb88) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #17 execute_command(char const*, int) /home/vries/gdb/src/gdb/top.c:575 (gdb+0xff748c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #18 command_handler(char const*) /home/vries/gdb/src/gdb/event-top.c:566 (gdb+0x942488) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #19 command_line_handler(std::unique_ptr<char, gdb::xfree_deleter<char> >&&) /home/vries/gdb/src/gdb/event-top.c:802 (gdb+0x942bc0) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #20 tui_command_line_handler /home/vries/gdb/src/gdb/tui/tui-interp.c:104 (gdb+0x10365f8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #21 gdb_rl_callback_handler /home/vries/gdb/src/gdb/event-top.c:259 (gdb+0x941884) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #22 rl_callback_read_char /home/vries/gdb/src/readline/readline/callback.c:290 (gdb+0x11a2c7c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #23 gdb_rl_callback_read_char_wrapper_noexcept /home/vries/gdb/src/gdb/event-top.c:195 (gdb+0x9415f8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #24 gdb_rl_callback_read_char_wrapper /home/vries/gdb/src/gdb/event-top.c:234 (gdb+0x941720) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #25 stdin_event_handler /home/vries/gdb/src/gdb/ui.c:155 (gdb+0x1079320) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #26 handle_file_event /home/vries/gdb/src/gdbsupport/event-loop.cc:573 (gdb+0x1cf5678) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #27 gdb_wait_for_event /home/vries/gdb/src/gdbsupport/event-loop.cc:694 (gdb+0x1cf5d3c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #28 gdb_do_one_event(int) /home/vries/gdb/src/gdbsupport/event-loop.cc:264 (gdb+0x1cf4074) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #29 start_event_loop /home/vries/gdb/src/gdb/main.c:408 (gdb+0xb79354) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #30 captured_command_loop /home/vries/gdb/src/gdb/main.c:472 (gdb+0xb79584) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #31 captured_main /home/vries/gdb/src/gdb/main.c:1342 (gdb+0xb7b99c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #32 gdb_main(captured_main_args*) /home/vries/gdb/src/gdb/main.c:1361 (gdb+0xb7ba4c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #33 main /home/vries/gdb/src/gdb/gdb.c:39 (gdb+0x423ce8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)

[1m[36m  Thread T4 'gdb worker' (tid=534331, running) created by main thread at:
[1m[0m    #0 pthread_create <null> (libtsan.so.2+0x4605c) (BuildId: fe872cc4563474b7ad67d63a019aa94e1e0df888)
    #1 std::thread::_M_start_thread(std::unique_ptr<std::thread::_State, std::default_delete<std::thread::_State> >, void (*)()) <null> (libstdc++.so.6+0xddbe4) (BuildId: 93e3778007c3847dd08373eb42577dc85c8750e4)
    #2 gdb::thread_pool::set_thread_count(unsigned long) /home/vries/gdb/src/gdbsupport/thread-pool.cc:169 (gdb+0x1d0e4b4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #3 update_thread_pool_size() /home/vries/gdb/src/gdb/maint.c:866 (gdb+0xb87c70) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #4 captured_main_1 /home/vries/gdb/src/gdb/main.c:1062 (gdb+0xb7a8a4) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #5 captured_main /home/vries/gdb/src/gdb/main.c:1332 (gdb+0xb7b998) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #6 gdb_main(captured_main_args*) /home/vries/gdb/src/gdb/main.c:1361 (gdb+0xb7ba4c) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)
    #7 main /home/vries/gdb/src/gdb/gdb.c:39 (gdb+0x423ce8) (BuildId: 6dc308d9bc2da51d7adf979315fabd66fb46e8a3)

SUMMARY: ThreadSanitizer: data race /home/vries/gdb/src/gdb/objfiles.c:648 in objfile_relocate1
==================
warning: platform-specific solib_create_inferior_hook did not load initial shared libraries.
Reading symbols from /home/vries/gdb/build/gdb/testsuite/outputs/gdb.base/break-interp/break-interp-BINprelinkNOdebugINpieYES.d/break-interp.so...
Reading symbols from /home/vries/gdb/build/gdb/testsuite/outputs/gdb.base/break-interp/break-interp-BINprelinkNOdebugINpieYES.d/libm.so.6...
Reading symbols from .gnu_debugdata for /home/vries/gdb/build/gdb/testsuite/outputs/gdb.base/break-interp/break-interp-BINprelinkNOdebugINpieYES.d/libm.so.6...
(No debugging symbols found in .gnu_debugdata for /home/vries/gdb/build/gdb/testsuite/outputs/gdb.base/break-interp/break-interp-BINprelinkNOdebugINpieYES.d/libm.so.6)
Reading symbols from /home/vries/gdb/build/gdb/testsuite/outputs/gdb.base/break-interp/break-interp-BINprelinkNOdebugINpieYES.d/libc.so.6...
(No debugging symbols found in /home/vries/gdb/build/gdb/testsuite/outputs/gdb.base/break-interp/break-interp-BINprelinkNOdebugINpieYES.d/libc.so.6)
Reading symbols from /home/vries/gdb/build/gdb/testsuite/outputs/gdb.base/break-interp/break-interp-LDprelinkNOdebugNO...
(No debugging symbols found in /home/vries/gdb/build/gdb/testsuite/outputs/gdb.base/break-interp/break-interp-LDprelinkNOdebugNO)
Reading symbols from system-supplied DSO at 0xfffecf650000...
(No debugging symbols found in system-supplied DSO at 0xfffecf650000)
[Thread debugging using libthread_db enabled]
Using host libthread_db library "/lib64/libthread_db.so.1".
Core was generated by `/home/vries/gdb/build/gdb/testsuite/outputs/gdb.base/break-interp/break-interp-'.
Program terminated with signal SIGSEGV, Segmentation fault.
#0  0x0000fffecf3c2280 in __pthread_kill_implementation () from /home/vries/gdb/build/gdb/testsuite/outputs/gdb.base/break-interp/break-interp-BINprelinkNOdebugINpieYES.d/libc.so.6
(gdb) PASS: gdb.base/break-interp.exp: ldprelink=NO: ldsepdebug=NO: binprelink=NO: binsepdebug=IN: binpie=YES: INNER: core: core loaded
...
Comment 1 Tom de Vries 2024-01-22 14:30:22 UTC
(In reply to Tom de Vries from comment #0)
> gdb.base/break-interp.exp (and likewise in gdb.base/gcore-relro-pie.exp,
> gdb.base/gcore-tls-pie.exp,  gdb.base/jit-attach-pie.exp,
> gdb.base/pie-execl.exp and gdb.base/relocate.exp)

Test-case gdb.base/relocate.exp bisects to:
...
commit 33c6eaaefcedd45e86d564d014f14cce2620f933 (HEAD)
Author: Tom Tromey <tom@tromey.com>
Date:   Fri Mar 24 23:35:02 2023 -0600

    Do more DWARF reading in the background
...
Comment 2 Tom Tromey 2024-01-31 02:24:02 UTC
A simple way here would be to require the readers to be
done before relocation can proceed.

However, I think it would be better to use unrelocated
types more.  The only problem is that MIPS uses the
dwarf2 gdbarch hook to modify addresses, and it does
a minsym lookup... but this could also be done
unrelocated.
Comment 3 Tom Tromey 2024-02-10 22:10:43 UTC
Right now the lookup is done by searching all objfiles.
However, that seems weird, since surely the debuginfo
could only really describe a symbol in the current objfile.

I hope this is true since it's really the only way to
make this work ok using unrelocated addresses.

Maybe it's possible to test this on one of the MIPS
machines in the compile farm.
Comment 4 Tom Tromey 2024-02-16 02:42:49 UTC
I have a patch that seems to work & that fixes the sanitizer problem.
I'll submit it soon.  I still haven't tested on MIPS.
Comment 5 Tom Tromey 2024-02-23 16:10:16 UTC
https://sourceware.org/pipermail/gdb-patches/2024-February/206633.html

However last night I was wondering if this complicated
stuff is even necessary.  It seems to me that this MIPS16
special case can't really affect the index anyway.
Comment 6 Tom Tromey 2024-03-09 00:31:50 UTC
(In reply to Tom Tromey from comment #5)
> https://sourceware.org/pipermail/gdb-patches/2024-February/206633.html
> 
> However last night I was wondering if this complicated
> stuff is even necessary.  It seems to me that this MIPS16
> special case can't really affect the index anyway.

The way the code is shared in the DWARF reader makes this a
little trickier than I thought.  It still might be better though.

I wonder why MIPS16 has to work this weird way.
Comment 7 Joel Brobecker 2024-04-20 18:27:07 UTC
FTR: New patches series (simpler) sent for review.
https://sourceware.org/pipermail/gdb-patches/2024-April/208159.html
Comment 8 Sourceware Commits 2024-05-04 16:07:20 UTC
The master branch has been updated by Tom Tromey <tromey@sourceware.org>:

https://sourceware.org/git/gitweb.cgi?p=binutils-gdb.git;h=b42d685452f7b797dd87ff2856e1959a975e902a

commit b42d685452f7b797dd87ff2856e1959a975e902a
Author: Tom Tromey <tom@tromey.com>
Date:   Mon Apr 1 17:06:10 2024 -0600

    Remove dwarf2_per_objfile::adjust
    
    All the calls to dwarf2_per_objfile::adjust have been removed, so we
    can remove this function entirely.
    
    Bug: https://sourceware.org/bugzilla/show_bug.cgi?id=31261
Comment 9 Tom Tromey 2024-05-04 16:07:43 UTC
Fixed.