mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
* [PATCH v5 0/9] Syscall User Dispatch
@ 2020-08-10 23:26 Gabriel Krisman Bertazi
  2020-08-10 23:26 ` [PATCH v5 1/9] kernel: Support TIF_SYSCALL_INTERCEPT flag Gabriel Krisman Bertazi
                   ` (8 more replies)
  0 siblings, 9 replies; 11+ messages in thread
From: Gabriel Krisman Bertazi @ 2020-08-10 23:26 UTC (permalink / raw)
  To: luto, tglx
  Cc: keescook, x86, linux-kernel, linux-api, willy, linux-kselftest,
	shuah, Gabriel Krisman Bertazi, kernel

This is v5 of Syscall User Dispatch.  It has some big changes in
comparison to v4.

First of all, it allows the vdso trampoline code for architectures that
support it.  This is exposed through an arch hook.  It also addresses
the concern about what happens when a bad selector is provided, instead
of SIGSEGV, we fail with SIGSYS, which is more debug-able.

Another major change is that it is now based on top of Gleixner's common
syscall entry work, and is supposed to only be used by that code.
Therefore, the entry symbol is not exported outside of kernel/entry/ code.

The biggest change in this version is the attempt to avoid using one of
the final TIF flags on x86 32 bit, without increasing the size of that
variable to 64 bit.  My expectation is that, with this work, plus the
removal of TIF_IA32, TIF_X32 and TIF_FORCE_TF, we might be able to avoid
changing this field to 64 bits at all.  Instead, this follows the
suggestion by Andy to have a generic TIF flag for SECCOMP and this
mechanism, and use another field to decide which one is enabled.  The
code for this is not complex, so it seems like a viable approach.

Finally, this version adds some documentation to the feature.

Kees, I dropped your reviewed-by on patch 5, given the amount of
changes.

Thanks,

Previous submissions are archived at:
RFC/v1: https://lkml.org/lkml/2020/7/8/96
v2: https://lkml.org/lkml/2020/7/9/17
v3: https://lkml.org/lkml/2020/7/12/4
v4: https://lwn.net/ml/linux-kernel/20200712044516.2347844-1-krisman@collabora.com/

Gabriel Krisman Bertazi (9):
  kernel: Support TIF_SYSCALL_INTERCEPT flag
  kernel: entry: Support TIF_SYSCAL_INTERCEPT on common entry code
  x86: vdso: Expose sigreturn address on vdso to the kernel
  signal: Expose SYS_USER_DISPATCH si_code type
  kernel: Implement selective syscall userspace redirection
  kernel: entry: Support Syscall User Dispatch for common syscall entry
  x86: Enable Syscall User Dispatch
  selftests: Add kselftest for syscall user dispatch
  doc: Document Syscall User Dispatch

 .../admin-guide/syscall-user-dispatch.rst     |  87 ++++++
 arch/Kconfig                                  |  21 ++
 arch/x86/Kconfig                              |   1 +
 arch/x86/entry/vdso/vdso2c.c                  |   2 +
 arch/x86/entry/vdso/vdso32/sigreturn.S        |   2 +
 arch/x86/entry/vdso/vma.c                     |  15 +
 arch/x86/include/asm/elf.h                    |   1 +
 arch/x86/include/asm/thread_info.h            |   4 +-
 arch/x86/include/asm/vdso.h                   |   2 +
 arch/x86/kernel/signal_compat.c               |   2 +-
 fs/exec.c                                     |   8 +
 include/linux/entry-common.h                  |   6 +-
 include/linux/sched.h                         |   8 +-
 include/linux/seccomp.h                       |  20 +-
 include/linux/syscall_intercept.h             |  71 +++++
 include/linux/syscall_user_dispatch.h         |  29 ++
 include/uapi/asm-generic/siginfo.h            |   3 +-
 include/uapi/linux/prctl.h                    |   5 +
 kernel/entry/Makefile                         |   1 +
 kernel/entry/common.c                         |  32 +-
 kernel/entry/common.h                         |  15 +
 kernel/entry/syscall_user_dispatch.c          | 101 ++++++
 kernel/fork.c                                 |  10 +-
 kernel/seccomp.c                              |   7 +-
 kernel/sys.c                                  |   5 +
 tools/testing/selftests/Makefile              |   1 +
 .../syscall_user_dispatch/.gitignore          |   2 +
 .../selftests/syscall_user_dispatch/Makefile  |   9 +
 .../selftests/syscall_user_dispatch/config    |   1 +
 .../syscall_user_dispatch.c                   | 292 ++++++++++++++++++
 30 files changed, 744 insertions(+), 19 deletions(-)
 create mode 100644 Documentation/admin-guide/syscall-user-dispatch.rst
 create mode 100644 include/linux/syscall_intercept.h
 create mode 100644 include/linux/syscall_user_dispatch.h
 create mode 100644 kernel/entry/common.h
 create mode 100644 kernel/entry/syscall_user_dispatch.c
 create mode 100644 tools/testing/selftests/syscall_user_dispatch/.gitignore
 create mode 100644 tools/testing/selftests/syscall_user_dispatch/Makefile
 create mode 100644 tools/testing/selftests/syscall_user_dispatch/config
 create mode 100644 tools/testing/selftests/syscall_user_dispatch/syscall_user_dispatch.c

-- 
2.28.0


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

end of thread, other threads:[~2020-08-11 18:50 UTC | newest]

Thread overview: 11+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2020-08-10 23:26 [PATCH v5 0/9] Syscall User Dispatch Gabriel Krisman Bertazi
2020-08-10 23:26 ` [PATCH v5 1/9] kernel: Support TIF_SYSCALL_INTERCEPT flag Gabriel Krisman Bertazi
2020-08-10 23:26 ` [PATCH v5 2/9] kernel: entry: Support TIF_SYSCAL_INTERCEPT on common entry code Gabriel Krisman Bertazi
2020-08-10 23:26 ` [PATCH v5 3/9] x86: vdso: Expose sigreturn address on vdso to the kernel Gabriel Krisman Bertazi
2020-08-11 18:50   ` Andy Lutomirski
2020-08-10 23:26 ` [PATCH v5 4/9] signal: Expose SYS_USER_DISPATCH si_code type Gabriel Krisman Bertazi
2020-08-10 23:26 ` [PATCH v5 5/9] kernel: Implement selective syscall userspace redirection Gabriel Krisman Bertazi
2020-08-10 23:26 ` [PATCH v5 6/9] kernel: entry: Support Syscall User Dispatch for common syscall entry Gabriel Krisman Bertazi
2020-08-10 23:26 ` [PATCH v5 7/9] x86: Enable Syscall User Dispatch Gabriel Krisman Bertazi
2020-08-10 23:26 ` [PATCH v5 8/9] selftests: Add kselftest for syscall user dispatch Gabriel Krisman Bertazi
2020-08-10 23:26 ` [PATCH v5 9/9] doc: Document Syscall User Dispatch Gabriel Krisman Bertazi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®