https://gcc.gnu.org/bugzilla/show_bug.cgi?id=81382
Bug ID: 81382 Summary: glibc deadlock in signal handler Product: gcc Version: 7.0 URL: https://bugzilla.suse.com/show_bug.cgi?id=1047882 Status: UNCONFIRMED Severity: normal Priority: P3 Component: driver Assignee: unassigned at gcc dot gnu.org Reporter: marxin at gcc dot gnu.org Target Milestone: --- I have a stress tester which ends time to time in a deadlock: #0 __lll_lock_wait_private () at ../sysdeps/unix/sysv/linux/x86_64/lowlevellock.S:95 #1 0x00002b872a9ce818 in _int_free (av=0x2b872acf3ae0 <main_arena>, p=0x345f4d0, have_lock=0) at malloc.c:3969 #2 0x000000000127128a in xcallocator<hash_map<mem_alloc_description<mem_usage>::mem_location_hash, mem_usage*, simple_hashmap_traits<default_hash_traits<mem_alloc_description<mem_usage>::mem_location_hash>, mem_usage*> >::hash_entry>::data_free (memory=<optimized out>) at .././../gcc/hash-table.h:273 #3 hash_table<hash_map<mem_alloc_description<mem_usage>::mem_location_hash, mem_usage*, simple_hashmap_traits<default_hash_traits<mem_alloc_description<mem_usage>::mem_location_hash>, mem_usage*> >::hash_entry, xcallocator>::~hash_table (this=0x345f4a0, __in_chrg=<optimized out>) at .././../gcc/hash-table.h:628 #4 hash_map<mem_alloc_description<mem_usage>::mem_location_hash, mem_usage*, simple_hashmap_traits<default_hash_traits<mem_alloc_description<mem_usage>::mem_location_hash>, mem_usage*> >::~hash_map (this=0x345f4a0, __in_chrg=<optimized out>) at .././../gcc/hash-map.h:26 #5 mem_alloc_description<mem_usage>::~mem_alloc_description (this=0x1c7c240 <hash_table_usage>, __in_chrg=<optimized out>) at .././../gcc/mem-stats.h:558 #6 0x00002b872a98a638 in __run_exit_handlers (status=status@entry=4, listp=0x2b872acf35b8 <__exit_funcs>, run_list_atexit=run_list_atexit@entry=true, run_dtors=run_dtors@entry=true) at exit.c:83 #7 0x00002b872a98a68a in __GI_exit (status=status@entry=4) at exit.c:105 #8 0x00000000012729c7 in diagnostic_action_after_output (context=context@entry=0x1c7c2c0 <global_diagnostic_context>, diag_kind=diag_kind@entry=DK_ICE) at .././../gcc/diagnostic.c:522 #9 0x000000000127343d in error_recursion (context=0x1c7c2c0 <global_diagnostic_context>) at .././../gcc/diagnostic.c:1462 #10 diagnostic_report_diagnostic (context=0x1c7c2c0 <global_diagnostic_context>, diagnostic=diagnostic@entry=0x7fffecaac220) at .././../gcc/diagnostic.c:903 #11 0x00000000012734bf in diagnostic_impl (richloc=richloc@entry=0x7fffecaac2a0, opt=opt@entry=-1, gmsgid=gmsgid@entry=0x137ea4e "%s", ap=ap@entry=0x7fffecaac288, kind=kind@entry=DK_ICE) at .././../gcc/diagnostic.c:1099 #12 0x00000000012740e5 in internal_error (gmsgid=gmsgid@entry=0x137ea4e "%s") at .././../gcc/diagnostic.c:1410 #13 0x0000000000b48d80 in crash_signal (signo=6) at .././../gcc/toplev.c:338 #14 <signal handler called> #15 __GI_raise (sig=sig@entry=6) at ../sysdeps/unix/sysv/linux/raise.c:51 #16 0x00002b872a9890c6 in __GI_abort () at abort.c:78 #17 0x00002b872a9c68f1 in __libc_message (do_abort=do_abort@entry=2, fmt=fmt@entry=0x2b872aac0b18 "*** Error in `%s': %s: 0x%s ***\n") at ../sysdeps/posix/libc_fatal.c:175 #18 0x00002b872a9ccf3b in malloc_printerr (action=<optimized out>, str=0x2b872aac1210 "malloc(): memory corruption (fast)", ptr=<optimized out>, ar_ptr=<optimized out>) at malloc.c:5077 #19 0x00002b872a9d0450 in _int_malloc (av=av@entry=0x2b872acf3ae0 <main_arena>, bytes=bytes@entry=36) at malloc.c:3386 #20 0x00002b872a9d1678 in __GI___libc_malloc (bytes=bytes@entry=36) at malloc.c:2890 #21 0x00000000012dbe90 in xrealloc (oldmem=oldmem@entry=0x0, size=36) at .././../libiberty/xmalloc.c:177 #22 0x0000000001277bb6 in va_heap::reserve<(anonymous namespace)::layout_range> (exact=true, reserve=<optimized out>, v=@0x7fffecaad0a0: 0x0) at .././../gcc/vec.h:288 #23 vec<(anonymous namespace)::layout_range, va_heap, vl_ptr>::reserve (exact=true, nelems=<optimized out>, this=0x7fffecaad0a0) at .././../gcc/vec.h:1473 #24 vec<(anonymous namespace)::layout_range, va_heap, vl_ptr>::reserve_exact (nelems=<optimized out>, this=0x7fffecaad0a0) at .././../gcc/vec.h:1493 #25 vec<(anonymous namespace)::layout_range, va_heap, vl_ptr>::create (nelems=<optimized out>, this=0x7fffecaad0a0) at .././../gcc/vec.h:1508 #26 auto_vec<(anonymous namespace)::layout_range, 0>::auto_vec (n=<optimized out>, this=0x7fffecaad0a0) at .././../gcc/vec.h:1320 #27 (anonymous namespace)::layout::layout (diagnostic_kind=<optimized out>, richloc=0x7fffecaad1e0, context=0x1c7c2c0 <global_diagnostic_context>, this=0x7fffecaad020) at .././../gcc/diagnostic-show-locus.c:776 #28 diagnostic_show_locus (context=context@entry=0x1c7c2c0 <global_diagnostic_context>, richloc=0x7fffecaad1e0, diagnostic_kind=<optimized out>) at .././../gcc/diagnostic-show-locus.c:1815 #29 0x0000000000666468 in c_diagnostic_finalizer (context=0x1c7c2c0 <global_diagnostic_context>, diagnostic=0x7fffecaad160) at .././../gcc/c-family/c-opts.c:166 #30 0x0000000001273119 in diagnostic_report_diagnostic (context=0x1c7c2c0 <global_diagnostic_context>, diagnostic=diagnostic@entry=0x7fffecaad160) at .././../gcc/diagnostic.c:979 #31 0x00000000012734bf in diagnostic_impl (richloc=richloc@entry=0x7fffecaad1e0, opt=opt@entry=-1, gmsgid=gmsgid@entry=0x137ea4e "%s", ap=ap@entry=0x7fffecaad1c8, kind=kind@entry=DK_ICE) at .././../gcc/diagnostic.c:1099 #32 0x00000000012740e5 in internal_error (gmsgid=gmsgid@entry=0x137ea4e "%s") at .././../gcc/diagnostic.c:1410 #33 0x0000000000b48d80 in crash_signal (signo=11) at .././../gcc/toplev.c:338 #34 <signal handler called> #35 __memmove_avx_unaligned_erms () at ../sysdeps/x86_64/multiarch/memmove-vec-unaligned-erms.S:478 #36 0x000000000127614f in (anonymous namespace)::line_corrections::add_hint (this=this@entry=0x7fffecaad9f0, hint=hint@entry=0x3489e20) at .././../gcc/diagnostic-show-locus.c:1514 #37 0x0000000001278605 in (anonymous namespace)::layout::print_trailing_fixits (row=<optimized out>, this=0x7fffecaada10) at .././../gcc/diagnostic-show-locus.c:1558 #38 (anonymous namespace)::layout::print_line (row=<optimized out>, this=0x7fffecaada10) at .././../gcc/diagnostic-show-locus.c:1780 #39 diagnostic_show_locus (context=context@entry=0x1c7c2c0 <global_diagnostic_context>, richloc=<optimized out>, diagnostic_kind=<optimized out>) at .././../gcc/diagnostic-show-locus.c:1827 #40 0x0000000000666468 in c_diagnostic_finalizer (context=0x1c7c2c0 <global_diagnostic_context>, diagnostic=0x7fffecaadb50) at .././../gcc/c-family/c-opts.c:166 #41 0x0000000001273119 in diagnostic_report_diagnostic (context=0x1c7c2c0 <global_diagnostic_context>, diagnostic=diagnostic@entry=0x7fffecaadb50) at .././../gcc/diagnostic.c:979 #42 0x00000000012734bf in diagnostic_impl (richloc=<optimized out>, opt=288, gmsgid=<optimized out>, ap=ap@entry=0x7fffecaadbb8, kind=kind@entry=DK_WARNING) at .././../gcc/diagnostic.c:1099 #43 0x00000000012739b8 in warning_at_rich_loc (richloc=<optimized out>, opt=opt@entry=288, gmsgid=gmsgid@entry=0x1309650 "missing braces around initializer") at .././../gcc/diagnostic.c:1214 #44 0x00000000005c7e62 in pop_init_level (loc=loc@entry=66752, implicit=implicit@entry=0, braced_init_obstack=braced_init_obstack@entry=0x7fffecaadd30, insert_before=insert_before@entry=66976) at .././../gcc/c/c-typeck.c:8069 #45 0x00000000005f332a in c_parser_braced_init (parser=parser@entry=0x2b872ae9f000, type=type@entry=0x0, nested_p=nested_p@entry=false, outer_obstack=outer_obstack@entry=0x0) at .././../gcc/c/c-parser.c:4443 #46 0x00000000005f42dd in c_parser_initializer (parser=parser@entry=0x2b872ae9f000) at .././../gcc/c/c-parser.c:4365 #47 0x00000000006015ce in c_parser_declaration_or_fndef (parser=parser@entry=0x2b872ae9f000, fndef_ok=false, fndef_ok@entry=true, static_assert_ok=static_assert_ok@entry=true, empty_ok=empty_ok@entry=true, nested=nested@entry=false, start_attr_ok=start_attr_ok@entry=true, objc_foreach_object_declaration=<optimized out>, omp_declare_simd_clauses=..., oacc_routine_data=<optimized out>, fallthru_attr_p=<optimized out>) at .././../gcc/c/c-parser.c:1933 #48 0x000000000060a334 in c_parser_external_declaration (parser=0x2b872ae9f000) at .././../gcc/c/c-parser.c:1470 #49 0x000000000060adaa in c_parser_translation_unit (parser=<optimized out>) at .././../gcc/c/c-parser.c:1351 #50 c_parse_file () at .././../gcc/c/c-parser.c:18168 #51 0x0000000000669067 in c_common_parse_file () at .././../gcc/c-family/c-opts.c:1104 #52 0x0000000000b48ddf in compile_file () at .././../gcc/toplev.c:468 #53 0x000000000057cff1 in do_compile () at .././../gcc/toplev.c:2021 #54 toplev::main (this=this@entry=0x7fffecaae14e, argc=<optimized out>, argc@entry=23, argv=<optimized out>, argv@entry=0x7fffecaae248) at .././../gcc/toplev.c:2155 #55 0x000000000057f3fb in main (argc=23, argv=0x7fffecaae248) at .././../gcc/main.c:39 I've already discussed that slightly in openSUSE bugzilla and it shows that we allocate a memory in a signal handler. Which is prohibited by glibc.