Re: [PATCH] tools/nolibc: mark arg1 operand in __nolibc_syscall0() as write-only

From: Willy Tarreau

Date: Fri Jul 03 2026 - 13:45:21 EST


On Fri, Jul 03, 2026 at 07:41:58PM +0200, Willy Tarreau wrote:
> Hi Thomas!
>
> On Fri, Jul 03, 2026 at 07:30:16PM +0200, Thomas Weißschuh wrote:
> > __nolibc_syscall0() does not set the arg1 variable before passing it to
> > the asm block. This uninitialized variable read is undefined behavior.
> > Clang can miscompile this.
>
> Interesting. I don't know how we ended up like this, most likely just
> due to reusing the same code blocks for the different variants. I'm
> noting that m68k is affected as well then. I'm CCing Daniel for a
> double-check.

Hmmm no I'm wrong, sorry Daniel for the noise, on m68k _num is initialized
before being passed to the asm statement so "+r" is fine there.

Willy