[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20211013125142.GD5485@1wt.eu>
Date: Wed, 13 Oct 2021 14:51:42 +0200
From: Willy Tarreau <w@....eu>
To: Borislav Petkov <bp@...en8.de>
Cc: Ammar Faizi <ammar.faizi@...dents.amikom.ac.id>,
Paul Walmsley <paul.walmsley@...ive.com>,
Palmer Dabbelt <palmer@...belt.com>,
Albert Ou <aou@...s.berkeley.edu>,
Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
Andy Lutomirski <luto@...nel.org>,
Thomas Gleixner <tglx@...utronix.de>,
Ingo Molnar <mingo@...hat.com>, x86@...nel.org,
"H. Peter Anvin" <hpa@...or.com>
Subject: Re: [PATCH] tools/nolibc: x86: Remove `r8`, `r9` and `r10` from the
clobber list
Hi Boris,
On Wed, Oct 13, 2021 at 02:43:25PM +0200, Borislav Petkov wrote:
> On Wed, Oct 13, 2021 at 05:23:11AM +0700, Ammar Faizi wrote:
> > "Figure 3.4: Register Usage" is not the answer, if it were, nolibc.h
> > would be broken as it is missing "rdi", "rsi", "rdx" in the clobber list.
>
> It is not about what happens in practice but what the contract is:
> syscall argument registers can potentially get clobbered and userspace
> should treat them as such. Because if the kernel decides to actually
> clobber them for whatever reason and some userspace thing thinks
> otherwise, then it is the userspace thing's problem as it doesn't adhere
> to the well known ABI.
I agree and that's why my question was about that authoritative doc, to
know the contract (since this one will not change under our feet). But
according to the doc you pointed, here the contract for syscalls is that
only rcx and r11 are clobbered (and rax gets the result). If so, I'm
personally fine with this.
Thanks,
Willy
Powered by blists - more mailing lists