[LLVMbugs] [Bug 11843] New: Stack protection not working properly
bugzilla-daemon at llvm.org
bugzilla-daemon at llvm.org
Tue Jan 24 03:00:13 PST 2012
http://llvm.org/bugs/show_bug.cgi?id=11843
Bug #: 11843
Summary: Stack protection not working properly
Product: dragonegg
Version: 3.0
Platform: PC
OS/Version: Linux
Status: NEW
Severity: normal
Priority: P
Component: New Bugs
AssignedTo: baldrick at free.fr
ReportedBy: pbarrio at die.upm.es
CC: llvmbugs at cs.uiuc.edu
Classification: Unclassified
Created attachment 7939
--> http://llvm.org/bugs/attachment.cgi?id=7939
Resulting bitcode from dragonegg
Generated IR segfaults when executing with lli. Native executable works fine.
If option "-fno-stack-protector" is passed to dragonegg, it also works.
$> gcc -fplugin=~/dragonegg.so -O1 -fplugin-arg-dragonegg-enable-gcc-optzns
test.c -S -fplugin-arg-dragonegg-emit-ir -o test.ll
$> lli test.ll
The original code is:
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
int main(int argc, char** argv){
char a[15] = "aaaaaaaaaaaaaa";
char b[15] = "bbbbbbbbbbbbbb";
char *c = (char*) malloc(sizeof(char)*(strlen(a)+strlen(b)+1));
memcpy(c, a, strlen(a));
memcpy(c + strlen(a), b, strlen(b) + 1);
printf("a = %s, b = %s, c = %s\n", a, b, c);
}
If arrays "a" and "b" are shrinked to 7 chars, then it works as well. If these
arrays are allocated with malloc or declared as globals (out of main), it also
works. It's very likely to be a stack issue.
--
Configure bugmail: http://llvm.org/bugs/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
You are on the CC list for the bug.
More information about the llvm-bugs
mailing list