[illumos-Developer] [REVIEW] 308 ld may misalign sections only preceded by empty sections
Richard Lowe
richlowe at richlowe.net
Fri Feb 25 11:34:46 PST 2011
Hey all, I'd like cautious code review for:
308 ld may misalign sections only preceded by empty sections
webrev:
http://richlowe.net/webrevs/il_308/
A whole bunch of details are in the bug, which you should read:
https://illumos.org/issues/308
Especially my last two comments, which I hope are both correct and not
gibberish (if you disagree, please comment on that too so I can fix
them, or figure out whether I'm just totally wrong).
I'd like really, really cautious review. The implications of breaking
the link editor and runtime linker (which reaches this code via
ld.so.1`elf_obj_fini) are really rather dire.
I've tested this, thus far, by:
- building illumos, saving the proto area, building illumos using this
linker, and comparing with wsdiff (no relevant differences, just
.SUNW_dof noise)
- building xnv, saving the proto area, and building xnv using this
linker, and comparing with wsdiff (aside from a fair amount of
noise, the differences are binaries being fixed by these changes).
- building sfwnv, saving the proto area, and building sfwnv using
this linker, and comparing with wsdiff. This is so loud as to have
been useless (yuck), I think I kept the log however if anyone wants
to ask anything specific.
- In all the builds above I also used elfdump as a poor-man's check of
ELF validity, by finding every ELF file in the proto (using
find/file/grep), and then running elfdump on each of them, looking
for error output (it unfortunately exits 0 oven when whining).
- illumos was clean (before and after)
- xnv was dirty before (this bug) and clean after.
- sfwnv was dirty before (gstrip destroys our binaries[1]) and dirty
after (same, no other change)
- I'm also running bits onu'd from this workspace, though I haven't done
anything to particularly exercise the runtime linker except use
the system. If you know of things which would usefully do so,
please let me know.
I'd like to note that, prior to this little adventure I was not at all
familiar with the linkers, and am still not particularly familiar with
them, if you have questions there's a really good chance I won't have
answers without a bunch of investigation. You should be as scared by
this as I am, and keep it in mind throughout.
Albert and Gordon have already looked to at least some degree, so I most
especially want comments from others.
Thanks,
-- Rich
[1] Reading around, it apparently believes .SUNW* can be stripped:
% cp $(which cat) cat
% gstrip cat
% elfdump cat > /dev/null
cat: .SUNW_ldynsym: invalid sh_link: 0
cat: .SUNW_dynsymsort: invalid sh_link: 0
cat: .SUNW_ldynsym: invalid sh_link: 0
cat: .SUNW_ldynsym: invalid sh_link: 0
More information about the Developer
mailing list