Re: ptrace: seccomp: Return value when the call was already invalid

From: Kees Cook
Date: Mon Jul 06 2020 - 17:40:18 EST


On Mon, Jul 06, 2020 at 09:15:51AM +0100, Will Deacon wrote:
> On Sat, Jul 04, 2020 at 09:56:50PM -0700, Kees Cook wrote:
> > different per-architecture expectations). If I read this thread
> > correctly, we need to test:
> >
> > syscall(-1), direct, returns ENOSYS
> > syscall(-10), direct, returns ENOSYS
> > syscall(-1), SECCOMP_RET_TRACE+PTRACE_CONT, returns ENOSYS
> > syscall(-10), SECCOMP_RET_TRACE+PTRACE_CONT, returns ENOSYS
> > syscall(-1), ptrace+PTRACE_SYSCALL, returns ENOSYS
> > syscall(-10), ptrace+PTRACE_SYSCALL, returns ENOSYS
> >
> > do we need to double-check that registers before/after are otherwise
> > unchanged too? (I *think* just looking at syscall return should be
> > sufficient to catch the visible results.)
>
> There's also the case where the tracer sets the system call to -1 to skip
> it.

Yes, though that's already part of the seccomp selftests. (Specifically
TRACE_syscall's syscall_faked.)

--
Kees Cook