[LLVMdev] [PROPOSAL] Adding support for -fstack-protector-strong

Robinson, Paul Paul.Robinson at am.sony.com
Wed Oct 3 12:20:23 PDT 2012


David Chisnall wrote:
>On 2 Oct 2012, at 03:26, Magee, Josh wrote:
>
>>    1) An address of a local variable is taken in such a way as to expose the
>>       address of a stack location.
>>      - Example: the address of a local on the RHS of an assignment, the
>>        address of a local passed into function.
>
> It also sounds like it would be triggered for a lot of C++ function s that
> allocates an object on the stack and call methods on them.  Is it possible
> to tighten up the heuristic slightly so that this isn't the case?  

I don't see any inherent difference (for this purpose) between
    void foo() {
      int x;
      someFunc(&x);
    }
and
    void foo() {
      SomeClass x;
      x.someNonStaticMethod();
    }
It's just that C++ is so good at obscuring the details.  Granted there is 
no & operator in the second case, but the address of the stack-local object
is available to the called method without any hijinks, just like the address
of the stack-local variable is available to someFunc in the first case.

--paulr




More information about the llvm-dev mailing list