diff options
author | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-28 21:14:16 +0000 |
---|---|---|
committer | scherkus@chromium.org <scherkus@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-11-28 21:14:16 +0000 |
commit | 6df15dcc91c0b5b98e72f937f85cec710daaa1b3 (patch) | |
tree | 78b62465204577216123e391381296890c0d401c /tools/checkbins | |
parent | 3846c269bb3a721d65eb7f734ac99e4049483b82 (diff) | |
download | chromium_src-6df15dcc91c0b5b98e72f937f85cec710daaa1b3.zip chromium_src-6df15dcc91c0b5b98e72f937f85cec710daaa1b3.tar.gz chromium_src-6df15dcc91c0b5b98e72f937f85cec710daaa1b3.tar.bz2 |
checkbins.py: skip /SAFESEH check on 64-bit Windows binaries
As mentioned in http://msdn.microsoft.com/en-us/library/9a89h429.aspx /SAFESEH is only valid for x86 targets as x64 targets have exception handlers noted in their PDATA section.
BUG=104188
Review URL: http://codereview.chromium.org/8687005
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@111770 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'tools/checkbins')
-rwxr-xr-x | tools/checkbins/checkbins.py | 16 |
1 files changed, 11 insertions, 5 deletions
diff --git a/tools/checkbins/checkbins.py b/tools/checkbins/checkbins.py index 08f796c..bc3c7b2 100755 --- a/tools/checkbins/checkbins.py +++ b/tools/checkbins/checkbins.py @@ -23,6 +23,7 @@ PE_FILE_EXTENSIONS = ['.exe', '.dll'] DYNAMICBASE_FLAG = 0x0040 NXCOMPAT_FLAG = 0x0100 NO_SEH_FLAG = 0x0400 +MACHINE_TYPE_AMD64 = 0x8664 # Please do not add your file here without confirming that it indeed doesn't # require /NXCOMPAT and /DYNAMICBASE. Contact cpu@chromium.org or your local @@ -67,14 +68,19 @@ def main(options, args): success = False print "Checking %s for /NXCOMPAT... FAIL" % path - # Check for /SAFESEH. Binaries should either have no SEH table - # (in which case a bit is set in the DLL characteristics section) - # or there should be a LOAD_CONFIG section present containing - # a valid SEH table. + # Check for /SAFESEH. Binaries should meet one of the following + # criteria: + # 1) Have no SEH table as indicated by the DLL characteristics + # 2) Have a LOAD_CONFIG section containing a valid SEH table + # 3) Be a 64-bit binary, in which case /SAFESEH isn't required + # + # Refer to the following MSDN article for more information: + # http://msdn.microsoft.com/en-us/library/9a89h429.aspx if (pe.OPTIONAL_HEADER.DllCharacteristics & NO_SEH_FLAG or (hasattr(pe, "DIRECTORY_ENTRY_LOAD_CONFIG") and pe.DIRECTORY_ENTRY_LOAD_CONFIG.struct.SEHandlerCount > 0 and - pe.DIRECTORY_ENTRY_LOAD_CONFIG.struct.SEHandlerTable != 0)): + pe.DIRECTORY_ENTRY_LOAD_CONFIG.struct.SEHandlerTable != 0) or + pe.FILE_HEADER.Machine == MACHINE_TYPE_AMD64): if options.verbose: print "Checking %s for /SAFESEH... PASS" % path else: |