Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Simplify INTERP logic for better consistency #84

Merged
merged 1 commit into from
Jun 13, 2016

Conversation

cuviper
Copy link
Contributor

@cuviper cuviper commented Jun 11, 2016

When .interp was in the first page, keep it there like the comment about
FreeBSD requires. Just shift it for the new PHDR. But if .interp is
already past the first page, as seen in libc.so for instance, then move
its offset a whole page like we do for every other section. Then
program headers follow the same logic.

The conditional around startMovingSections and object type is totally
removed, as it did the wrong thing for PIE binaries which otherwise look
like shared libraries. We now just move all sections except low interp.

Fixes #71.

When .interp was in the first page, keep it there like the comment about
FreeBSD requires.  Just shift it for the new PHDR.  But if .interp is
already past the first page, as seen in libc.so for instance, then move
its offset a whole page like we do for every other section.  Then
program headers follow the same logic.

The conditional around startMovingSections and object type is totally
removed, as it did the wrong thing for PIE binaries which otherwise look
like shared libraries.  We now just move all sections except low interp.

Fixes dyninst#71.
@cuviper
Copy link
Contributor Author

cuviper commented Jun 11, 2016

While we do test PIC and nonPIC executables, they're both still ET_EXEC. The problem here arose because the executable was built PIE, which is ET_DYN like a shared library.

Also, regarding CI failures, if Travis and LLVM can't get along then we should just disable the clang build. This is travis-ci/travis-ci#6120, which also has a workaround if you like.

@pefoley2
Copy link
Contributor

Clang on travis is disabled by #85

@wrwilliams
Copy link
Member

Thanks, Josh.

I've got WIP from earlier this year on generating our PIC tests as PIE; the catch is that I need to convince the prolog spec to properly exclude all tests with assembler sources from the PIC/PIE variation. That shouldn't be hard in theory, but prolog.

Final question/comment: is there any good way to generate executables with arbitrarily weird-but-legal ELF headers for testing? (Actually, if we were to do something with directed fuzzing of ELF headers and compared the loader's gripes on pre- and post-rewritten binaries, that might be better/simpler, but there's something to be said for just checking that legal->legal is an invariant.)

@wrwilliams wrwilliams merged commit 0301316 into dyninst:master Jun 13, 2016
@cuviper
Copy link
Contributor Author

cuviper commented Jun 13, 2016

I know that elfutils uses afl-fuzz a lot, but the directed fuzzing there is trying to crash the program under inspection. It's not oriented around producing bad output AFAIK. It still might be worthwhile to see how Dyninst fares under such input though -- AFL is good at finding really weird corner cases.

For verifying rewritten output, eu-elflint --gnu-ld can probably help.
(That option is necessary because gnu-ld apparently has some questionable behavior.)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants