Page MenuHomePhabricator

[ELF/Driver] Avoid a reference to the ELFOptTable after it has gone out of scope

Authored by filcab on Mar 14 2016, 5:33 PM.



This solves PR26908. ASan detects it, but not by default.
It needs ASAN_OPTIONS=detect_stack_use_after_return=true

Diff Detail

Event Timeline

filcab updated this revision to Diff 50684.Mar 14 2016, 5:33 PM
filcab retitled this revision from to [ELF/Driver] Avoid a reference to the ELFOptTable after it has gone out of scope.
filcab updated this object.
filcab added reviewers: ruiu, rafael.
filcab added a subscriber: llvm-commits.
ruiu edited edge metadata.Mar 14 2016, 5:40 PM

Ah, thank you for finding this one! I quickly took a look when I updated the bug but couldn't figure out what was wrong.

I'd like to keep the parser function in DriverUtils. I'd define a new class to own ELFOptTable in DriverUtils.

filcab added a subscriber: filcab.Mar 14 2016, 7:29 PM

It looks like it should, but I can't try it out now.
I can try it tonight or tomorrow morning at most. If you want, you can
compile llvm+lld with ASan and turn on the Asan option (double-check that
you catch the bug first ;-) ).

CCing Kostya:
Should we add ASAN_OPTIONS=detect_stack_use_after_free=true to the
sanitizer bot?
It would have caught this bug a long time ago.
We might also need to do some cleanup before we can do it.

Thank you,

filcab abandoned this revision.Mar 21 2016, 3:19 PM