From: Steven Rostedt <rostedt@goodmis.org>
To: alexander.levin@verizon.com
Cc: "dvyukov@google.com" <dvyukov@google.com>,
"tglx@linutronix.de" <tglx@linutronix.de>,
"scientist@fb.com" <scientist@fb.com>,
"glider@google.com" <glider@google.com>,
"andreyknvl@google.com" <andreyknvl@google.com>,
"arnd@arndb.de" <arnd@arndb.de>,
"mathieu.desnoyers@efficios.com" <mathieu.desnoyers@efficios.com>,
"daniel.vetter@ffwll.ch" <daniel.vetter@ffwll.ch>,
"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [RFC 2/3] abi_spec: hooks into syscall to allow pre and post checking
Date: Mon, 21 Nov 2016 10:54:43 -0500 [thread overview]
Message-ID: <20161121105443.249ddff8@gandalf.local.home> (raw)
In-Reply-To: <1479317803-17220-3-git-send-email-alexander.levin@verizon.com>
On Wed, 16 Nov 2016 17:37:01 +0000
alexander.levin@verizon.com wrote:
> This is a simple way to be able to verify syscall parameters before the
> call to the actual syscall, and also verify the return value after the
> call.
>
> Signed-off-by: Sasha Levin <alexander.levin@verizon.com>
> ---
> include/linux/syscalls.h | 7 ++++++-
> kernel/Makefile | 2 ++
> kernel/abi_spec.c | 15 +++++++++++++++
> 3 files changed, 23 insertions(+), 1 deletion(-)
> create mode 100644 kernel/abi_spec.c
>
> diff --git a/include/linux/syscalls.h b/include/linux/syscalls.h
> index 91a740f..6aa3228 100644
> --- a/include/linux/syscalls.h
> +++ b/include/linux/syscalls.h
> @@ -79,6 +79,7 @@ union bpf_attr;
> #include <linux/quota.h>
> #include <linux/key.h>
> #include <trace/syscall.h>
> +#include <linux/abi_spec.h>
>
> /*
> * __MAP - apply a macro to syscall arguments
> @@ -192,13 +193,17 @@ extern struct trace_event_functions exit_syscall_print_funcs;
>
> #define __PROTECT(...) asmlinkage_protect(__VA_ARGS__)
> #define __SYSCALL_DEFINEx(x, name, ...) \
> + extern const struct syscall_spec syscall_spec##name; \
> asmlinkage long sys##name(__MAP(x,__SC_DECL,__VA_ARGS__)) \
> __attribute__((alias(__stringify(SyS##name)))); \
> static inline long SYSC##name(__MAP(x,__SC_DECL,__VA_ARGS__)); \
> asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)); \
> asmlinkage long SyS##name(__MAP(x,__SC_LONG,__VA_ARGS__)) \
> { \
> - long ret = SYSC##name(__MAP(x,__SC_CAST,__VA_ARGS__)); \
> + long ret; \
> + abispec_check_pre(&syscall_spec##name, __MAP(x,__SC_CAST,__VA_ARGS__)); \
> + ret = SYSC##name(__MAP(x,__SC_CAST,__VA_ARGS__)); \
> + abispec_check_post(&syscall_spec##name, ret, __MAP(x,__SC_CAST,__VA_ARGS__)); \
Do you want this for DEFINE0() too? Or does this not care about system
calls with no arguments?
-- Steve
> __MAP(x,__SC_TEST,__VA_ARGS__); \
> __PROTECT(x, ret,__MAP(x,__SC_ARGS,__VA_ARGS__)); \
> return ret; \
next prev parent reply other threads:[~2016-11-21 15:54 UTC|newest]
Thread overview: 24+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-11-16 17:37 [RFC 0/3] ABI spec - verification alexander.levin
2016-11-16 17:37 ` [RFC 1/3] abi_spec: basic definitions of constraints, args and syscalls alexander.levin
2016-11-21 14:48 ` Dmitry Vyukov
2016-11-23 14:59 ` alexander.levin
2016-12-12 10:29 ` Dmitry Vyukov
2016-12-12 10:45 ` Dmitry Vyukov
2016-12-14 19:46 ` Dmitry Vyukov
2016-12-14 19:48 ` Dmitry Vyukov
2017-01-04 4:52 ` alexander.levin
2016-12-27 17:23 ` alexander.levin
2016-12-28 7:32 ` Dmitry Vyukov
2016-11-21 15:41 ` Steven Rostedt
2016-11-23 15:03 ` alexander.levin
2016-11-23 15:31 ` Steven Rostedt
2016-11-23 15:33 ` Steven Rostedt
2016-11-16 17:37 ` [RFC 2/3] abi_spec: hooks into syscall to allow pre and post checking alexander.levin
2016-11-21 15:54 ` Steven Rostedt [this message]
2016-11-21 15:57 ` Dmitry Vyukov
2016-11-23 15:04 ` alexander.levin
2016-11-16 17:37 ` [RFC 3/3] abi_spec: example spec for open(), placeholder for rest of syscalls alexander.levin
2016-11-16 17:46 ` [RFC 0/3] ABI spec - verification Thomas Gleixner
2016-11-21 14:25 ` Dmitry Vyukov
2016-11-23 14:36 ` alexander.levin
2016-12-12 10:12 ` Dmitry Vyukov
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=20161121105443.249ddff8@gandalf.local.home \
--to=rostedt@goodmis.org \
--cc=alexander.levin@verizon.com \
--cc=andreyknvl@google.com \
--cc=arnd@arndb.de \
--cc=daniel.vetter@ffwll.ch \
--cc=dvyukov@google.com \
--cc=glider@google.com \
--cc=linux-kernel@vger.kernel.org \
--cc=mathieu.desnoyers@efficios.com \
--cc=scientist@fb.com \
--cc=tglx@linutronix.de \
/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