[llvm] [StackProtector] Clear out stack protector slot (PR #65461)

Bill Wendling via llvm-commits llvm-commits at lists.llvm.org
Wed Sep 6 13:05:26 PDT 2023


bwendling wrote:

@efriedma-quic There's a related option `-ftrivial-auto-var-init` for function entrance. It will have the same overall effect as this patch, but in the opposite direction. I thought this patch would be good for those not using that option. I suppose I could zero out the stack before returning and use a flag to enable that. It might be more code than a store.

This is also the first in a two-part series where next I want to zero out the register holding the stack guard value before returning.

As for the other platforms and target-specific SP support, I'll look into that.

@rnk To clarify, `__llvm_stack_protector_check` would act similarly to Microsoft's implementation? As for XOR'ing, I'm wary of something like that because it's still potentially visible to someone wanting to exploit the stack. Do you have an example of how we could do this?

https://github.com/llvm/llvm-project/pull/65461


More information about the llvm-commits mailing list