Skip to content

Conversation

@fanquake
Copy link
Member

7b99c74 uses otool -Iv to check for ___stack_chk_fail in 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_guard

8334ee3 is a follow up to #18295 and adds test cases to test-security-check.py that 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.

@jonasschnelli
Copy link
Contributor

utACK 8334ee3.
note-nit: the subprocess.Popen with manual line per line "grep-ing" could probably be refactored (not in this PR). Or use shell grep.

@practicalswift
Copy link
Contributor

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():
Copy link
Contributor

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.

Copy link
Member Author

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.

@DrahtBot
Copy link
Contributor

Gitian builds

File commit c4c3f11
(master)
commit 3121daaa89cd73c8ee011721a4e575e3fc46548a
(master and this pull)
bitcoin-0.20.99-aarch64-linux-gnu-debug.tar.gz 20cf5b8b49af8b5c... cbb05724b3c7f2ba...
bitcoin-0.20.99-aarch64-linux-gnu.tar.gz b48063c771a930f3... 6a6091c701741e29...
bitcoin-0.20.99-arm-linux-gnueabihf-debug.tar.gz 05ac72341a09394b... a92dbea924618425...
bitcoin-0.20.99-arm-linux-gnueabihf.tar.gz 99f7d8562c5a11d4... 110e667504a23de0...
bitcoin-0.20.99-osx-unsigned.dmg e51b038384a301d9... e6d168e3d4fb160b...
bitcoin-0.20.99-osx64.tar.gz e298696bfb0ec235... 2f6402c5e7dd72c2...
bitcoin-0.20.99-riscv64-linux-gnu-debug.tar.gz 08fb295e433150b4... e7fd293b184ba00b...
bitcoin-0.20.99-riscv64-linux-gnu.tar.gz 719a37899dc38aec... 70c86da5f5c8d9ad...
bitcoin-0.20.99-win64-debug.zip e28f048e991270c9... 5802a988f42be41c...
bitcoin-0.20.99-win64-setup-unsigned.exe 06210bcff7c38230... da404edd2e0ebd27...
bitcoin-0.20.99-win64.zip 5533c39402aeffd7... b0aaf54555ab4814...
bitcoin-0.20.99-x86_64-linux-gnu-debug.tar.gz f96c6dbe96e7b94d... 3d236162c84a9e4f...
bitcoin-0.20.99-x86_64-linux-gnu.tar.gz 6c2a8db2c7d89bc9... 961a8c479e112e4d...
bitcoin-0.20.99.tar.gz 898009f5d6825797... 9ca909e5e23d9e21...
bitcoin-core-linux-0.21-res.yml f72f6d19b77b8a5f... 893b2b44ca2d48bc...
bitcoin-core-osx-0.21-res.yml 1a4e78200ae822a6... beb75651b8df1833...
bitcoin-core-win-0.21-res.yml 4a6c3a64a5e7f7db... 0b54ab0ce86327ab...
linux-build.log 41c3e184d5c072ee... eaccfe1e8802d33d...
osx-build.log a2d9610ccc240be4... aa856a1726a5988c...
win-build.log 13a83af36bb2074c... 30d7f01c046e1534...
bitcoin-core-linux-0.21-res.yml.diff f492d279e968a6cf...
bitcoin-core-osx-0.21-res.yml.diff b0457415d7039d53...
bitcoin-core-win-0.21-res.yml.diff d6c19564d257d03b...
linux-build.log.diff 2f9195dc21eeabd7...
osx-build.log.diff 530e94449a57258d...
win-build.log.diff 7bfc531d669392f8...

@fanquake fanquake merged commit c90a9e6 into bitcoin:master Apr 22, 2020
@fanquake fanquake deleted the check_MACHO_canary branch April 22, 2020 08:41
laanwj added a commit that referenced this pull request May 14, 2020
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
@bitcoin bitcoin locked as resolved and limited conversation to collaborators Feb 15, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants