Subject: Re: [PATCH v3 6/7] arm64: ptrace: Use NO_SYSCALL instead of -1 in syscall_trace_enter()

From: Kees Cook <[email-masked]>
Date: Sun, 12 Jul 2020 19:32:13 -0700

On Fri, Jul 10, 2020 at 05:11:48PM +0100, Will Deacon wrote:
> On Fri, Jul 10, 2020 at 09:04:08AM -0700, Kees Cook wrote:
> > On Fri, Jul 10, 2020 at 02:07:01PM +0100, Will Deacon wrote:
> > > Setting a system call number of -1 is special, as it indicates that the
> > > current system call should be skipped.
> > > 
> > > Use NO_SYSCALL instead of -1 when checking for this scenario, which is
> > > different from the -1 returned due to a seccomp failure.
> > 
> > I can't understand this paragraph. NO_SYSCALL is -1, so how is this
> > "different"?
> > 
> > arch/arm64/include/asm/ptrace.h:#define NO_SYSCALL (-1)
> > 
> > Do you just mean "stop using a literal '-1'"?
> 
> Yes, I'm trying to distinguish '-1' when used as a system call number
> from '-1' when used as the return value of secure_computing() on failure.
> It's currently all mixed up, and I think it's confusing trying to realise
> what is a system call number and what is an error code.

Okay, I gotcha now. Yes, that's entirely reasonable. (It's perhaps an
artifact of x86's implementation that they get directly passed through.)

-- 
Kees Cook

_______________________________________________
linux-arm-kernel mailing list
[email-masked]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel