> For the complete documentation index, see [llms.txt](https://ret2basic.gitbook.io/ctfnote/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://ret2basic.gitbook.io/ctfnote/pwn/linux-exploitation/rop/stack-alignment.md).

# Stack Alignment

{% hint style="info" %}
In Linux, GCC sets the de facto standard for calling conventions. Since GCC version 4.5, the stack must be aligned to a **16-byte boundary** when calling a function (previous versions only required a 4-byte alignment).
{% endhint %}

In ROP, we have to consider stack alignment if the payload fails. My explanation:

![Stack Alignment](https://3988450783-files.gitbook.io/~/files/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MWVjG_njKgBtvmnKaJh%2Fuploads%2F6TnV9eK9JigQASYOzNCd%2Fimage.png?alt=media\&token=bbb866f2-6649-4026-8175-e354e25ff8b0)
