Skip to content

remove in-kernel syscall invocations (part 3 == remainder outside arch/)

Dominik Brodowski git kexec linux-arch linux-fsdevel linux-mm lkml 1 version In review

Get series with b4
b4 am [email protected]

Versions newest first

  1. v1 Latest45 patches 16 repliesIn review

Patches in v1 No applies recorded yet

#Subject and filesSizeRepliesApplied
1/45fs: add ksys_getdents64() helper; remove in-kernel calls to sys_getdents64()fs/readdir.c include/linux/syscalls.h init/initramfs.c+13 -40 replies
2/45fs: add ksys_ioctl() helper; remove in-kernel calls to sys_ioctl()fs/ioctl.c include/linux/syscalls.h init/do_mounts.c +3 more+22 -150 replies
3/45fs: add ksys_lseek() helper; remove in-kernel calls to sys_lseek()fs/read_write.c include/linux/syscalls.h init/do_mounts_rd.c+12 -60 replies
4/45fs: add ksys_read() helper; remove in-kernel calls to sys_read()arch/s390/kernel/compat_linux.c fs/read_write.c include/linux/syscalls.h +2 more+14 -80 replies
5/45fs: add ksys_sync() helper; remove in-kernel calls to sys_sync()arch/sparc/kernel/setup_32.c drivers/tty/sysrq.c fs/sync.c +4 more+12 -60 replies
6/45fs: add do_lookup_dcookie() helper; remove in-kernel call to syscallfs/dcookies.c+8 -30 replies
7/45fs: add do_vmsplice() helper; remove in-kernel call to syscallfs/splice.c+9 -30 replies
8/45fs: add kern_select() helper; remove in-kernel call to sys_select()fs/select.c+9 -30 replies
9/45fs: add ksys_truncate() wrapper; remove in-kernel calls to sys_truncate()arch/mips/kernel/linux32.c arch/parisc/kernel/sys_parisc.c arch/powerpc/kernel/sys_ppc32.c +5 more+17 -90 replies
10/45fs: add ksys_p{read,write}64() helpers; remove in-kernel calls to syscallsarch/mips/kernel/linux32.c arch/parisc/kernel/sys_parisc.c arch/powerpc/kernel/sys_ppc32.c +6 more+36 -200 replies
11/45fs: add ksys_fallocate() wrapper; remove in-kernel calls to sys_fallocate()arch/mips/kernel/linux32.c arch/parisc/kernel/sys_parisc.c arch/powerpc/kernel/sys_ppc32.c +5 more+18 -120 replies
12/45fs: add do_compat_fcntl64() helper; remove in-kernel call to comapt syscallfs/fcntl.c+9 -30 replies
13/45fs: add do_compat_select() helper; remove in-kernel call to comapt syscallfs/select.c+12 -50 replies
14/45fs: add do_compat_signalfd4() helper; remove in-kernel call to comapt syscallfs/signalfd.c+12 -50 replies
15/45fs: add do_compat_futimesat() helper; remove in-kernel call to comapt syscallfs/utimes.c+10 -20 replies
16/45inotify: add do_inotify_init() helper; remove in-kernel call to syscallfs/notify/inotify/inotify_user.c+7 -21 reply
17/45fanotify: add do_fanotify_mark() helper; remove in-kernel call to syscallfs/notify/fanotify/fanotify_user.c+10 -41 reply
18/45fs/quota: add kernel_quotactl() helper; remove in-kernel call to syscallfs/quota/compat.c fs/quota/quota.c include/linux/quotaops.h+15 -61 reply
19/45fs/quota: use COMPAT_SYSCALL_DEFINE for sys32_quotactl()arch/x86/entry/syscalls/syscall_32.tbl fs/quota/compat.c include/linux/compat.h +2 more+9 -71 reply
20/45kernel: add do_compat_sigaltstack() helper; remove in-kernel call to compat syscallkernel/signal.c+10 -40 replies
21/45kernel: add ksys_setsid() helper; remove in-kernel call to sys_setsid()include/linux/syscalls.h init/do_mounts_initrd.c kernel/sys.c+8 -20 replies
22/45kernel: provide ksys_*() wrappers for syscalls called by kernel/uid16.ckernel/sys.c kernel/uid16.c kernel/uid16.h+74 -172 replies
23/45sched: add do_sched_yield() helper; remove in-kernel call to sched_yield()kernel/sched/core.c+6 -25 replies
24/45kexec: call do_kexec_load() in compat syscall directlykernel/kexec.c+37 -130 replies
25/45mm: add kernel_migrate_pages() helper, move compat syscall to mm/mempolicy.ckernel/compat.c mm/mempolicy.c+44 -370 replies
26/45mm: add kernel_move_pages() helper, move compat syscall to mm/migrate.ckernel/compat.c mm/migrate.c+35 -260 replies
27/45mm: add kernel_mbind() helper; remove in-kernel call to syscallmm/mempolicy.c+11 -40 replies
28/45mm: add kernel_[sg]et_mempolicy() helpers; remove in-kernel calls to syscallsmm/mempolicy.c+22 -70 replies
29/45mm: add ksys_readahead() helper; remove in-kernel calls to sys_readahead()arch/mips/kernel/linux32.c arch/parisc/kernel/sys_parisc.c arch/powerpc/kernel/sys_ppc32.c +5 more+13 -70 replies
30/45ipc: add semtimedop syscall/compat_syscall wrappersipc/sem.c ipc/syscall.c ipc/util.h+41 -120 replies
31/45ipc: add semget syscall wrapperipc/sem.c ipc/syscall.c ipc/util.h+9 -30 replies
32/45ipc: add semctl syscall/compat_syscall wrappersipc/sem.c ipc/syscall.c ipc/util.h+16 -40 replies
33/45ipc: add msgget syscall wrapperipc/msg.c ipc/syscall.c ipc/util.h+9 -30 replies
34/45ipc: add shmget syscall wrapperipc/shm.c ipc/syscall.c ipc/util.h+9 -30 replies
35/45ipc: add shmdt syscall wrapperipc/shm.c ipc/syscall.c ipc/util.h+9 -30 replies
36/45ipc: add shmctl syscall/compat_syscall wrappersipc/shm.c ipc/syscall.c ipc/util.h+16 -40 replies
37/45ipc: add msgctl syscall/compat_syscall wrappersipc/msg.c ipc/syscall.c ipc/util.h+17 -40 replies
38/45ipc: add msgrcv syscall/compat_syscall wrappersipc/msg.c ipc/syscall.c ipc/util.h+24 -70 replies
39/45ipc: add msgsnd syscall/compat_syscall wrappersipc/msg.c ipc/syscall.c ipc/util.h+22 -60 replies
40/45x86: use _do_fork() in compat_sys_x86_clone()arch/x86/ia32/sys_ia32.c+2 -11 reply
41/45x86: remove compat_sys_x86_waitpid()arch/x86/entry/syscalls/syscall_32.tbl arch/x86/ia32/sys_ia32.c arch/x86/include/asm/sys_ia32.h+1 -101 reply
42/45x86: fix sys_sigreturn() return type to be long, not unsigned longarch/x86/include/asm/syscalls.h arch/x86/kernel/signal.c+2 -21 reply
43/45x86/sigreturn: use SYSCALL_DEFINE0arch/x86/kernel/signal.c+3 -21 reply
44/45kernel/sys_ni: sort cond_syscall() entrieskernel/sys_ni.c+332 -1740 replies
45/45bpf: whitelist all syscalls for error injectioninclude/linux/compat.h include/linux/syscalls.h+6 -00 replies

Reviews trailers per patch

8 of 45 patches have a Reviewed-by or Acked-by.

PatchThomas GleixnerJan Kara
1/45
2/45
3/45
4/45
5/45
6/45
7/45
8/45
9/45
10/45
11/45
12/45
13/45
14/45
15/45
16/45A-b
17/45A-b
18/45A-b
19/45A-b
20/45
21/45
22/45
23/45
24/45
25/45
26/45
27/45
28/45
29/45
30/45
31/45
32/45
33/45
34/45
35/45
36/45
37/45
38/45
39/45
40/45R-b
41/45R-b
42/45R-b
43/45R-b
44/45
45/45

Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.

Read the v1 thread

Cover letter [PATCH 00/45] remove in-kernel syscall invocations (part 3 == remainder outside arch/)

Here is a third series of patches which reduce the number of syscall invocations from within the kernel. Once this long-term goal is achieved, the syscall entry path can be streamlined.

This series builds on top of

- part1 (random bits and pieces)
http://lkml.kernel.org/r/[email protected]

- part2 (net)
http://lkml.kernel.org/r/[email protected]

and replaces the RFC of a subset of this series. Most of the patches are just "mindless" conversions and helpers. If wrappers or helpers are limited to one subsystem, I have named them do_*(), kern_*() or __sys_*(), depending on what was used by the subsystem and/or what was still available. Otherwise, I have used ksys_*() to reflect that this is meant as a drop-in replacement for sys_*() within the kernel.

