Memory alignment today and 20 years ago

后端 未结 3 481
失恋的感觉
失恋的感觉 2021-02-05 15:49

In the famous paper \"Smashing the Stack for Fun and Profit\", its author takes a C function

void function(int a, int b, int c) {
  char buffer1[5];
  char buffe         


        
3条回答
  •  情书的邮戳
    2021-02-05 16:14

    I have not tried that specific version of compiler or the distribution version you report. My guess would be the 16 is from byte alignment requirements on stack (i.e. all stack adjustments would be x byte aligned and x may be 16 for your invocation).

    Note that variable alignment you seem to have started with, is slightly different from the above and is controlled by align markings on the variable in gcc. Try using those and you should see a difference.

提交回复
热议问题