-
Notifications
You must be signed in to change notification settings - Fork 38.7k
scripts: Add MACHO stack canary check to security-check.py #18713
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
Conversation
I didn't add the relevant test in bitcoin#18295.
|
utACK 8334ee3. |
|
ACK 8334ee3: Mitigations are important. Important things are worth asserting :) Thanks for doing this! |
| if p.returncode: | ||
| raise IOError('Error opening file') | ||
| ok = False | ||
| for line in stdout.splitlines(): |
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.
Why splitlines? Seems you could test against stdout directly.
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.
To mirror the other tests. As Jonas mentioned, we can probably refactor these checks to remove some duplicated code, so I can look at changing these (where it makes sense) as well.
Gitian builds
|
eacedfb scripts: add additional type annotations to security-check.py (fanquake) 83d063e scripts: add run_command to security-check.py (fanquake) 13f606b scripts: remove NONFATAL from security-check.py (fanquake) 061acf6 scripts: no-longer check for 32 bit windows in security-check.py (fanquake) Pull request description: * Remove 32-bit Windows checks. * Remove NONFATAL checking. Added in #8249, however unused since #13764. * Add `run_command` to de-duplicate all of the subprocess calls. Mentioned in #18713. * Add additional type annotations. * Print stderr when there is an issue running a command. ACKs for top commit: laanwj: ACK eacedfb Tree-SHA512: 69a7ccfdf346ee202b3e8f940634c5daed1d2b5a5d15ac9800252866ba3284ec66e391a66a0b341f5a4e5e8482fe1b614d4671e8e766112ff059405081184a85
7b99c74 uses
otool -Ivto check for___stack_chk_failin the macOS binaries. Similar to the ELF check. Note that looking for a triple underscore prefixed function (as opposed to two for ELF) is correct for the macOS binaries. i.e:otool -Iv bitcoind | grep chk 0x00000001006715b8 509 ___memcpy_chk 0x00000001006715be 510 ___snprintf_chk 0x00000001006715c4 511 ___sprintf_chk 0x00000001006715ca 512 ___stack_chk_fail 0x00000001006715d6 517 ___vsnprintf_chk 0x0000000100787898 513 ___stack_chk_guard8334ee3 is a follow up to #18295 and adds test cases to
test-security-check.pythat for some reason I didn't add at the time. I'll sort out #18434 so that we can run these tests in the CI.