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 received this bug notification because you are a member of Ubuntu Touch seeded packages, which is subscribed to eglibc in Ubuntu. https://bugs.launchpad.net/bugs/413278 Title: stack protector guard value does not lead with a NULL byte Status in GLibC: Fix Released Status in eglibc package in Ubuntu: Fix Released Status in glibc package in Ubuntu: Invalid Status in eglibc source package in Jaunty: Invalid Status in glibc source package in Jaunty: Fix Released Status in eglibc source package in Karmic: Fix Released Status in glibc source package in Karmic: Invalid Bug description: IMPACT: stack protections are weakened due to strcpy function being able to write the stack guard (since it does not start with a zero byte). ADDRESSED: correctly implement leading zero, as done in Karmic. DISCUSSION: regression potential is low, since the patch is isolated and well tested. TEST CASE: $ bzr branch lp:~ubuntu-bugcontrol/qa-regression-testing/master qa-regression-testing $ cd qa-regression-testing/scripts $ ./test-glibc-security.py -v Build helper tools ... (9.10) ok glibc heap protection ... ok sprintf not pre-truncated with -D_FORTIFY_SOURCE=2 ... ok glibc pointer obfuscation ... ok Password hashes ... (sha512) ok Stack guard exists ... ok Stack guard leads with zero byte ... FAIL Stack guard is randomized ... ok ====================================================================== FAIL: Stack guard leads with zero byte ---------------------------------------------------------------------- Traceback (most recent call last): File "./test-glibc-security.py", line 170, in test_81_stack_guard_leads_zero self.assertEqual(one.startswith('00 '), expected, one) AssertionError: 62 55 59 69 cd 20 39 80 ---------------------------------------------------------------------- Ran 8 tests in 0.145s FAILED (failures=1) expected outcome: 0 failures. ProblemType: Bug Architecture: amd64 Date: Thu Aug 13 13:59:02 2009 Dependencies: findutils 4.4.2-1 gcc-4.4-base 4.4.1-1ubuntu3 libc6 2.10.1-0ubuntu6 libgcc1 1:4.4.1-1ubuntu3 DistroRelease: Ubuntu 9.10 Package: libc6 2.10.1-0ubuntu6 ProcEnviron: LANGUAGE=en_US.UTF-8 PATH=(custom, user) LANG=en_US.UTF-8 SHELL=/bin/bash ProcVersionSignature: Ubuntu 2.6.31-5.24-generic SourcePackage: eglibc Uname: Linux 2.6.31-5-generic x86_64 To manage notifications about this bug go to: https://bugs.launchpad.net/glibc/+bug/413278/+subscriptions -- Mailing list: https://launchpad.net/~touch-packages Post to : touch-packages@lists.launchpad.net Unsubscribe : https://launchpad.net/~touch-packages More help : https://help.launchpad.net/ListHelp