This is an archive of the discontinued LLVM Phabricator instance.

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

Authored by jmagee on Apr 10 2014, 4:03 PM.

Details

Summary

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

Diff Detail

Event Timeline

rnk accepted this revision.Apr 16 2014, 1:02 PM

lgtm

jmagee closed this revision.Apr 17 2014, 2:22 PM