[PATCH] [stack protector] Fix to start honoring ssp-buffer-size again

Josh Magee Joshua_Magee at playstation.sony.com
Thu Apr 10 16:03:20 PDT 2014


Hi,

This patch fixes the StackProtector pass so that it actually uses the
stack-protector-buffer-size (i.e., --param ssp-buffer-size=N).

Currently, stack protectors are not generated for the following code:
// clang -fstack-protector --param ssp-buffer-size=5 
extern int fun(char *c);
int test(void) {
  char a[5];
  return fun(a);
}


The problem is that the attribute was queried and saved at the wrong place.
Specifically, SSPBufferSize was set to "stack-protoctor-buffer-size" after all
uses of SSPBufferSize.  The result was that the default SSPBufferSize was
always used.

I added a few test cases to test/CodeGen/X86/stack-protector.ll that verify the
stack-protector-buffer-size attribute now has an effect.

In preparation for these new tests I previously modernized the rest of tests in
that file in r205996.

Let me know if this is okay to go in.

Thanks,
 - Josh

http://reviews.llvm.org/D3349

Files:
  lib/CodeGen/StackProtector.cpp
  test/CodeGen/X86/stack-protector.ll
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D3349.1.patch
Type: text/x-patch
Size: 9351 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/llvm-commits/attachments/20140410/96a94724/attachment.bin>


More information about the llvm-commits mailing list