Gcc -fno-stack-protector option

I am working on a school project and we are mainly trying to learn about Stack Overflow. Some example code I'm working on, mostly: (truncated)

char test[10];
int i;
for (i=0;i < 10000;i++) {
    test[i] = 'a';
}

      

When I compile this with gcc everything works fine and dandy. Gcc automatically protects the stack and never allows excessive overflow. Now if I try to use gcc -fno-stack-protector .... the exact same program runs. I even do diffs on the prefabs (-S option) and they are identical. What gives? I looked through the man pages and didn't mention the -fno-stack option ... Everything on the internet points to the -fno-stack-protector option, but I couldn't recreate anything at all ...

Thanks in advance for your help. :)

+3


source to share


1 answer


Are you sure? Mine gives (unless stack protection is disabled):

.L2:
        cmpl    $9999, -36(%rbp)
        jle     .L3
        movq    -8(%rbp), %rdx
        xorq    %fs:40, %rdx
        je      .L5
        call    __stack_chk_fail

      



from

int test() {
char test[10];
int i;
for (i=0;i < 10000;i++) {
  test[i] = 'a';
 }
}

      

+3


source







All Articles