With this third series, *all* in-kernel callers of sys_*() and compat_sys_*() outside of arch/ are converted.[*] On top of this, three things may be attempted now:

- ptregs system call conversion for x86-64.

- re-work initramfs etc. code to not use in-kernel equivalents of syscalls, but operate on the VFS level instead.

- re-work SYSCALL_DEFINEx() / COMPAT_SYSCALL_DEFINEx() to do the right thing depending on arch-specific requirements on padding, long long handling, etc. (Al Viro).

Also thrown in are a patch by Michael Tautschnig to use proper SYSCALL_DEFINE0() macros on x86 and a patch by Howard McLauchlan to whitelist all syscalls for error injection.

The whole series, including part 1 and part 2, can be found at

https://git.kernel.org/pub/scm/linux/kernel/git/brodo/linux.git syscalls-next

Thanks,
Dominik

[*] Within arch, only x86 is fully covered by these series.

Dominik Brodowski (43):
fs: add ksys_getdents64() helper; remove in-kernel calls to

    sys_getdents64()
  fs: add ksys_ioctl() helper; remove in-kernel calls to sys_ioctl()
  fs: add ksys_lseek() helper; remove in-kernel calls to sys_lseek()
  fs: add ksys_read() helper; remove in-kernel calls to sys_read()
  fs: add ksys_sync() helper; remove in-kernel calls to sys_sync()
  fs: add do_lookup_dcookie() helper; remove in-kernel call to syscall
  fs: add do_vmsplice() helper; remove in-kernel call to syscall
  fs: add kern_select() helper; remove in-kernel call to sys_select()
  fs: add ksys_truncate() wrapper; remove in-kernel calls to
    sys_truncate()
  fs: add ksys_p{read,write}64() helpers; remove in-kernel calls to
    syscalls
  fs: add ksys_fallocate() wrapper; remove in-kernel calls to
    sys_fallocate()
  fs: add do_compat_fcntl64() helper; remove in-kernel call to comapt
    syscall
  fs: add do_compat_select() helper; remove in-kernel call to comapt
    syscall
  fs: add do_compat_signalfd4() helper; remove in-kernel call to comapt
    syscall
  fs: add do_compat_futimesat() helper; remove in-kernel call to comapt
    syscall
  inotify: add do_inotify_init() helper; remove in-kernel call to
    syscall
  fanotify: add do_fanotify_mark() helper; remove in-kernel call to
    syscall
  fs/quota: add kernel_quotactl() helper; remove in-kernel call to
    syscall
  fs/quota: use COMPAT_SYSCALL_DEFINE for sys32_quotactl()
  kernel: add do_compat_sigaltstack() helper; remove in-kernel call to
    compat syscall
  kernel: add ksys_setsid() helper; remove in-kernel call to
    sys_setsid()
  kernel: provide ksys_*() wrappers for syscalls called by
    kernel/uid16.c

