Skip to content
Snippets Groups Projects
Commit db3d3076 authored by Will Drewry's avatar Will Drewry Committed by Iliyan Malchev
Browse files

CHROMIUM: seccomp: set -ENOSYS if there is no tracer


[Will attempt to add to -next, but this may need to wait
 until there is a motivating usecase, like ARM, since x86
 does the right thing already.]

On some arches, -ENOSYS is not set as the default system call
return value.  This means that a skipped or invalid system call
does not yield this response.  That behavior is not inline with
the stated ABI of seccomp filter.  To that end, we ensure we set
that value here to avoid arch idiosyncrasies.

Signed-off-by: default avatarWill Drewry <wad@chromium.org>
TEST=tegra2_kaen; boot, strace works, seccomp testsuite  trace tests pass
BUG=chromium-os:27878

Change-Id: I03a5e633d2fbb5d3d3cc33c067b2887068364c17
Reviewed-on: https://gerrit.chromium.org/gerrit/21337


Reviewed-by: default avatarKees Cook <keescook@chromium.org>
Reviewed-by: default avatarWill Drewry <wad@chromium.org>
Tested-by: default avatarWill Drewry <wad@chromium.org>
Signed-off-by: default avatarSasha Levitskiy <sanek@google.com>
parent 56e16b2a
No related branches found
No related tags found
No related merge requests found
...@@ -413,8 +413,12 @@ int __secure_computing(int this_syscall) ...@@ -413,8 +413,12 @@ int __secure_computing(int this_syscall)
goto skip; goto skip;
case SECCOMP_RET_TRACE: case SECCOMP_RET_TRACE:
/* Skip these calls if there is no tracer. */ /* Skip these calls if there is no tracer. */
if (!ptrace_event_enabled(current, PTRACE_EVENT_SECCOMP)) if (!ptrace_event_enabled(current, PTRACE_EVENT_SECCOMP)) {
/* Make sure userspace sees an ENOSYS. */
syscall_set_return_value(current,
task_pt_regs(current), -ENOSYS, 0);
goto skip; goto skip;
}
/* Allow the BPF to provide the event message */ /* Allow the BPF to provide the event message */
ptrace_event(PTRACE_EVENT_SECCOMP, data); ptrace_event(PTRACE_EVENT_SECCOMP, data);
/* /*
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment