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
bootloader: implement full back-to-front scan for embedded archive #5511
Conversation
Depends on cleanup from #5457. |
0460e84
to
4b5e514
Compare
c464076
to
b387868
Compare
…okie Implement full back-to-front file scan for finding the embedded archive's cookie. This saves us from having to make assumptions about the cookie's positon, which both simplifies the search and makes it more robust. Currently, we are searching within fixed-sized search window either from the end of file or from end of file's digital signature (if present; on Windows and macOS only). This breaks when a 3rd party tool appends extra data at the end of executable; for example, with PIE bootloader executable, staticx tool on linux will append extra sections at the end of file, which is perfectly valid behavior, but it breaks our fixed-size search window assumptions. Therefore, full back-to-front search fixes pyinstaller#5330. Another motivation for brute-force search is macOS 11, as we will sooner or later want to support universal2 fat binary bootloaders in addition to single-arch thin ones. Full-file search allows us to do so without having to search for digital signature and in turn parsing the headers of each binary format.
b387868
to
f09400a
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice work on this.
@Legorooj Any chance this is going to be released soonish? |
@pvanderlinden maybe? I can't give you a date as I don't have release credentials myself. Currently talking to someone who does so I can obtain them. |
Thanks @Legorooj . Just asking because I didn't see a release for months and this issue is blocking a contribution to a different project |
Implement full back-to-front file scan for finding the embedded archive's cookie. This saves us from having to make assumptions
about the cookie's positon, which both simplifies the search and makes it more robust.
Currently, we are searching within fixed-sized search window either from the end of file or from end of file's digital signature (if
present; on Windows and macOS only).
This breaks when a 3rd party tool appends extra data at the end of executable; for example, with PIE bootloader executable,
staticx
tool on linux will append extra sections at the end of file, which is perfectly valid behavior, but it breaks our fixed-sizesearch window assumptions. Therefore, full back-to-front search fixes #5330 and JonathonReinhart/staticx#71.
Another motivation for brute-force search is macOS 11, as we will sooner or later want to support universal2 fat binary bootloaders in addition to single-arch thin ones. Full-file search allows us to do so without having to search for digital signature and in turn parsing the headers of each binary format.