Skip to content

RFC x86/entry: cleanups and consistent syscall number handling

H. Peter Anvin lkml 3 versions New

Get series with b4
b4 am [email protected]

Versions newest first · linked by author and title

  1. v2 RFC Latest posting 2/20 of 6 patches 0 repliesNew
  2. v2 RFC posting 1/27 patches 11 repliesApplied
  3. v1 RFC6 patches 0 repliesSuperseded

Changes in v2 from the cover letter

* Only -1 should be a non-system call per the cross-architectural definition of sys_ni_syscall().
* Fix/improve patch descriptions.

Patches in v2 posting 2/2 No applies recorded yet

None of the 6 patches the cover letter announces are in this archive.

Reviews trailers per patch

No Reviewed-by, Acked-by or Tested-by trailers for v2 yet.

Read the v2 thread

Cover letter [RFC v2 PATCH 0/6] x86/entry: cleanups and consistent syscall number handling

From: "H. Peter Anvin (Intel)" <[email protected]>

This patchset:

1. Cleans up some duplications between <entry/calling.h> and <asm/ptrace-abi.h>.

2. Swaps the arguments to do_syscall_64() for consistency *and* speed.

3. Adds the maximum number of flags to MSR_SYSCALL_MASK; the previous is more of a minimum. The more flags that are masked, the less the likelihood of a control leak into the kernel.

4. Consistently treat the system call number as a signed int. This is what syscall_get_nr() already does, and therefore what all architecture-independent code (e.g. seccomp) already expects.

5. As per the defined semantics of syscall_get_nr(), only the value -1 is defined as a non-system call, so comparing >= 0 is incorrect. Change to != -1.

6. Call sys_ni_syscall() for system calls which are out of range except for -1, which is used by ptrace and seccomp as a "skip system call" marker) just as for system call numbers that correspond to holes in the table.

7. In <entry/calling.h>, factor the PUSH_AND_CLEAR_REGS macro into separate PUSH_REGS and CLEAR_REGS macros which can be used separately if desired. This will be used by the FRED entry code at a later date.

Changes from v1:

* Only -1 should be a non-system call per the cross-architectural definition of sys_ni_syscall().
* Fix/improve patch descriptions.

---

 arch/x86/entry/calling.h       | 45 ++++++--------------------
 arch/x86/entry/common.c        | 71 ++++++++++++++++++++++++++++--------------
 arch/x86/entry/entry_64.S      |  4 +--
 arch/x86/include/asm/syscall.h | 13 ++++----
 arch/x86/kernel/cpu/common.c   | 12 +++++--
 arch/x86/kernel/head_64.S      |  6 ++--
 6 files changed, 77 insertions(+), 74 deletions(-)