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

fix(cfi): Detect stub DLLs and skip CFI generation #233

Merged
merged 1 commit into from
May 7, 2020

Conversation

jan-auer
Copy link
Member

@jan-auer jan-auer commented May 7, 2020

Packers may strip original sections from PEs and replace them with stubs. In such a case, the exception table still contains references to sections like .pdata, even though they are in fact empty.

To detect this case, we scan for .stub sections. If such a section is present and .pdata is empty, then we report unwind info as missing. This check is extremely conservative so that it does not cause false positives.

Name    VAddr           VSize           PAddr           PSize           ...
.text	00001000	00442AB8	00000000	00000000	00000000	00000000	0000	0000	68000020	
.rdata	00445000	00098428	00000000	00000000	00000000	00000000	0000	0000	48000040	
.data	004DE000	00E68E34	00000000	00000000	00000000	00000000	0000	0000	C0000040	
.pdata	01347000	000075D8	00000000	00000000	00000000	00000000	0000	0000	48000040	
.sbss	0134F000	00000004	00000400	00000200	00000000	00000000	0000	0000	D0000040	
_RDATA	01350000	00000094	00000000	00000000	00000000	00000000	0000	0000	48000040	
.stub0	01351000	00934411	00000000	00000000	00000000	00000000	0000	0000	68000060	
.stub1	01C86000	007C03F0	00000600	007C0400	00000000	00000000	0000	0000	68000060	
.reloc	02447000	000000AC	007C0A00	00000200	00000000	00000000	0000	0000	40000040	
.rsrc	02448000	0000038E	007C0C00	00000400	00000000	00000000	0000	0000	40000040	

@jan-auer jan-auer requested a review from a team May 7, 2020 12:21
@jan-auer jan-auer self-assigned this May 7, 2020
@jan-auer jan-auer merged commit 7bdbe1d into master May 7, 2020
@jan-auer jan-auer deleted the fix/pe-skip-stub branch May 7, 2020 12:40
jan-auer added a commit that referenced this pull request May 7, 2020
* master:
  fix(cfi): Detect stub DLLs and skip CFI generation (#233)
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.

2 participants