public inbox for glibc-bugs@sourceware.org help / color / mirror / Atom feed
From: "mehmetgelisin at aol dot com" <sourceware-bugzilla@sourceware.org> To: glibc-bugs@sourceware.org Subject: [Bug libc/10149] stack guard should lead with zero byte to gain protections from str* writes Date: Fri, 10 Sep 2021 19:36:44 +0000 [thread overview] Message-ID: <bug-10149-131-a8b5aMF8J3@http.sourceware.org/bugzilla/> (raw) In-Reply-To: <bug-10149-131@http.sourceware.org/bugzilla/> https://sourceware.org/bugzilla/show_bug.cgi?id=10149 Mehmet gelisin <mehmetgelisin at aol dot com> changed: What |Removed |Added ---------------------------------------------------------------------------- CC| |mehmetgelisin at aol dot com --- Comment #5 from Mehmet gelisin <mehmetgelisin at aol dot com> --- gdb/dwarf: disable per-BFD resource sharing for -readnow objfiles New in v2: - Disable sharing only for -readnow objfiles, not all objfiles. As described in PR 27541, we hit an internal error when loading a binary the standard way and then loading it with the -readnow option: $ ./gdb -nx -q --data-directory=data-directory ~/a.out -ex "set confirm off" -ex "file -readnow ~/a.out" Reading symbols from /home/simark/a.out... Reading symbols from ~/a.out... /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8098: internal-error: void create_all_comp_units(dwarf2_per_objfile*): Assertion `per_objfile->per_bfd->all_comp_units.empty ()' failed. This is a recurring problem that exposes a design issue in the DWARF per-BFD sharing feature. Things work well when loading a binary with the same method (with/without index, with/without readnow) twice in a row. But they don't work so well when loading a binary with different methods. See this previous fix, for example: efb763a5ea35 ("gdb: check for partial symtab presence in dwarf2_initialize_objfile") That one handled the case where the first load is normal (uses partial symbols) and the second load uses an index. The problem is that when loading an objfile with a method A, we create a dwarf2_per_bfd and some dwarf2_per_cu_data and initialize them with the data belonging to that method. When loading another obfile sharing the same BFD but with a different method B, it's not clear how to re-use the dwarf2_per_bfd/dwarf2_per_cu_data previously created, because they contain the data specific to method A. https://komiya-dental.com/ I think the most sensible fix would be to not share a dwarf2_per_bfd between two objfiles loaded with different methods. That means that two objfiles sharing the same BFD and loaded the same way would share a dwarf2_per_bfd. Two objfiles sharing the same BFD but loaded with different methods would use two different dwarf2_per_bfd structures. http://www.iu-bloomington.com/ However, this isn't a trivial change. So to fix the known issue quickly (including in the gdb 10 branch), this patch just disables all dwarf2_per_bfd sharing for objfiles using READNOW. Generalize the gdb.base/index-cache-load-twice.exp test to test all the possible combinations of loading a file with partial symtabs, index and readnow. Move it to gdb.dwarf2, since it really exercises features of the DWARF gdb/dwarf: disable per-BFD resource sharing for -readnow objfiles https://www.webb-dev.co.uk/ New in v2: - Disable sharing only for -readnow objfiles, not all objfiles. As described in PR 27541, we hit an internal error when loading a binary the standard way and then loading it with the -readnow option: https://waytowhatsnext.com/ $ ./gdb -nx -q --data-directory=data-directory ~/a.out -ex "set confirm off" -ex "file -readnow ~/a.out" Reading symbols from /home/simark/a.out... Reading symbols from ~/a.out... /home/simark/src/binutils-gdb/gdb/dwarf2/read.c:8098: internal-error: void create_all_comp_units(dwarf2_per_objfile*): Assertion `per_objfile->per_bfd->all_comp_units.empty ()' failed. http://www.acpirateradio.co.uk/ This is a recurring problem that exposes a design issue in the DWARF per-BFD sharing feature. Things work well when loading a binary with the same method (with/without index, with/without readnow) twice in a row. But they don't work so well when loading a binary with different methods. See this previous fix, for example: http://www.logoarts.co.uk/ efb763a5ea35 ("gdb: check for partial symtab presence in dwarf2_initialize_objfile") That one handled the case where the first load is normal (uses partial symbols) and the second load uses an index. http://www.slipstone.co.uk/ The problem is that when loading an objfile with a method A, we create a dwarf2_per_bfd and some dwarf2_per_cu_data and initialize them with the data belonging to that method. When loading another obfile sharing the same BFD but with a different method B, it's not clear how to re-use the dwarf2_per_bfd/dwarf2_per_cu_data previously created, because they contain the data specific to method A. http://embermanchester.uk/ I think the most sensible fix would be to not share a dwarf2_per_bfd between two objfiles loaded with different methods. http://connstr.net/ That means that two objfiles sharing the same BFD and loaded the same way would share a dwarf2_per_bfd. Two objfiles http://joerg.li/ sharing the same BFD but loaded with different methods would use two different dwarf2_per_bfd structures. http://www.jopspeech.com/ However, this isn't a trivial change. So to fix the known issue quickly (including in the gdb 10 branch), this patch just disables all http://www.wearelondonmade.com/ dwarf2_per_bfd sharing for objfiles using READNOW. Generalize the gdb.base/index-cache-load-twice.exp test to test all http://www.compilatori.com/ the possible combinations of loading a file with partial symtabs, index and readnow. Move it to gdb.dwarf2, since it really exercises features of the DWARF http://www-look-4.com/ -- You are receiving this mail because: You are on the CC list for the bug.
next prev parent reply other threads:[~2021-09-10 19:36 UTC|newest] Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top [not found] <bug-10149-131@http.sourceware.org/bugzilla/> 2011-05-15 15:01 ` drepper.fsp at gmail dot com 2014-07-01 20:34 ` fweimer at redhat dot com 2021-09-05 7:39 ` kimolsun2020 at yahoo dot com 2021-09-10 19:36 ` mehmetgelisin at aol dot com [this message] 2021-09-10 19:51 ` mark at klomp dot org 2021-10-09 11:00 ` gulsenenginar at aol dot com 2021-10-19 7:15 ` progonsaytu at gmail dot com 2021-10-21 6:45 ` bap.fayol at gmail dot com 2021-10-21 10:43 ` adhemerval.zanella at linaro dot org 2021-10-24 10:03 ` glassmtech at ukr dot net 2021-11-10 14:12 ` bryanmcsp at gmail dot com 2009-05-12 18:05 [Bug libc/10149] New: stack guard should lead with zero byte to gain protections from str* reads kees at outflux dot net 2009-05-14 21:50 ` [Bug libc/10149] stack guard should lead with zero byte to gain protections from str* writes kees at outflux dot net
Reply instructions: You may reply publicly to this message via plain-text email using any one of the following methods: * Save the following mbox file, import it into your mail client, and reply-to-all from there: mbox Avoid top-posting and favor interleaved quoting: https://en.wikipedia.org/wiki/Posting_style#Interleaved_style * Reply using the --to, --cc, and --in-reply-to switches of git-send-email(1): git send-email \ --in-reply-to=bug-10149-131-a8b5aMF8J3@http.sourceware.org/bugzilla/ \ --to=sourceware-bugzilla@sourceware.org \ --cc=glibc-bugs@sourceware.org \ /path/to/YOUR_REPLY https://kernel.org/pub/software/scm/git/docs/git-send-email.html * If your mail client supports setting the In-Reply-To header via mailto: links, try the mailto: linkBe sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).