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 assembler call frame information (CFI) directives #1023
base: main
Are you sure you want to change the base?
Conversation
Can you explain why it "confuses binary analysis tools like llvm-bolt." and why llvm-bolt can't be changed to handle this kind of code and you need to 'fix" code instead of tool? |
Thanks for following up on this. The problem is essentially that the current SDK code incorrectly uses the cfi_startproc and cfi_endproc directives as per the contract. From the binutils link above:
There are two issues in the current SDK code that clearly violate this "contract" and that this commit fixes:
The current SDK code does not abide by the unambiguous contract quoted above. Thus, the entries in
IMHO the "fix" here is clearly on the SGX SDK, as it does not abide by the unambiguous usage contract quoted above and BOLT is not to blame for clearly misannotated code. It seems infeasible and undesirable to me to fix all possible misuses of low-level asm directives in parsing tools..
afais there's no security issues (the ENDBR is what is used and the cfi_start/endproc is merely annoation at teh binary level), but not sure as I'm not super familiar with low-level CFI.. Hope this helps. Let me know if there are remaining questions or concerns! |
thanks. it all makes sense to me now |
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.
Looks good to me
You do need add Signed-off-by tag to your commit before this can be merged |
Current macros emit an ENDBR instruction between the function label and corresponding cfi_start, which confuses binary analysis tools like llvm-bolt. Also add missing cfi_start/end directives for other assembly functions. See also: https://sourceware.org/binutils/docs/as/CFI-directives.html Signed-off-by: Jo Van Bulck <jo.vanbulck@cs.kuleuven.be>
Thanks, I force-pushed to add a Signed off by tag |
Will consider to merge the PR after our upcoming release. |
Current macros emit an ENDBR instruction between the function label and corresponding cfi_start, which confuses binary analysis tools like llvm-bolt.
Also add missing cfi_start/end directives for other assembly functions.
See also: https://sourceware.org/binutils/docs/as/CFI-directives.html