lkml.org 
[lkml]   [2018]   [Sep]   [28]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
Patch in this message
/
From
Subject[PATCH 1/3] seccomp: change return type of seccomp_get_metadata to int
Date
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
\
 
 \ /
  Last update: 2018-09-28 17:47    [W:0.060 / U:1.064 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site