From: Kees Cook <keescook@chromium.org>
To: Andy Lutomirski <luto@amacapital.net>
Cc: "H. Peter Anvin" <hpa@zytor.com>,
Linus Torvalds <torvalds@linux-foundation.org>,
Ingo Molnar <mingo@kernel.org>,
Thomas Gleixner <tglx@linutronix.de>,
Andrew Lutomirski <luto@kernel.org>,
Borislav Petkov <bp@alien8.de>,
linux-kernel@vger.kernel.org, oleg@redhat.com,
Will Drewry <wad@chromium.org>
Subject: Re: pt_regs->ax == -ENOSYS
Date: Tue, 27 Apr 2021 19:05:56 -0700 [thread overview]
Message-ID: <202104271857.4708C9A25@keescook> (raw)
In-Reply-To: <78327AF2-575F-415E-98D4-6ECDFE311D0F@amacapital.net>
On Tue, Apr 27, 2021 at 04:51:06PM -0700, Andy Lutomirski wrote:
> Fortunately there is not, and never will be, a syscall -1. But I
> agree that calling max syscall + 1 should behave identically to calling
> a nonexistent syscall in the middle of the table.
If that happens, we have to separate the meaning of -1L from ptrace,
seccomp, etc. (i.e. we can't just add an "else { result = -ENOSYS; }" to
the syscall table dispatching code, since that'll overwrite any written
return value when the syscall is meant to be skipped with a specific
return value set by ptrace/seccomp.
syscall_trace_enter() will currently return either -1 or the
syscall. Which means someone making a "syscall -1" will get the skip
semantics currently (though the preloaded -ENOSYS results in the
"expected" outcome).
arm64 recently had to untangle this too:
15956689a0e6 arm64: compat: Ensure upper 32 bits of x0 are zero on syscall return
59ee987ea47c arm64: ptrace: Add a comment describing our syscall entry/exit trap ABI
139dbe5d8ed3 arm64: syscall: Expand the comment about ptrace and syscall(-1)
d83ee6e3e75d arm64: ptrace: Use NO_SYSCALL instead of -1 in syscall_trace_enter()
--
Kees Cook
next prev parent reply other threads:[~2021-04-28 2:06 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2021-04-27 21:15 H. Peter Anvin
2021-04-27 21:28 ` Andy Lutomirski
2021-04-27 22:58 ` H. Peter Anvin
2021-04-27 23:23 ` Andy Lutomirski
2021-04-28 0:05 ` H. Peter Anvin
2021-04-28 0:11 ` Andy Lutomirski
2021-04-28 0:20 ` H. Peter Anvin
2021-04-28 0:46 ` H. Peter Anvin
2021-04-27 23:29 ` Kees Cook
2021-04-27 23:51 ` Andy Lutomirski
2021-04-28 2:05 ` Kees Cook [this message]
2021-04-28 2:07 ` 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=202104271857.4708C9A25@keescook \
--to=keescook@chromium.org \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=oleg@redhat.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
--cc=wad@chromium.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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®