All of lore.kernel.org
 help / color / mirror / Atom feed
* [RFC PATCH 00/35] remove in-kernel syscall invocations
@ 2018-03-11 10:55 Dominik Brodowski
  2018-03-11 10:55 ` [RFC PATCH 01/35] syscalls: define goal to not call sys_xyzzy() from within the kernel Dominik Brodowski
                   ` (36 more replies)
  0 siblings, 37 replies; 54+ messages in thread
From: Dominik Brodowski @ 2018-03-11 10:55 UTC (permalink / raw)
  To: linux-kernel, luto, torvalds, mingo, viro, akpm

Here is a first set of patches which reduce the number of syscall invocations
from within the kernel.

The rationale for this change is described in patch 1 as follows:

	The syscall entry points to the kernel defined by SYSCALL_DEFINEx()
	and COMPAT_SYSCALL_DEFINEx() should only be called from userspace
	through kernel entry points, but not from the kernel itself. This
	will allow cleanups and optimizations to the entry paths *and* to
	the parts of the kernel code which currently need to pretend to be
	userspace in order to make use of syscalls.

Two patches make use of existing kernel functions which can be used instead
of sys_xyzzy():

	syscalls: use kernel_wait4() instead of sys_wait4()
	syscalls: mm_release(): use do_futex() instead of sys_futex()

Another set of patches is closely limited in scope, as all callers were in
the same file:

	syscalls: do not call sys_getpgid() within the kernel
	syscalls: do not call sys_readlinkat() within the kernel
	syscalls: do not call sys_pipe2() within the kernel
	syscalls: do not call sys_renameat2() within the kernel
	syscalls: do not call sys_futimesat() within the kernel
	syscalls: do not call sys_epoll_*() within the kernel
	syscalls: do not call sys_signalfd4() within the kernel
	syscalls: do not call sys_eventfd2() within the kernel

A few special cases:

	syscalls: do not call sys_rt_sigpending() within the kernel
	syscalls: do not call sys_ioperm() within the kernel
	hostfs: rename do_rmdir() to hostfs_do_rmdir()

Then, a few patches are simple wrappers/indirections, with ksys_xyzzy() to
be called within the kernel.

	syscalls: do not call sys_mount() within the kernel
	syscalls: do not call sys_umount() within the kernel
	syscalls: do not call sys_dup{,3}() within the kernel
	syscalls: do not call sys_chroot() within the kernel
	syscalls: do not call sys_write() within the kernel
	syscalls: do not call sys_unshare() within the kernel
	syscalls: do not call sys_fadvise64{,_64}() within the kernel
	syscalls: do not call sys_mmap_pgoff() within the kernel
	syscalls: do not call sys_chdir() within the kernel
	syscalls: do not call sys_sync_file_range() within the kernel

