Re: [PATCH v1 3/3] Documentation: x86-64: Document registers on entry and exit

From: Ammar Faizi
Date: Fri Jan 07 2022 - 19:38:42 EST


On 1/8/22 7:02 AM, Andy Lutomirski wrote:
On 1/7/22 15:52, Ammar Faizi wrote:
There was a controversial discussion about the wording in the System
V ABI document regarding what registers the kernel is allowed to
clobber when the userspace executes syscall.

The resolution of the discussion was reviewing the clobber list in
the glibc source. For a historical reason in the glibc source, the
kernel must restore all registers before returning to the userspace
(except for rax, rcx and r11).

[...]
diff --git a/Documentation/x86/entry_64.rst b/Documentation/x86/entry_64.rst
index e433e08f7018..3f2007e2a938 100644
--- a/Documentation/x86/entry_64.rst
+++ b/Documentation/x86/entry_64.rst
@@ -108,3 +108,50 @@ We try to only use IST entries and the paranoid entry code for vectors
that absolutely need the more expensive check for the GS base - and we
generate all 'normal' entry points with the regular (faster) paranoid=0
variant.
+
+
+Registers on entry:
+-------------------

This is SYSCALL64 registers on entry, not general registers on entry.
Also, this has little to do with the entry logic, so it probably
doesn't belong in this file.

Ah right, I should be more specific saying it's for syscall64 entry
as there are 6 entries mentioned in this document.

Should syscall64 entry topic be documented? If not I will drop it,
otherwise suggest me a place for it.

I think we can document it here, but it needs to be more specific
saying it's for syscall64 entry.

Jonathan?

--
Ammar Faizi

Attachment: OpenPGP_signature
Description: OpenPGP digital signature