[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20231202132359.GA15040@1wt.eu>
Date: Sat, 2 Dec 2023 14:23:59 +0100
From: Willy Tarreau <w@....eu>
To: Alexey Dobriyan <adobriyan@...il.com>
Cc: Thomas Weißschuh <linux@...ssschuh.net>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] nolibc: optimise _start() on x86_64
Hi Alexey,
On Sat, Dec 02, 2023 at 03:45:13PM +0300, Alexey Dobriyan wrote:
> Just jump into _start_c, it is not going to return anyway.
Thanks, but what's upper in the stack there ? I'm trying to make sure
that if _start_c returns we don't get a random behavior. If we get a
systematic crash (e.g. 0 always there) that's fine, what would be
annoying would be random infinite loops etc. In the psABI description
(table 3.9) I'm seeing "undefined" before argc, which I don't find
much appealing.
> Signed-off-by: Alexey Dobriyan <adobriyan@...il.com>
> ---
>
> Also, kernel clears all registers before starting process,
> I'm not sure why
>
> xor ebp, ebp
>
> was added.
Hmmm psABI says:
Only the registers listed below have specied values at process entry:
%rbp The content of this register is unspecied at process initialization
time, but the user code should mark the deepest stack frame by setting
the frame pointer to zero.
%rsp The stack pointer holds the address of the byte with lowest address
which is part of the stack. It is guaranteed to be 16-byte aligned at
process entry.
%rdx a function pointer that the application should register with atexit (BA_OS).
Thus apparently it's documented as being our job to clear it :-/
Willy
Powered by blists - more mailing lists