sched: add do_sched_yield() helper; remove in-kernel call to
sched_yield()
kexec: call do_kexec_load() in compat syscall directly
mm: add kernel_migrate_pages() helper, move compat syscall to
mm/mempolicy.c
mm: add kernel_move_pages() helper, move compat syscall to
mm/migrate.c
mm: add kernel_mbind() helper; remove in-kernel call to syscall
mm: add kernel_[sg]et_mempolicy() helpers; remove in-kernel calls to
syscalls
mm: add ksys_readahead() helper; remove in-kernel calls to
sys_readahead()
ipc: add semtimedop syscall/compat_syscall wrappers
ipc: add semget syscall wrapper
ipc: add semctl syscall/compat_syscall wrappers
ipc: add msgget syscall wrapper
ipc: add shmget syscall wrapper
ipc: add shmdt syscall wrapper
ipc: add shmctl syscall/compat_syscall wrappers
ipc: add msgctl syscall/compat_syscall wrappers
ipc: add msgrcv syscall/compat_syscall wrappers
ipc: add msgsnd syscall/compat_syscall wrappers
x86: use _do_fork() in compat_sys_x86_clone()
x86: remove compat_sys_x86_waitpid()
x86: fix sys_sigreturn() return type to be long, not unsigned long kernel/sys_ni: sort cond_syscall() entries

Howard McLauchlan (1):
bpf: whitelist all syscalls for error injection

Tautschnig, Michael (1):
x86/sigreturn: use SYSCALL_DEFINE0

 arch/mips/kernel/linux32.c             |  12 +-
 arch/parisc/kernel/sys_parisc.c        |  16 +-
 arch/powerpc/kernel/sys_ppc32.c        |  10 +-
 arch/s390/kernel/compat_linux.c        |  14 +-
 arch/sh/kernel/sys_sh32.c              |   4 +-
 arch/sparc/kernel/setup_32.c           |   2 +-
 arch/sparc/kernel/sys_sparc32.c        |  12 +-
 arch/x86/entry/syscalls/syscall_32.tbl |   4 +-
 arch/x86/ia32/sys_ia32.c               |  26 +-
 arch/x86/include/asm/sys_ia32.h        |   3 -
 arch/x86/include/asm/syscalls.h        |   2 +-
 arch/x86/kernel/signal.c               |   5 +-
 drivers/tty/sysrq.c                    |   2 +-
 fs/dcookies.c                          |  11 +-
 fs/fcntl.c                             |  12 +-
 fs/ioctl.c                             |   7 +-
 fs/notify/fanotify/fanotify_user.c     |  14 +-
 fs/notify/inotify/inotify_user.c       |   9 +-
 fs/open.c                              |   9 +-
 fs/quota/compat.c                      |  13 +-
 fs/quota/quota.c                       |  10 +-
 fs/read_write.c                        |  36 ++-
 fs/readdir.c                           |  11 +-
 fs/select.c                            |  29 +-
 fs/signalfd.c                          |  17 +-
 fs/splice.c                            |  12 +-
 fs/sync.c                              |   7 +-
 fs/utimes.c                            |  12 +-
 include/linux/compat.h                 |   6 +
 include/linux/quotaops.h               |   3 +
 include/linux/syscalls.h               |  27 +-
 init/do_mounts.c                       |  10 +-
 init/do_mounts_initrd.c                |   4 +-
 init/do_mounts_md.c                    |  15 +-
 init/do_mounts_rd.c                    |  22 +-
 init/initramfs.c                       |   4 +-
 ipc/msg.c                              |  60 +++-
 ipc/sem.c                              |  44 ++-
 ipc/shm.c                              |  28 +-
 ipc/syscall.c                          |  58 ++--
 ipc/util.h                             |  31 ++
 kernel/compat.c                        |  55 ----
 kernel/kexec.c                         |  50 +++-
 kernel/power/hibernate.c               |   2 +-
 kernel/power/suspend.c                 |   2 +-
 kernel/power/user.c                    |   2 +-
 kernel/sched/core.c                    |   8 +-
 kernel/signal.c                        |  14 +-
 kernel/sys.c                           |  65 ++++-
 kernel/sys_ni.c                        | 506 +++++++++++++++++++++------------
 kernel/uid16.c                         |  19 +-
 kernel/uid16.h                         |  14 +
 mm/mempolicy.c                         |  92 +++++-
 mm/migrate.c                           |  39 ++-
 mm/readahead.c                         |   7 +-
 55 files changed, 1030 insertions(+), 478 deletions(-)
 create mode 100644 kernel/uid16.h
Signature · 1 line
2.16.2