-
e76289d...
by
Tom de Vries <email address hidden>
-
[gdb/symtab] Use task size in parallel for in process_queue
-
3240a7e...
by
Tom de Vries <email address hidden>
-
[gdb/symtab] Fix data race in lookup_die_type
Data race between:
...
Write of size 8 at 0x7b8009b483f8 by main thread:
#0 read_tag_pointer_type gdb/dwarf2/read.c:16171 (gdb+0x8580b3)
#1 read_type_die_1 gdb/dwarf2/read.c:21508 (gdb+0x869b69)
#2 read_type_die gdb/dwarf2/read.c:21474 (gdb+0x869a53)
#3 lookup_die_type gdb/dwarf2/read.c:21446 (gdb+0x8699ad)
#4 die_type gdb/dwarf2/read.c:21300 (gdb+0x869286)
#5 dwarf2_add_field gdb/dwarf2/read.c:13535 (gdb+0x84aabd)
#6 handle_struct_member_die gdb/dwarf2/read.c:14803 (gdb+0x851ad2)
#7 process_structure_scope gdb/dwarf2/read.c:14865 (gdb+0x851e70)
#8 process_die gdb/dwarf2/read.c:8649 (gdb+0x83a048)
#9 read_file_scope gdb/dwarf2/read.c:9616 (gdb+0x83cb81)
#10 process_die gdb/dwarf2/read.c:8620 (gdb+0x839f43)
#11 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x839509)
#12 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...
and:
...
Previous read of size 8 at 0x7b8009b483f8 by thread T3:
#0 dwarf2_cu::addr_type() const gdb/dwarf2/cu.c:99 (gdb+0x7b8d42)
#1 set_die_type gdb/dwarf2/read.c:23850 (gdb+0x871e4e)
#2 read_subroutine_type gdb/dwarf2/read.c:16539 (gdb+0x8591c8)
#3 read_type_die_1 gdb/dwarf2/read.c:21499 (gdb+0x869b15)
#4 read_type_die gdb/dwarf2/read.c:21474 (gdb+0x869a53)
#5 lookup_die_type gdb/dwarf2/read.c:21446 (gdb+0x8699ad)
#6 die_type gdb/dwarf2/read.c:21300 (gdb+0x869286)
#7 read_tag_pointer_type gdb/dwarf2/read.c:16114 (gdb+0x857d91)
#8 read_type_die_1 gdb/dwarf2/read.c:21508 (gdb+0x869b69)
#9 read_type_die gdb/dwarf2/read.c:21474 (gdb+0x869a53)
#10 lookup_die_type gdb/dwarf2/read.c:21446 (gdb+0x8699ad)
#11 die_type gdb/dwarf2/read.c:21300 (gdb+0x869286)
#12 new_symbol gdb/dwarf2/read.c:20742 (gdb+0x8671fe)
#13 read_variable gdb/dwarf2/read.c:12623 (gdb+0x848823)
#14 process_die gdb/dwarf2/read.c:8716 (gdb+0x83a28c)
#15 read_file_scope gdb/dwarf2/read.c:9616 (gdb+0x83cb81)
#16 process_die gdb/dwarf2/read.c:8620 (gdb+0x839f43)
#17 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x839509)
#18 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...
Fix this by adding a lock in lookup_die_type.
Also in read_type_die and set_die_type.
Hmm, we already use another lock in set_die_type. This needs more work.
-
333d407...
by
Tom de Vries <email address hidden>
-
[gdb/symtab] Fix data race on objfile->template_symbols
Data race between:
...
Read of size 8 at 0x7b4000006dd8 by thread T4:
#0 new_symbol gdb/dwarf2/read.c:21085 (gdb+0x868212)
#1 handle_struct_member_die gdb/dwarf2/read.c:14828 (gdb+0x851be8)
#2 process_structure_scope gdb/dwarf2/read.c:14865 (gdb+0x851e70)
#3 process_die gdb/dwarf2/read.c:8649 (gdb+0x83a048)
#4 read_namespace gdb/dwarf2/read.c:16026 (gdb+0x857a32)
#5 process_die gdb/dwarf2/read.c:8689 (gdb+0x83a100)
#6 read_file_scope gdb/dwarf2/read.c:9616 (gdb+0x83cb81)
#7 process_die gdb/dwarf2/read.c:8620 (gdb+0x839f43)
#8 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x839509)
#9 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...
and:
...
Previous write of size 8 at 0x7b4000006dd8 by main thread:
#0 new_symbol gdb/dwarf2/read.c:21086 (gdb+0x868247)
#1 handle_struct_member_die gdb/dwarf2/read.c:14828 (gdb+0x851be8)
#2 process_structure_scope gdb/dwarf2/read.c:14865 (gdb+0x851e70)
#3 process_die gdb/dwarf2/read.c:8649 (gdb+0x83a048)
#4 read_namespace gdb/dwarf2/read.c:16026 (gdb+0x857a32)
#5 process_die gdb/dwarf2/read.c:8689 (gdb+0x83a100)
#6 read_file_scope gdb/dwarf2/read.c:9616 (gdb+0x83cb81)
#7 process_die gdb/dwarf2/read.c:8620 (gdb+0x839f43)
#8 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x839509)
#9 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...
Fix this by adding a lock in new_symbol for adding to
objfile->template_symbols.
-
4f005db...
by
Tom de Vries <email address hidden>
-
[gdb/symtab] Fix data race in add_compunit_symtab_to_objfile
Data race bewteen:
...
Read of size 8 at 0x7b4000006d20 by thread T3:
#0 add_compunit_symtab_to_objfile(compunit_symtab*) gdb/symfile.c:2852
(gdb+0xe89cff)
#1 buildsym_compunit::end_compunit_symtab_with_blockvector(block*, int,
int) gdb/buildsym.c:1018 (gdb+0x63e857)
#2 buildsym_compunit::end_compunit_symtab_from_static_block(block*, int,
int) gdb/buildsym.c:1052 (gdb+0x63e8cd)
#3 process_full_comp_unit gdb/dwarf2/read.c:8414 (gdb+0x8396b6)
#4 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...
and:
...
Previous write of size 8 at 0x7b4000006d20 by thread T4:
#0 add_compunit_symtab_to_objfile(compunit_symtab*) gdb/symfile.c:2853
(gdb+0xe89d35)
#1 buildsym_compunit::end_compunit_symtab_with_blockvector(block*, int,
int) gdb/buildsym.c:1018 (gdb+0x63e857)
#2 buildsym_compunit::end_compunit_symtab_from_static_block(block*, int,
int) gdb/buildsym.c:1052 (gdb+0x63e8cd)
#3 process_full_comp_unit gdb/dwarf2/read.c:8414 (gdb+0x8396b6)
#4 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...
Fix this by adding a lock in add_compunit_symtab_to_objfile.
-
b4303a0...
by
Tom de Vries <email address hidden>
-
[gdb] Fix data race in cleanup_undefined_stabs_types
Data race for:
...
Read of size 4 at 0x00000324db04 by thread T1:
#0 cleanup_undefined_types_1 /home/vries/gdb_versions/devel/src/gdb/stabsread.c:4437 (gdb+0xe60bdd)
#1 cleanup_undefined_stabs_types(objfile*) /home/vries/gdb_versions/devel/src/gdb/stabsread.c:4500 (gdb+0xe60c48)
#2 buildsym_compunit::end_compunit_symtab_get_static_block(unsigned long, int, int) /home/vries/gdb_versions/devel/src/gdb/buildsym.c:837 (gdb+0x63dbba)
#3 process_full_comp_unit /home/vries/gdb_versions/devel/src/gdb/dwarf2/read.c:8404 (gdb+0x8395f4)
#4 process_queue_item /home/vries/gdb_versions/devel/src/gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...
and location:
...
Location is global 'undef_types_length' of size 4 at 0x00000324db04
...
Likewise for:
...
WARNING: ThreadSanitizer: data race (pid=12737)
Read of size 4 at 0x00000324db1c by thread T4:
#0 cleanup_undefined_types_noname /home/vries/gdb_versions/devel/src/gdb/stabsread.c:4383 (gdb+0xe608b2)
#1 cleanup_undefined_stabs_types(objfile*) /home/vries/gdb_versions/devel/src/gdb/stabsread.c:4501 (gdb+0xe60c54)
#2 buildsym_compunit::end_compunit_symtab_get_static_block(unsigned long, int, int) /home/vries/gdb_versions/devel/src/gdb/buildsym.c:837 (gdb+0x63dbba)
#3 process_full_comp_unit /home/vries/gdb_versions/devel/src/gdb/dwarf2/read.c:8404 (gdb+0x8395f4)
#4 process_queue_item /home/vries/gdb_versions/devel/src/gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...
and location:
...
Location is global 'noname_undefs_length' of size 4 at 0x00000324db1c
...
Fix this by adding a lock in cleanup_undefined_stabs_types.
-
c2ae16c...
by
Tom de Vries <email address hidden>
-
[gdb/symtab] Fix race condition in just_read_cus
Race condition between:
...
Read of size 8 at 0x7b640001f2c8 by thread T1:
#0 std::vector<dwarf2_per_cu_data*, std::allocator<dwarf2_per_cu_data*>
>::push_back(dwarf2_per_cu_data* const&)
/usr/include/c++/12/bits/stl_vector.h:1278 (gdb+0x888ad6)
#1 process_full_comp_unit gdb/dwarf2/read.c:8451 (gdb+0x8397d0)
#2 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...
and:
...
Previous write of size 8 at 0x7b640001f2c8 by main thread:
#0 std::vector<dwarf2_per_cu_data*, std::allocator<dwarf2_per_cu_data*>
>::push_back(dwarf2_per_cu_data* const&)
/usr/include/c++/12/bits/stl_vector.h:1283 (gdb+0x888b52)
#1 process_full_comp_unit gdb/dwarf2/read.c:8451 (gdb+0x8397d0)
#2 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x8359f5)
...
Fix this by doing the just_read_cus push_back in a lock.
-
a4f4bbc...
by
Tom de Vries <email address hidden>
-
[gdb] Fix data race in bitfield
Data race between:
...
Write of size 4 at 0x7b8009b483f0 by thread T2:
#0 set_type_align(type*, unsigned long) /home/vries/gdb_versions/devel/src/gdb/gdbtypes.c:3751 (gdb+0x961e08)
...
and:
...
Previous read of size 1 at 0x7b8009b483f1 by thread T4:
#0 type::instance_flags() const /home/vries/gdb_versions/devel/src/gdb/gdbtypes.h:1092 (gdb+0x59e74b)
...
corresponding to:
...
unsigned align_log2 : TYPE_ALIGN_BITS;
unsigned m_instance_flags : 9;
...
Fix this by wrapping them using "struct { ... };".
For now, don't worry about size increase, we might have to address this later
using packed.
Still, is this a correct fix? Maybe the problem is modifying a type from
different thread. If so, having this patch for now may expose that problem.
-
2f8fd1d...
by
Tom de Vries <email address hidden>
-
[gdb] Fix data race in bcache::insert
Data race between:
...
Read of size 8 at 0x7bb4000000d0 by thread T4:
#0 gdb::bcache::insert(void const*, int, bool*) gdb/bcache.c:155
#1 objfile_per_bfd_storage::intern(char const*) gdb/objfiles.h:250
#2 objfile::intern(char const*) gdb/objfiles.h:475
#3 dwarf2_canonicalize_name gdb/dwarf2/read.c:21904
#4 dwarf2_name gdb/dwarf2/read.c:21999
#5 read_base_type gdb/dwarf2/read.c:17092
#6 read_type_die_1 gdb/dwarf2/read.c:21529
#7 read_type_die gdb/dwarf2/read.c:21464
#8 process_die gdb/dwarf2/read.c:8674
#9 read_file_scope gdb/dwarf2/read.c:9610
#10 process_die gdb/dwarf2/read.c:8614
#11 process_full_comp_unit gdb/dwarf2/read.c:8383
#12 process_queue_item gdb/dwarf2/read.c:7592
...
and:
...
Previous write of size 8 at 0x7bb4000000d0 by main thread:
#0 gdb::bcache::insert(void const*, int, bool*) gdb/bcache.c:167
#1 objfile_per_bfd_storage::intern(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&) gdb/objfiles.h:257
#2 objfile::intern(std::__cxx11::basic_string<char,
std::char_traits<char>, std::allocator<char> > const&) <null>
#3 dwarf2_compute_name gdb/dwarf2/read.c:9050
#4 dwarf2_full_name gdb/dwarf2/read.c:9070
#5 read_structure_type gdb/dwarf2/read.c:14558
#6 process_structure_scope gdb/dwarf2/read.c:14847
#7 process_die gdb/dwarf2/read.c:8643
#8 read_file_scope gdb/dwarf2/read.c:9610
#9 process_die gdb/dwarf2/read.c:8614
#10 process_full_comp_unit gdb/dwarf2/read.c:8383
#11 process_queue_item gdb/dwarf2/read.c:7592
...
-
b0a46c9...
by
Tom de Vries <email address hidden>
-
[gdb/symtab] Fix data race in get_die_type_at_offset
Data race between:
...
==================
WARNING: ThreadSanitizer: data race (pid=28142)
Read of size 4 at 0x7b1c0004b978 by thread T2:
#0 htab_find_with_hash libiberty/hashtab.c:591 (gdb+0x1c5a254)
#1 htab_find libiberty/hashtab.c:621 (gdb+0x1c5a44d)
#2 get_die_type_at_offset gdb/dwarf2/read.c:23877 (gdb+0x872004)
#3 get_die_type gdb/dwarf2/read.c:23890 (gdb+0x8720d0)
#4 read_type_die gdb/dwarf2/read.c:21460 (gdb+0x8698e4)
#5 process_die gdb/dwarf2/read.c:8674 (gdb+0x839f6e)
#6 read_file_scope gdb/dwarf2/read.c:9610 (gdb+0x83ca5d)
#7 process_die gdb/dwarf2/read.c:8614 (gdb+0x839e1f)
#8 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x83945e)
#9 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x83597d)
...
and:
...
Previous write of size 4 at 0x7b1c0004b978 by thread T1:
#0 htab_find_with_hash libiberty/hashtab.c:591 (gdb+0x1c5a26e)
#1 htab_find libiberty/hashtab.c:621 (gdb+0x1c5a44d)
#2 get_die_type_at_offset gdb/dwarf2/read.c:23877 (gdb+0x872004)
#3 get_die_type gdb/dwarf2/read.c:23890 (gdb+0x8720d0)
#4 process_structure_scope gdb/dwarf2/read.c:14845 (gdb+0x851c12)
#5 process_die gdb/dwarf2/read.c:8643 (gdb+0x839f24)
#6 read_file_scope gdb/dwarf2/read.c:9610 (gdb+0x83ca5d)
#7 process_die gdb/dwarf2/read.c:8614 (gdb+0x839e1f)
#8 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x83945e)
#9 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x83597d)
...
Fix by using lock, also in set_die_type.
-
1994769...
by
Tom de Vries <email address hidden>
-
[gdb/symtab] Fix data race in objstats->n_syms
Data race between:
...
Read of size 4 at 0x7b4000006dc8 by main thread:
#0 new_symbol gdb/dwarf2/read.c:20704 (gdb+0x866f3e)
#1 process_die gdb/dwarf2/read.c:8674 (gdb+0x839fa8)
#2 read_file_scope gdb/dwarf2/read.c:9610 (gdb+0x83ca7f)
#3 process_die gdb/dwarf2/read.c:8614 (gdb+0x839e41)
#4 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x839480)
#5 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x83599f)
...
and:
...
Previous write of size 4 at 0x7b4000006dc8 by thread T2:
#0 new_symbol gdb/dwarf2/read.c:20704 (gdb+0x866f5d)
#1 process_die gdb/dwarf2/read.c:8674 (gdb+0x839fa8)
#2 read_file_scope gdb/dwarf2/read.c:9610 (gdb+0x83ca7f)
#3 process_die gdb/dwarf2/read.c:8614 (gdb+0x839e41)
#4 process_full_comp_unit gdb/dwarf2/read.c:8383 (gdb+0x839480)
#5 process_queue_item gdb/dwarf2/read.c:7592 (gdb+0x83599f)
...
Fix by making objstats->n_syms atomic. Likewise for n_types.