Re: [PATCH v2 1/1] tools/nolibc: i386: Fix a stack misalign bug on _start
From: Ammar Faizi
Date: Tue Aug 29 2023 - 08:18:18 EST
On Tue, Aug 29, 2023 at 08:21:47AM +0200, Willy Tarreau wrote:
> Indeed, good catch! However if we want to do it cleany (i.e not punch a
> 16 to 28 byes hole in the stack), we should do this instead:
>
> add $12, %esp /* the stack must be aligned to 16 ... */
> and $-16, %esp /* ... bytes after eax is pushed and ... */
> sub $12, %esp /* ... before the call. */
>
> This will only add 0 to 12 bytes depending on the existing alignment.
>
> What do you think ?
Good point. I'll send a v3 revision tomorrow.
I just saw that Linus has pulled the PR from Shuah that contains this
bug. IOW, I missed this fix for the 6.6 merge window. Let's see if it
can go to 6.6-rc2. Or maybe sooner than that.
--
Ammar Faizi