From: Mark Rutland <mark.rutland@arm.com>
To: Sami Tolvanen <samitolvanen@google.com>
Cc: Catalin Marinas <catalin.marinas@arm.com>,
Will Deacon <will.deacon@arm.com>,
Kees Cook <keescook@chromium.org>,
Nick Desaulniers <ndesaulniers@google.com>,
linux-arm-kernel@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH 2/2] arm64: use the correct function type in SYSCALL_DEFINE0
Date: Fri, 3 May 2019 11:21:28 +0100 [thread overview]
Message-ID: <20190503102128.GD47811@lakrids.cambridge.arm.com> (raw)
In-Reply-To: <20190501200451.255615-3-samitolvanen@google.com>
On Wed, May 01, 2019 at 01:04:51PM -0700, Sami Tolvanen wrote:
> Although a syscall defined using SYSCALL_DEFINE0 doesn't accept
> parameters, use the correct function type to avoid indirect call
> type mismatches with Control-Flow Integrity checking.
Generally, this makes sense, but I'm not sure that this is complete.
IIUC this introduces a new type mismatch with sys_ni_syscall() in some
cases. We probably need that to use SYSCALL_DEFINE0(), and maybe have a
ksys_ni_syscall() for in-kernel wrappers.
Thanks,
Mark.
>
> Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
> ---
> arch/arm64/include/asm/syscall_wrapper.h | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
>
> diff --git a/arch/arm64/include/asm/syscall_wrapper.h b/arch/arm64/include/asm/syscall_wrapper.h
> index a4477e515b798..507d0ee6bc690 100644
> --- a/arch/arm64/include/asm/syscall_wrapper.h
> +++ b/arch/arm64/include/asm/syscall_wrapper.h
> @@ -30,10 +30,10 @@
> } \
> static inline long __do_compat_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
>
> -#define COMPAT_SYSCALL_DEFINE0(sname) \
> - asmlinkage long __arm64_compat_sys_##sname(void); \
> - ALLOW_ERROR_INJECTION(__arm64_compat_sys_##sname, ERRNO); \
> - asmlinkage long __arm64_compat_sys_##sname(void)
> +#define COMPAT_SYSCALL_DEFINE0(sname) \
> + asmlinkage long __arm64_compat_sys_##sname(const struct pt_regs *__unused); \
> + ALLOW_ERROR_INJECTION(__arm64_compat_sys_##sname, ERRNO); \
> + asmlinkage long __arm64_compat_sys_##sname(const struct pt_regs *__unused)
>
> #define COND_SYSCALL_COMPAT(name) \
> cond_syscall(__arm64_compat_sys_##name);
> @@ -62,11 +62,11 @@
> static inline long __do_sys##name(__MAP(x,__SC_DECL,__VA_ARGS__))
>
> #ifndef SYSCALL_DEFINE0
> -#define SYSCALL_DEFINE0(sname) \
> - SYSCALL_METADATA(_##sname, 0); \
> - asmlinkage long __arm64_sys_##sname(void); \
> - ALLOW_ERROR_INJECTION(__arm64_sys_##sname, ERRNO); \
> - asmlinkage long __arm64_sys_##sname(void)
> +#define SYSCALL_DEFINE0(sname) \
> + SYSCALL_METADATA(_##sname, 0); \
> + asmlinkage long __arm64_sys_##sname(const struct pt_regs *__unused); \
> + ALLOW_ERROR_INJECTION(__arm64_sys_##sname, ERRNO); \
> + asmlinkage long __arm64_sys_##sname(const struct pt_regs *__unused)
> #endif
>
> #ifndef COND_SYSCALL
> --
> 2.21.0.593.g511ec345e18-goog
>
next prev parent reply other threads:[~2019-05-03 10:21 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-05-01 20:04 [PATCH 0/2] fix function type mismatches in syscall wrappers Sami Tolvanen
2019-05-01 20:04 ` [PATCH 1/2] arm64: fix syscall_fn_t type Sami Tolvanen
2019-05-03 10:11 ` Mark Rutland
2019-05-01 20:04 ` [PATCH 2/2] arm64: use the correct function type in SYSCALL_DEFINE0 Sami Tolvanen
2019-05-03 10:21 ` Mark Rutland [this message]
2019-05-03 17:02 ` Sami Tolvanen
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=20190503102128.GD47811@lakrids.cambridge.arm.com \
--to=mark.rutland@arm.com \
--cc=catalin.marinas@arm.com \
--cc=keescook@chromium.org \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-kernel@vger.kernel.org \
--cc=ndesaulniers@google.com \
--cc=samitolvanen@google.com \
--cc=will.deacon@arm.com \
/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;
as well as URLs for NNTP newsgroup(s).