-
Notifications
You must be signed in to change notification settings - Fork 1.7k
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
ICP: Add missing stack frame info to SHA asm files #11733
Conversation
Since the assembly routines calculating SHA checksums don't use a standard stack layout, CFI directives are needed to unroll the stack. Signed-off-by: Attila Fülöp <attila@fueloep.org>
Will try to get this into a build cycle over the weekend. What're the chances of it eating my pets and setting my fridge aflame? |
Does this address #9394 ? |
I am quite confused. The push %rbx is still the first one pushing %rbx to the stack. Normally, %rbp should be the first register to be saved on the stack by any x86-64 ABI conformant function. Please refer to https://blogs.oracle.com/sherrym/obtaining-function-arguments-on-amd64. |
@sempervictus I'd say that this is a low risk change. The code itself only changed slightly, most of the stuff just adds DWARF info to the object file. Nonetheless it's always good to run on a test system first. |
@ahrens Can't tell for sure. It depends if the linux tooling is making use of the DWARF info contained in the kernel modules. If you have an easy way to test, that would be great. |
@youzhongyang pushing %rbp first is only part of the convention, more importantly the current %rbp must also point to the previous %rbp on the stack all the time (frame pointer). That way you can unroll the stack by repeatedly dereferencing %rbp. As I wrote in #11728 this code uses %rbp as an general purpose register and there is no spare register left, meaning there is no way to achieve that. So that code behaves like gcc with -fomit-frame-pointer. To work around that problem there are DWARF features tooling and debuggers can use to follow the stack anyhow (CFA: Canonical Frame Address). My knowledge is that the linux tooling makes use of that DWARF feature, but only testing can confirm that. So if you have a way to test if this PR fixes your problem, that would be great. |
Build result with applied patch "ICP: Add missing stack frame info to SHA asm files":
See the fix here - STACK_FRAME_NON_STANDARD |
Yes, the data in the text section. Not sure about the performance impacts, if any. Caching comes to mind. |
I should add that compilation as kernel module has the appropriate |
For build with Clang + LTO, this doesn't work: |
This is wrong, they should be on .data or .rodata.
No performance issues were noticed. |
Could someone clarify where this PR stands? From the comments it sounds like this was largely blocked by the need for additional testing and confirmation that it resolved the warnings. Are there any remaining correctness concerns? |
Since this should be a low risk change, and no issues with it have been reported, I'd like to move forward with getting it merged. Unless there are remaining concerns let's plan on merging it next week. |
Is there any reason %rbp can't be pushed first? that is all I asked. |
Sorry for the delay, been away from a keyboard for quite a while. @behlendorf IRC the tests @AndyLavr did were confirming. Unfortunately the reproducer given in #9394 didn't work in my setup, so I can't tell if this will fix the warning there. I also failed to reproduce the warnings given in #11728, so the same holds for #11728 as well. At least this change will allow @youzhongyang Well, pushing %rpb first won't buy you anything, I tried to explain this above. |
Since the assembly routines calculating SHA checksums don't use a standard stack layout, CFI directives are needed to unroll the stack. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Attila Fülöp <attila@fueloep.org> Closes openzfs#11733
Since the assembly routines calculating SHA checksums don't use a standard stack layout, CFI directives are needed to unroll the stack. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Attila Fülöp <attila@fueloep.org> Closes openzfs#11733
Since the assembly routines calculating SHA checksums don't use a standard stack layout, CFI directives are needed to unroll the stack. Reviewed-by: Brian Behlendorf <behlendorf1@llnl.gov> Signed-off-by: Attila Fülöp <attila@fueloep.org> Closes #11733
Motivation and Context
Since the assembly routines calculating SHA checksums don't use a standard stack layout, CFI directives are needed to unroll the
stack.
Description
Add the needed directives.
How Has This Been Tested?
Just a local build.
Types of changes
Checklist:
Signed-off-by
.