Quoting from https://www.kernel.org/doc/Documentation/process/adding-syscalls.rst:
At least on 64-bit x86, it will be a hard requirement from v4.17 onwards to not call system call functions in the kernel. It uses a different calling convention for system calls where
struct pt_regsis decoded on-the-fly in a syscall wrapper which then hands processing over to the actual syscall function. This means that only those parameters which are actually needed for a specific syscall are passed on during syscall entry, instead of filling in six CPU registers with random user space content all the time (which may cause serious trouble down the call chain).
What serious trouble down the call chain is the last parenthesized clause referring to?
To me it seems stupid not to load the six registers in the generic leadup to the syscall. Forcing each syscall wrapper to do it makes them larger and the syscall funcs become a new special case, so I'm wondering what the "serious trouble" is with having unintentional user content in unused argument registers.
SYSCALL_PTREGS, the new selective register unpacking is generated by a macro (so no extra coding work) and the wrappers are inlined, so the resulting assembly is almost the same as what the compiler would generate previously. If anything, unpacking only a subset of the registers generates less code.