arm64: ptrace: allow tracer to skip a system call
Note: This patch is from v6 of Takahiro's proposed "arm64: add seccomp support" patchset (leecam@google.com) If tracer specifies -1 as a syscall number, this traced system call should be skipped with a value in x0 used as a return value. This patch enables this semantics, but there is a restriction here: when syscall(-1) is issued by user, tracer cannot skip this system call and modify a return value at syscall entry. In order to ease this flavor, we need to treat whatever value in x0 as a return value, but this might result in a bogus value being returned, especially when tracer doesn't do anything at this syscall. So we always return ENOSYS instead, while we have another chance to change a return value at syscall exit. Please also note: * syscall entry tracing and syscall exit tracing (ftrace tracepoint and audit) are always executed, if enabled, even when skipping a system call (that is, -1). In this way, we can avoid a potential bug where audit_syscall_entry() might be called without audit_syscall_exit() at the previous system call being called, that would cause OOPs in audit_syscall_entry(). * syscallno may also be set to -1 if a fatal signal (SIGKILL) is detected in tracehook_report_syscall_entry(), but since a value set to x0 (ENOSYS) is not used in this case, we may neglect the case. Signed-off-by: AKASHI Takahiro <takahiro.akashi <at> linaro.org> Git-commit: feb28436457d33fef9f264635291432df4b74122 Git-repo: https://android.googlesource.com/kernel/common.git [imaund@codeaurora.org: Resolved context conflicts] Signed-off-by:Ian Maund <imaund@codeaurora.org> Signed-off-by:
Ravi Kumar Siddojigari <rsiddoji@codeaurora.org> Change-Id: I7daf084bd5a28dde5a6c5e7fe95b4b7db8df928a Signed-off-by:
Nirmal Abraham <nabrah@codeaurora.org>
Loading
Please register or sign in to comment