= Work done last week:
* Time spent on elfutils: ~80%
* Fix 10-byte LEB128
* Check that each CU is referenced only from one pub* section
* Match the way dwarflint reports offsets with the way elfutils does it, so that it's easily possible to look up DIEs, CUs, etc. in readelf output using their offsets.
* Check that the base address selection entry changes base address.
* Validate .debug_ranges. Detour via sequential reading that turned out to be unviable. Check that .debug_loc and .debug_ranges entries cover non-zero range (or are these legitimate artifacts?).
* Check that each rangelistptr is aligned to CU's address_size
* Do detailed validation of several location expression opcodes - DW_OP_bra and DW_OP_skip: that they don't overrun or underrun opcode buffer, and that their destination address is aligned with the beginning of some DIE. - DW_OP_const8[us]: that they don't appear in 32-bit CUs - DW_OP_const[us], DW_OP_deref_size, DW_OP_plus_uconst: that in 32-bit CUs, their argument fits on 32-bit stack.
* Split into C and C++ part. Eventually, I may get around to C++-ify all the C-only GNUisms I've sprinkled across dwaflint, but right now having two "halves" (high-level C++, low-level C) makes more sense.
* Validate .debug_aranges overlaps, uncovered parts, etc. Currently this is done in perhaps too generous a way: the code does coverage analysis of ony AX section. Except if .init, .fini. or .plt are not covered at all, it doesn't flag it as an error. Is it better to assume that all "interesting" code will be in .text? It would simplify the analysis code a little.
* Update the wiki with current status.
= Work scheduled for this week:
* Expected time spent on elfutils: 50-80%.
* .debug_ranges, .debug_loc range analysis (coverage, overlaps)
* I think I might actually get around to relocs this week.
* I didn't get around to go through anomalies we've found, leaving it for next coding-quota overrun.
PM
_______________________________________________ elfutils-devel mailing list elfutils-devel@lists.fedorahosted.org https://fedorahosted.org/mailman/listinfo/elfutils-devel
* Check that each rangelistptr is aligned to CU's address_size
This is canonical but not actually mandatory.
- DW_OP_bra and DW_OP_skip: that they don't overrun or underrun
opcode buffer, and that their destination address is aligned with the beginning of some DIE.
Of some op in that expression block, you mean?
* Split into C and C++ part. Eventually, I may get around to
C++-ify all the C-only GNUisms I've sprinkled across dwaflint, but right now having two "halves" (high-level C++, low-level C) makes more sense.
Agreed. (I did a quick attempt at compiling dwarflint.c as C++ earlier and punted.) When I finish the known-dwarf stuff in C++ so you won't need all those C99 initializer tables in the program, it will be easier.
* Validate .debug_aranges overlaps, uncovered parts, etc.
Currently this is done in perhaps too generous a way: the code does coverage analysis of ony AX section. Except if .init, .fini. or .plt are not covered at all, it doesn't flag it as an error. Is it better to assume that all "interesting" code will be in .text? It would simplify the analysis code a little.
I don't think you should be doing much of that kind of checking at all. Overlaps are good to check, because they are always suspicious. We can save address validity checks for a later general high-level set of checks also applied to DW_FORM_addr et al.
I've also added the location list C++ interface. You can use that to apply similar checks for addresses used in location lists. For now, the only check I'd recommend is that a location list's addresses all fall into the ranges of a scope containing the one whose loclistptr attr is that list. Note that in a location list, overlaps are always kosher (exact or not). (Overlaps mean the value is stored in multiple places during some PC ranges.) It's only suspicious if one of the overlapping entries has an empty location expression, which in fact is always suspicious. An empty location expression is superfluous in a location list because the entry should just have been left out--a gap in the PC coverage means the same.
Parts of text not covered by any CU are not suspicious even if they are not just alignment padding and so on--there are sometimes files linked in that were compiled without -g, or assembly, which is commonly done with without -g, or static libraries, crt1.o, etc. That is not in the purview of dwarflint. At some point in the future, we can add an optional check for "some text apparently missing debuginfo" or whatnot. But that is not anything to contemplate now.
The address validity checks that make sense to do by default are just that they match some section. In relocatable cases, it makes sense to check that both the start and end of one pair point to the same section. In final-linked cases, that might still make sense but maybe not. It probably also makes sense to check that addresses are inside the st_value+st_size of some symbol in the section. Worrying about it being the right symbol is much hair for much later.
Thanks, Roland
Roland McGrath wrote:
* Check that each rangelistptr is aligned to CU's address_size
This is canonical but not actually mandatory.
It's a message with impact 4. If it's not a big deal, I'll make it 2 (i.e. harmless, but suspicious).
- DW_OP_bra and DW_OP_skip: that they don't overrun or underrun
opcode buffer, and that their destination address is aligned with the beginning of some DIE.
Of some op in that expression block, you mean?
Yes, that.
I've also added the location list C++ interface. You can use that to apply similar checks for addresses used in location lists. For now, the only check I'd recommend is that a location list's addresses all fall into the ranges of a scope containing the one whose loclistptr attr is that list.
Ok.
Parts of text not covered by any CU are not suspicious even if they are not just alignment padding and so on--there are sometimes files linked in that were compiled without -g, or assembly, which is commonly done with without -g, or static libraries, crt1.o, etc.
I see, I didn't think about that.
The address validity checks that make sense to do by default are just that they match some section. In relocatable cases, it makes sense to check that both the start and end of one pair point to the same section. In final-linked cases, that might still make sense but maybe not. It probably also makes sense to check that addresses are inside the st_value+st_size of some symbol in the section. Worrying about it being the right symbol is much hair for much later.
Ok.
Thanks, PM
Roland McGrath wrote:
* Split into C and C++ part. Eventually, I may get around to
C++-ify all the C-only GNUisms I've sprinkled across dwaflint, but right now having two "halves" (high-level C++, low-level C) makes more sense.
Agreed. (I did a quick attempt at compiling dwarflint.c as C++ earlier and punted.) When I finish the known-dwarf stuff in C++ so you won't need all those C99 initializer tables in the program, it will be easier.
From the look of known-dwarf.h, the conversion of dwarfstrings.h tables to switch statements should be straightforward. Or do you plan to have some high-level C++-y stuff for that instead?
PM
From the look of known-dwarf.h, the conversion of dwarfstrings.h tables to switch statements should be straightforward. Or do you plan to have some high-level C++-y stuff for that instead?
I do plan to have C++ interfaces for all the name string stuff. There's not too much to it, and having that would reduce the kludge factor for doing any of this stuff.. I'll try to whip it up this week.
Thanks, Roland
elfutils-devel@lists.fedorahosted.org