I'm a bit more unsure about these remaining patches. They use inline stubs
named ksys_xyzzy() which (mostly) call fs-internal functions. Another
alternative would be to define these in fs/*, but then we'd get more and
more indirections.

	syscalls: do not call sys_unlink() within the kernel
	syscalls: do not call sys_rmdir() within the kernel
	syscalls: do not call sys_mkdir{,at}() within the kernel
	syscalls: do not call sys_symlink{,at}() within the kernel
	syscalls: do not call sys_mknod{,at}() within the kernel
	syscalls: do not call sys_link{,at}() within the kernel
	syscalls: do not call sys_{f,}chmod{at,}() within the kernel
	syscalls: do not call sys_{f,}access{,at}() within the kernel
	syscalls: do not call sys_ftruncate() within the kernel
	syscalls: do not call sys_{,l,f}chown() within the kernel
	syscalls: do not call sys_close() within the kernel

Thanks,
	Dominik

Dominik Brodowski (35):
  syscalls: define goal to not call sys_xyzzy() from within the kernel
  syscalls: use kernel_wait4() instead of sys_wait4()
  syscalls: mm_release(): use do_futex() instead of sys_futex()
  syscalls: do not call sys_getpgid() within the kernel
  syscalls: do not call sys_readlinkat() within the kernel
  syscalls: do not call sys_pipe2() within the kernel
  syscalls: do not call sys_renameat2() within the kernel
  syscalls: do not call sys_futimesat() within the kernel
  syscalls: do not call sys_epoll_*() within the kernel
  syscalls: do not call sys_signalfd4() within the kernel
  syscalls: do not call sys_eventfd2() within the kernel
  syscalls: do not call sys_rt_sigpending() within the kernel
  syscalls: do not call sys_ioperm() within the kernel
  syscalls: do not call sys_mount() within the kernel
  syscalls: do not call sys_umount() within the kernel
  syscalls: do not call sys_dup{,3}() within the kernel
  syscalls: do not call sys_chroot() within the kernel
  syscalls: do not call sys_write() within the kernel
  syscalls: do not call sys_unshare() within the kernel
  syscalls: do not call sys_fadvise64{,_64}() within the kernel
  syscalls: do not call sys_mmap_pgoff() within the kernel
  syscalls: do not call sys_chdir() within the kernel
  syscalls: do not call sys_sync_file_range() within the kernel
  syscalls: do not call sys_unlink() within the kernel
  hostfs: rename do_rmdir() to hostfs_do_rmdir()
  syscalls: do not call sys_rmdir() within the kernel
  syscalls: do not call sys_mkdir{,at}() within the kernel
  syscalls: do not call sys_symlink{,at}() within the kernel
  syscalls: do not call sys_mknod{,at}() within the kernel
  syscalls: do not call sys_link{,at}() within the kernel
  syscalls: do not call sys_{f,}chmod{at,}() within the kernel
  syscalls: do not call sys_{f,}access{,at}() within the kernel
  syscalls: do not call sys_ftruncate() within the kernel
  syscalls: do not call sys_{,l,f}chown() within the kernel
  syscalls: do not call sys_close() within the kernel

 Documentation/process/adding-syscalls.rst |  14 ----
 arch/alpha/kernel/osf_sys.c               |   2 +-
 arch/arm/kernel/sys_arm.c                 |   2 +-
 arch/arm64/kernel/sys.c                   |   2 +-
 arch/cris/kernel/sys_cris.c               |   2 +-
 arch/frv/kernel/sys_frv.c                 |   4 +-
 arch/ia64/kernel/sys_ia64.c               |   4 +-
 arch/m68k/kernel/sys_m68k.c               |   2 +-
 arch/metag/kernel/sys_metag.c             |   8 +--
 arch/microblaze/kernel/sys_microblaze.c   |   6 +-
 arch/mips/kernel/linux32.c                |  10 +--
 arch/mips/kernel/syscall.c                |   6 +-
 arch/mn10300/kernel/sys_mn10300.c         |   3 +-
 arch/parisc/kernel/sys_parisc.c           |  14 ++--
 arch/powerpc/kernel/sys_ppc32.c           |   8 +--
 arch/powerpc/kernel/syscalls.c            |   6 +-
 arch/riscv/kernel/sys_riscv.c             |   4 +-
 arch/s390/kernel/compat_linux.c           |  23 ++++---
 arch/s390/kernel/sys_s390.c               |   2 +-
 arch/score/kernel/sys_score.c             |   5 +-
 arch/sh/kernel/sys_sh.c                   |   4 +-
 arch/sh/kernel/sys_sh32.c                 |   8 +--
 arch/sparc/kernel/sys_sparc32.c           |  14 ++--
 arch/sparc/kernel/sys_sparc_32.c          |   6 +-
 arch/sparc/kernel/sys_sparc_64.c          |   2 +-
 arch/tile/kernel/compat.c                 |   4 +-
 arch/tile/kernel/sys.c                    |  12 ++--
 arch/um/kernel/syscall.c                  |   2 +-
 arch/x86/ia32/sys_ia32.c                  |  22 +++---
 arch/x86/include/asm/syscalls.h           |   1 +
 arch/x86/kernel/ioport.c                  |   7 +-
 arch/x86/kernel/sys_x86_64.c              |   2 +-
 arch/xtensa/kernel/syscall.c              |   2 +-
 drivers/base/devtmpfs.c                   |  11 +--
 drivers/tty/vt/vt_ioctl.c                 |   6 +-
 fs/autofs4/dev-ioctl.c                    |   2 +-
 fs/binfmt_misc.c                          |   2 +-
 fs/eventfd.c                              |   9 ++-
 fs/eventpoll.c                            |  23 +++++--
 fs/file.c                                 |  17 ++++-
 fs/hostfs/hostfs.h                        |   2 +-
 fs/hostfs/hostfs_kern.c                   |   2 +-
 fs/hostfs/hostfs_user.c                   |   2 +-
 fs/internal.h                             |  14 ++++
 fs/namei.c                                |  61 ++++++++++++-----
 fs/namespace.c                            |  19 ++++--
 fs/open.c                                 |  67 ++++++++++++++----
 fs/pipe.c                                 |   9 ++-
 fs/read_write.c                           |   9 ++-
 fs/signalfd.c                             |  14 ++--
 fs/stat.c                                 |  12 +++-
 fs/sync.c                                 |  12 +++-
 fs/utimes.c                               |  13 +++-
 include/linux/syscalls.h                  | 109 +++++++++++++++++++++++++++++-
 init/do_mounts.c                          |  12 ++--
 init/do_mounts.h                          |   4 +-
 init/do_mounts_initrd.c                   |  34 +++++-----
 init/do_mounts_md.c                       |   8 +--
 init/do_mounts_rd.c                       |  12 ++--
 init/initramfs.c                          |  42 ++++++------
 init/main.c                               |   7 +-
 init/noinitramfs.c                        |   6 +-
 kernel/exit.c                             |   2 +-
 kernel/fork.c                             |  11 ++-
 kernel/pid_namespace.c                    |   6 +-
 kernel/signal.c                           |  13 +++-
 kernel/sys.c                              |   9 ++-
 kernel/uid16.c                            |   6 +-
 kernel/umh.c                              |   2 +-
 mm/fadvise.c                              |  10 ++-
 mm/mmap.c                                 |  17 +++--
 mm/nommu.c                                |  17 +++--
 72 files changed, 572 insertions(+), 274 deletions(-)

-- 
2.16.2

^ permalink raw reply	[flat|nested] 54+ messages in thread

end of thread, other threads:[~2018-03-15 16:43 UTC | newest]

Thread overview: 54+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2018-03-11 10:55 [RFC PATCH 00/35] remove in-kernel syscall invocations Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 01/35] syscalls: define goal to not call sys_xyzzy() from within the kernel Dominik Brodowski
2018-03-11 15:24   ` Andy Lutomirski
2018-03-12  7:27     ` Ingo Molnar
2018-03-12 19:14     ` Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 02/35] syscalls: use kernel_wait4() instead of sys_wait4() Dominik Brodowski
2018-03-12  7:29   ` Ingo Molnar
2018-03-11 10:55 ` [RFC PATCH 03/35] syscalls: mm_release(): use do_futex() instead of sys_futex() Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 04/35] syscalls: do not call sys_getpgid() within the kernel Dominik Brodowski
2018-03-12  8:35   ` Christoph Hellwig
2018-03-12 20:01     ` Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 05/35] syscalls: do not call sys_readlinkat() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 06/35] syscalls: do not call sys_pipe2() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 07/35] syscalls: do not call sys_renameat2() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 08/35] syscalls: do not call sys_futimesat() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 09/35] syscalls: do not call sys_epoll_*() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 10/35] syscalls: do not call sys_signalfd4() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 11/35] syscalls: do not call sys_eventfd2() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 12/35] syscalls: do not call sys_rt_sigpending() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 13/35] syscalls: do not call sys_ioperm() " Dominik Brodowski
2018-03-11 15:20   ` Andy Lutomirski
2018-03-15 16:43   ` Greg Kroah-Hartman
2018-03-11 10:55 ` [RFC PATCH 14/35] syscalls: do not call sys_mount() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 15/35] syscalls: do not call sys_umount() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 16/35] syscalls: do not call sys_dup{,3}() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 17/35] syscalls: do not call sys_chroot() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 18/35] syscalls: do not call sys_write() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 19/35] syscalls: do not call sys_unshare() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 20/35] syscalls: do not call sys_fadvise64{,_64}() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 21/35] syscalls: do not call sys_mmap_pgoff() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 22/35] syscalls: do not call sys_chdir() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 23/35] syscalls: do not call sys_sync_file_range() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 24/35] syscalls: do not call sys_unlink() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 25/35] hostfs: rename do_rmdir() to hostfs_do_rmdir() Dominik Brodowski
2018-03-11 11:19   ` Richard Weinberger
2018-03-11 11:19     ` Richard Weinberger
2018-03-11 10:55 ` [RFC PATCH 26/35] syscalls: do not call sys_rmdir() within the kernel Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 27/35] syscalls: do not call sys_mkdir{,at}() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 28/35] syscalls: do not call sys_symlink{,at}() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 29/35] syscalls: do not call sys_mknod{,at}() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 30/35] syscalls: do not call sys_link{,at}() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 31/35] syscalls: do not call sys_{f,}chmod{at,}() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 32/35] syscalls: do not call sys_{f,}access{,at}() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 33/35] syscalls: do not call sys_ftruncate() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 34/35] syscalls: do not call sys_{,l,f}chown() " Dominik Brodowski
2018-03-11 10:55 ` [RFC PATCH 35/35] syscalls: do not call sys_close() " Dominik Brodowski
2018-03-12  7:37   ` Ingo Molnar
2018-03-12 19:43     ` Dominik Brodowski
2018-03-13  5:46       ` Ingo Molnar
2018-03-11 20:15 ` [RFC PATCH 00/35] remove in-kernel syscall invocations Linus Torvalds
2018-03-12 21:39   ` Dominik Brodowski
2018-03-12  7:32 ` Ingo Molnar
2018-03-12 19:30   ` Dominik Brodowski
2018-03-13  5:48     ` Ingo Molnar

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.