From: Tycho Andersen <tycho@tycho.ws>
To: Kees Cook <keescook@chromium.org>
Cc: linux-kernel@vger.kernel.org, Jann Horn <jannh@google.com>,
Tycho Andersen <tycho@tycho.ws>,
Andy Lutomirski <luto@amacapital.net>
Subject: [PATCH 1/3] seccomp: change return type of seccomp_get_metadata to int
Date: Fri, 28 Sep 2018 09:46:46 -0600 [thread overview]
Message-ID: <20180928154648.6320-1-tycho@tycho.ws> (raw)
As Jann pointed out in another thread, ptrace_requiest() returns an int, so
it makes sense for seccomp_get_metdata() to return an int as well. The
return type of seccomp_get_metadata() is bounded by sizeof(kmd), so this
conversion is safe.
Signed-off-by: Tycho Andersen <tycho@tycho.ws>
Reported-by: Jann Horn <jannh@google.com>
CC: Kees Cook <keescook@chromium.org>
CC: Andy Lutomirski <luto@amacapital.net>
---
include/linux/seccomp.h | 10 +++++-----
kernel/seccomp.c | 6 +++---
2 files changed, 8 insertions(+), 8 deletions(-)
diff --git a/include/linux/seccomp.h b/include/linux/seccomp.h
index e5320f6c8654..af972549a7b4 100644
--- a/include/linux/seccomp.h
+++ b/include/linux/seccomp.h
@@ -96,17 +96,17 @@ static inline void get_seccomp_filter(struct task_struct *tsk)
#if defined(CONFIG_SECCOMP_FILTER) && defined(CONFIG_CHECKPOINT_RESTORE)
extern long seccomp_get_filter(struct task_struct *task,
unsigned long filter_off, void __user *data);
-extern long seccomp_get_metadata(struct task_struct *task,
- unsigned long filter_off, void __user *data);
+extern int seccomp_get_metadata(struct task_struct *task,
+ unsigned long filter_off, void __user *data);
#else
static inline long seccomp_get_filter(struct task_struct *task,
unsigned long n, void __user *data)
{
return -EINVAL;
}
-static inline long seccomp_get_metadata(struct task_struct *task,
- unsigned long filter_off,
- void __user *data)
+static inline int seccomp_get_metadata(struct task_struct *task,
+ unsigned long filter_off,
+ void __user *data)
{
return -EINVAL;
}
diff --git a/kernel/seccomp.c b/kernel/seccomp.c
index fd023ac24e10..9f3721849747 100644
--- a/kernel/seccomp.c
+++ b/kernel/seccomp.c
@@ -1068,10 +1068,10 @@ long seccomp_get_filter(struct task_struct *task, unsigned long filter_off,
return ret;
}
-long seccomp_get_metadata(struct task_struct *task,
- unsigned long size, void __user *data)
+int seccomp_get_metadata(struct task_struct *task,
+ unsigned long size, void __user *data)
{
- long ret;
+ int ret;
struct seccomp_filter *filter;
struct seccomp_metadata kmd = {};
--
2.17.1
next reply other threads:[~2018-09-28 15:47 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-09-28 15:46 Tycho Andersen [this message]
2018-09-28 15:46 ` [PATCH 2/3] seccomp: change return type of seccomp_get_filter " Tycho Andersen
2018-09-28 15:46 ` [PATCH 3/3] seccomp: introduce read protection for struct seccomp Tycho Andersen
2018-09-28 20:33 ` Jann Horn
2018-09-28 20:56 ` Tycho Andersen
2018-09-28 21:10 ` Jann Horn
2018-09-28 21:35 ` Tycho Andersen
2018-09-28 21:54 ` Jann Horn
2018-09-28 22:02 ` Tycho Andersen
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=20180928154648.6320-1-tycho@tycho.ws \
--to=tycho@tycho.ws \
--cc=jannh@google.com \
--cc=keescook@chromium.org \
--cc=linux-kernel@vger.kernel.org \
--cc=luto@amacapital.net \
/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®