From: Andy Lutomirski <luto@amacapital.net>
To: linux-kernel@vger.kernel.org, Kees Cook <keescook@chromium.org>,
Will Drewry <wad@chromium.org>, Oleg Nesterov <oleg@redhat.com>
Cc: x86@kernel.org, linux-arm-kernel@lists.infradead.org,
linux-mips@linux-mips.org, linux-arch@vger.kernel.org,
linux-security-module@vger.kernel.org,
Alexei Starovoitov <ast@plumgrid.com>,
hpa@zytor.com, Frederic Weisbecker <fweisbec@gmail.com>,
Andy Lutomirski <luto@amacapital.net>
Subject: [PATCH v5 0/5] x86: two-phase syscall tracing and seccomp fastpath
Date: Fri, 5 Sep 2014 15:13:51 -0700 [thread overview]
Message-ID: <cover.1409954077.git.luto@amacapital.net> (raw)
This applies to:
git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git seccomp-fastpath
Gitweb:
https://git.kernel.org/cgit/linux/kernel/git/kees/linux.git/log/?h=seccomp/fastpath
This is both a cleanup and a speedup. It reduces overhead due to
installing a trivial seccomp filter by 87%. The speedup comes from
avoiding the full syscall tracing mechanism for filters that don't
return SECCOMP_RET_TRACE.
This series depends on splitting the seccomp hooks into two phases.
The first phase evaluates the filter; it can skip syscalls, allow
them, kill the calling task, or pass a u32 to the second phase. The
second phase requires a full tracing context, and it sends ptrace
events if necessary. The seccomp core part is in Kees' seccomp/fastpath
tree.
These patches implement a similar split for the x86 syscall
entry work. The C callback is invoked in two phases: the first has
only a partial frame, and it can request phase 2 processing with a
full frame.
Finally, I switch the 64-bit system_call code to use the new split
entry work. This is a net deletion of assembly code: it replaces
all of the audit entry muck.
In the process, I fixed some bugs.
If this is acceptable, someone can do the same tweak for the
ia32entry and entry_32 code.
This passes all seccomp tests that I know of.
Changes from v4:
- Rebased (which seems to have been a no-op)
- Fixed embarrassing bug that broke allnoconfig
(patch 3 was missing an ifdef).
Changes from v3:
- Dropped the core seccomp changes from the email -- Kees has applied them.
- Add patch 2 (the TIF_NOHZ change).
- Fix TIF_NOHZ in the two-phase entry code (thanks, Oleg).
Changes from v2:
- Fixed 32-bit x86 build (and the tests pass).
- Put the doc patch where it belongs.
Changes from v1:
- Rebased on top of Kees' shiny new seccomp tree (no effect on the x86
part).
- Improved patch 6 vs patch 7 split (thanks Alexei!)
- Fixed bogus -ENOSYS in patch 5 (thanks Kees!)
- Improved changelog message in patch 6.
Changes from RFC version:
- The first three patches are more or less the same
- The rest is more or less a rewrite
Andy Lutomirski (5):
x86,x32,audit: Fix x32's AUDIT_ARCH wrt audit
x86,entry: Only call user_exit if TIF_NOHZ
x86: Split syscall_trace_enter into two phases
x86_64,entry: Treat regs->ax the same in fastpath and slowpath
syscalls
x86_64,entry: Use split-phase syscall_trace_enter for 64-bit syscalls
arch/x86/include/asm/calling.h | 6 +-
arch/x86/include/asm/ptrace.h | 5 ++
arch/x86/kernel/entry_64.S | 51 +++++--------
arch/x86/kernel/ptrace.c | 165 +++++++++++++++++++++++++++++++++--------
4 files changed, 164 insertions(+), 63 deletions(-)
--
1.9.3
WARNING: multiple messages have this Message-ID (diff)
From: luto@amacapital.net (Andy Lutomirski)
To: linux-arm-kernel@lists.infradead.org
Subject: [PATCH v5 0/5] x86: two-phase syscall tracing and seccomp fastpath
Date: Fri, 5 Sep 2014 15:13:51 -0700 [thread overview]
Message-ID: <cover.1409954077.git.luto@amacapital.net> (raw)
This applies to:
git://git.kernel.org/pub/scm/linux/kernel/git/kees/linux.git seccomp-fastpath
Gitweb:
https://git.kernel.org/cgit/linux/kernel/git/kees/linux.git/log/?h=seccomp/fastpath
This is both a cleanup and a speedup. It reduces overhead due to
installing a trivial seccomp filter by 87%. The speedup comes from
avoiding the full syscall tracing mechanism for filters that don't
return SECCOMP_RET_TRACE.
This series depends on splitting the seccomp hooks into two phases.
The first phase evaluates the filter; it can skip syscalls, allow
them, kill the calling task, or pass a u32 to the second phase. The
second phase requires a full tracing context, and it sends ptrace
events if necessary. The seccomp core part is in Kees' seccomp/fastpath
tree.
These patches implement a similar split for the x86 syscall
entry work. The C callback is invoked in two phases: the first has
only a partial frame, and it can request phase 2 processing with a
full frame.
Finally, I switch the 64-bit system_call code to use the new split
entry work. This is a net deletion of assembly code: it replaces
all of the audit entry muck.
In the process, I fixed some bugs.
If this is acceptable, someone can do the same tweak for the
ia32entry and entry_32 code.
This passes all seccomp tests that I know of.
Changes from v4:
- Rebased (which seems to have been a no-op)
- Fixed embarrassing bug that broke allnoconfig
(patch 3 was missing an ifdef).
Changes from v3:
- Dropped the core seccomp changes from the email -- Kees has applied them.
- Add patch 2 (the TIF_NOHZ change).
- Fix TIF_NOHZ in the two-phase entry code (thanks, Oleg).
Changes from v2:
- Fixed 32-bit x86 build (and the tests pass).
- Put the doc patch where it belongs.
Changes from v1:
- Rebased on top of Kees' shiny new seccomp tree (no effect on the x86
part).
- Improved patch 6 vs patch 7 split (thanks Alexei!)
- Fixed bogus -ENOSYS in patch 5 (thanks Kees!)
- Improved changelog message in patch 6.
Changes from RFC version:
- The first three patches are more or less the same
- The rest is more or less a rewrite
Andy Lutomirski (5):
x86,x32,audit: Fix x32's AUDIT_ARCH wrt audit
x86,entry: Only call user_exit if TIF_NOHZ
x86: Split syscall_trace_enter into two phases
x86_64,entry: Treat regs->ax the same in fastpath and slowpath
syscalls
x86_64,entry: Use split-phase syscall_trace_enter for 64-bit syscalls
arch/x86/include/asm/calling.h | 6 +-
arch/x86/include/asm/ptrace.h | 5 ++
arch/x86/kernel/entry_64.S | 51 +++++--------
arch/x86/kernel/ptrace.c | 165 +++++++++++++++++++++++++++++++++--------
4 files changed, 164 insertions(+), 63 deletions(-)
--
1.9.3
next reply other threads:[~2014-09-05 22:14 UTC|newest]
Thread overview: 61+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-09-05 22:13 Andy Lutomirski [this message]
2014-09-05 22:13 ` [PATCH v5 0/5] x86: two-phase syscall tracing and seccomp fastpath Andy Lutomirski
2014-09-05 22:13 ` [PATCH v5 1/5] x86,x32,audit: Fix x32's AUDIT_ARCH wrt audit Andy Lutomirski
2014-09-05 22:13 ` Andy Lutomirski
2014-09-09 2:43 ` [tip:x86/seccomp] x86, x32, audit: " tip-bot for Andy Lutomirski
2014-09-05 22:13 ` [PATCH v5 2/5] x86,entry: Only call user_exit if TIF_NOHZ Andy Lutomirski
2014-09-05 22:13 ` Andy Lutomirski
2014-09-09 2:43 ` [tip:x86/seccomp] x86, entry: " tip-bot for Andy Lutomirski
2014-09-05 22:13 ` [PATCH v5 3/5] x86: Split syscall_trace_enter into two phases Andy Lutomirski
2014-09-05 22:13 ` Andy Lutomirski
2014-09-09 2:44 ` [tip:x86/seccomp] " tip-bot for Andy Lutomirski
2015-02-05 21:19 ` [PATCH v5 3/5] " Dmitry V. Levin
2015-02-05 21:19 ` Dmitry V. Levin
2015-02-05 21:27 ` Kees Cook
2015-02-05 21:27 ` Kees Cook
2015-02-05 21:40 ` Dmitry V. Levin
2015-02-05 21:40 ` Dmitry V. Levin
2015-02-05 21:52 ` Andy Lutomirski
2015-02-05 21:52 ` Andy Lutomirski
2015-02-05 23:12 ` Kees Cook
2015-02-05 23:12 ` Kees Cook
2015-02-05 23:39 ` Dmitry V. Levin
2015-02-05 23:39 ` Dmitry V. Levin
2015-02-05 23:49 ` Kees Cook
2015-02-05 23:49 ` Kees Cook
2015-02-06 0:09 ` Andy Lutomirski
2015-02-06 0:09 ` Andy Lutomirski
2015-02-06 2:32 ` Dmitry V. Levin
2015-02-06 2:32 ` Dmitry V. Levin
2015-02-06 2:38 ` Andy Lutomirski
2015-02-06 2:38 ` Andy Lutomirski
2015-02-06 19:23 ` Kees Cook
2015-02-06 19:23 ` Kees Cook
2015-02-06 19:32 ` Andy Lutomirski
2015-02-06 19:32 ` Andy Lutomirski
2015-02-06 20:07 ` Kees Cook
2015-02-06 20:07 ` Kees Cook
2015-02-06 20:12 ` Andy Lutomirski
2015-02-06 20:12 ` Andy Lutomirski
2015-02-06 20:16 ` Kees Cook
2015-02-06 20:16 ` Kees Cook
2015-02-06 20:20 ` Andy Lutomirski
2015-02-06 20:20 ` Andy Lutomirski
2015-02-06 23:17 ` a method to distinguish between syscall-enter/exit-stop Dmitry V. Levin
2015-02-06 23:17 ` Dmitry V. Levin
2015-02-07 1:07 ` Kees Cook
2015-02-07 1:07 ` Kees Cook
2015-02-07 3:04 ` Dmitry V. Levin
2015-02-07 3:04 ` Dmitry V. Levin
2015-02-06 20:11 ` [PATCH v5 3/5] x86: Split syscall_trace_enter into two phases H. Peter Anvin
2015-02-06 20:11 ` H. Peter Anvin
2014-09-05 22:13 ` [PATCH v5 4/5] x86_64,entry: Treat regs->ax the same in fastpath and slowpath syscalls Andy Lutomirski
2014-09-05 22:13 ` [PATCH v5 4/5] x86_64, entry: " Andy Lutomirski
2014-09-09 2:44 ` [tip:x86/seccomp] x86_64, entry: Treat regs-> ax " tip-bot for Andy Lutomirski
2014-09-05 22:13 ` [PATCH v5 5/5] x86_64,entry: Use split-phase syscall_trace_enter for 64-bit syscalls Andy Lutomirski
2014-09-05 22:13 ` [PATCH v5 5/5] x86_64, entry: " Andy Lutomirski
2014-09-09 2:44 ` [tip:x86/seccomp] " tip-bot for Andy Lutomirski
2014-09-08 19:29 ` [PATCH v5 0/5] x86: two-phase syscall tracing and seccomp fastpath Kees Cook
2014-09-08 19:29 ` Kees Cook
2014-09-08 19:49 ` H. Peter Anvin
2014-09-08 19:49 ` H. Peter Anvin
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=cover.1409954077.git.luto@amacapital.net \
--to=luto@amacapital.net \
--cc=ast@plumgrid.com \
--cc=fweisbec@gmail.com \
--cc=hpa@zytor.com \
--cc=keescook@chromium.org \
--cc=linux-arch@vger.kernel.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mips@linux-mips.org \
--cc=linux-security-module@vger.kernel.org \
--cc=oleg@redhat.com \
--cc=wad@chromium.org \
--cc=x86@kernel.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
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.