From: "tip-bot2 for Sami Tolvanen" <tip-bot2@linutronix.de>
To: linux-tip-commits@vger.kernel.org
Cc: Sami Tolvanen <samitolvanen@google.com>,
Andy Lutomirski <luto@kernel.org>, Borislav Petkov <bp@alien8.de>,
"H . Peter Anvin" <hpa@zytor.com>,
Kees Cook <keescook@chromium.org>,
Linus Torvalds <torvalds@linux-foundation.org>,
Peter Zijlstra <peterz@infradead.org>,
Thomas Gleixner <tglx@linutronix.de>,
Ingo Molnar <mingo@kernel.org>,
linux-kernel@vger.kernel.org
Subject: [tip: x86/entry] syscalls/x86: Fix function types in COND_SYSCALL
Date: Fri, 11 Oct 2019 11:22:01 -0000 [thread overview]
Message-ID: <157079292180.9978.16293404710090205910.tip-bot2@tip-bot2> (raw)
In-Reply-To: <20191008224049.115427-6-samitolvanen@google.com>
The following commit has been merged into the x86/entry branch of tip:
Commit-ID: 6e4847640c6aebcaa2d9b3686cecc91b41f09269
Gitweb: https://git.kernel.org/tip/6e4847640c6aebcaa2d9b3686cecc91b41f09269
Author: Sami Tolvanen <samitolvanen@google.com>
AuthorDate: Tue, 08 Oct 2019 15:40:49 -07:00
Committer: Ingo Molnar <mingo@kernel.org>
CommitterDate: Fri, 11 Oct 2019 12:49:19 +02:00
syscalls/x86: Fix function types in COND_SYSCALL
Define a weak function in COND_SYSCALL instead of a weak alias to
sys_ni_syscall(), which has an incompatible type. This fixes indirect
call mismatches with Control-Flow Integrity (CFI) checking.
Signed-off-by: Sami Tolvanen <samitolvanen@google.com>
Acked-by: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: H . Peter Anvin <hpa@zytor.com>
Cc: Kees Cook <keescook@chromium.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Link: https://lkml.kernel.org/r/20191008224049.115427-6-samitolvanen@google.com
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
arch/x86/include/asm/syscall_wrapper.h | 21 ++++++++++++++++-----
1 file changed, 16 insertions(+), 5 deletions(-)
diff --git a/arch/x86/include/asm/syscall_wrapper.h b/arch/x86/include/asm/syscall_wrapper.h
index 3dab048..e2389ce 100644
--- a/arch/x86/include/asm/syscall_wrapper.h
+++ b/arch/x86/include/asm/syscall_wrapper.h
@@ -6,6 +6,8 @@
#ifndef _ASM_X86_SYSCALL_WRAPPER_H
#define _ASM_X86_SYSCALL_WRAPPER_H
+struct pt_regs;
+
/* Mapping of registers to parameters for syscalls on x86-64 and x32 */
#define SC_X86_64_REGS_TO_ARGS(x, ...) \
__MAP(x,__SC_ARGS \
@@ -64,9 +66,15 @@
SYSCALL_ALIAS(__ia32_sys_##sname, __x64_sys_##sname); \
asmlinkage long __x64_sys_##sname(const struct pt_regs *__unused)
-#define COND_SYSCALL(name) \
- cond_syscall(__x64_sys_##name); \
- cond_syscall(__ia32_sys_##name)
+#define COND_SYSCALL(name) \
+ asmlinkage __weak long __x64_sys_##name(const struct pt_regs *__unused) \
+ { \
+ return sys_ni_syscall(); \
+ } \
+ asmlinkage __weak long __ia32_sys_##name(const struct pt_regs *__unused)\
+ { \
+ return sys_ni_syscall(); \
+ }
#define SYS_NI(name) \
SYSCALL_ALIAS(__x64_sys_##name, sys_ni_posix_timers); \
@@ -218,7 +226,11 @@
#endif
#ifndef COND_SYSCALL
-#define COND_SYSCALL(name) cond_syscall(__x64_sys_##name)
+#define COND_SYSCALL(name) \
+ asmlinkage __weak long __x64_sys_##name(const struct pt_regs *__unused) \
+ { \
+ return sys_ni_syscall(); \
+ }
#endif
#ifndef SYS_NI
@@ -230,7 +242,6 @@
* For VSYSCALLS, we need to declare these three syscalls with the new
* pt_regs-based calling convention for in-kernel use.
*/
-struct pt_regs;
asmlinkage long __x64_sys_getcpu(const struct pt_regs *regs);
asmlinkage long __x64_sys_gettimeofday(const struct pt_regs *regs);
asmlinkage long __x64_sys_time(const struct pt_regs *regs);
next prev parent reply other threads:[~2019-10-11 11:22 UTC|newest]
Thread overview: 35+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-09-13 21:00 [PATCH 0/4] x86: fix syscall function type mismatches Sami Tolvanen
2019-09-13 21:00 ` [PATCH 1/4] x86: use the correct function type in SYSCALL_DEFINE0 Sami Tolvanen
2019-09-13 22:33 ` Andy Lutomirski
2019-09-13 21:00 ` [PATCH 2/4] x86: use the correct function type for sys32_(rt_)sigreturn Sami Tolvanen
2019-09-13 22:44 ` Andy Lutomirski
2019-09-13 23:29 ` Sami Tolvanen
2019-09-13 21:00 ` [PATCH 3/4] x86: use the correct function type for sys_ni_syscall Sami Tolvanen
2019-09-13 22:45 ` Andy Lutomirski
2019-09-13 23:26 ` Sami Tolvanen
2019-09-14 0:27 ` Andy Lutomirski
2019-09-16 20:43 ` Will Deacon
2019-09-13 21:00 ` [PATCH 4/4] x86: fix function types in COND_SYSCALL Sami Tolvanen
2019-09-13 22:46 ` Andy Lutomirski
2019-09-13 23:28 ` Sami Tolvanen
2019-09-14 0:28 ` Andy Lutomirski
2019-09-17 22:44 ` Sami Tolvanen
2019-09-18 22:46 ` [PATCH v2 0/5] x86: fix syscall function type mismatches Sami Tolvanen
2019-09-18 22:46 ` [PATCH v2 1/5] x86: use the correct function type in SYSCALL_DEFINE0 Sami Tolvanen
2019-09-18 22:46 ` [PATCH v2 2/5] x86/syscalls: Wire up COMPAT_SYSCALL_DEFINE0 Sami Tolvanen
2019-09-18 22:46 ` [PATCH v2 3/5] x86: use COMPAT_SYSCALL_DEFINE0 for IA32 (rt_)sigreturn Sami Tolvanen
2019-09-18 22:46 ` [PATCH v2 4/5] x86: use the correct function type for sys_ni_syscall Sami Tolvanen
2019-09-18 22:46 ` [PATCH v2 5/5] x86: fix function types in COND_SYSCALL Sami Tolvanen
2019-10-08 22:40 ` [RESEND PATCH v2 0/5] x86: fix syscall function type mismatches Sami Tolvanen
2019-10-08 22:40 ` [RESEND PATCH v2 1/5] x86: use the correct function type in SYSCALL_DEFINE0 Sami Tolvanen
2019-10-11 11:22 ` [tip: x86/entry] syscalls/x86: Use " tip-bot2 for Sami Tolvanen
2019-10-08 22:40 ` [RESEND PATCH v2 2/5] x86/syscalls: Wire up COMPAT_SYSCALL_DEFINE0 Sami Tolvanen
2019-10-11 11:22 ` [tip: x86/entry] syscalls/x86: " tip-bot2 for Andy Lutomirski
2019-10-08 22:40 ` [RESEND PATCH v2 3/5] x86: use COMPAT_SYSCALL_DEFINE0 for IA32 (rt_)sigreturn Sami Tolvanen
2019-10-11 11:22 ` [tip: x86/entry] syscalls/x86: Use " tip-bot2 for Sami Tolvanen
2019-10-08 22:40 ` [RESEND PATCH v2 4/5] x86: use the correct function type for sys_ni_syscall Sami Tolvanen
2019-10-11 11:22 ` [tip: x86/entry] syscalls/x86: Use " tip-bot2 for Sami Tolvanen
2019-10-08 22:40 ` [RESEND PATCH v2 5/5] x86: fix function types in COND_SYSCALL Sami Tolvanen
2019-10-11 11:22 ` tip-bot2 for Sami Tolvanen [this message]
2019-10-10 18:17 ` [RESEND PATCH v2 0/5] x86: fix syscall function type mismatches Andy Lutomirski
2019-10-11 10:50 ` Ingo Molnar
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=157079292180.9978.16293404710090205910.tip-bot2@tip-bot2 \
--to=tip-bot2@linutronix.de \
--cc=bp@alien8.de \
--cc=hpa@zytor.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=luto@kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=samitolvanen@google.com \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.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;
as well as URLs for NNTP newsgroup(s).