diff options
author | James Morris | 2018-02-22 10:50:24 -0800 |
---|---|---|
committer | James Morris | 2018-02-22 10:50:24 -0800 |
commit | 645ae5c51e85d7dbb25177866d5016a89d5243ad (patch) | |
tree | a4d638616c5db0bde980c6bf5b494f70b6bbef0c /kernel | |
parent | af3e79d29555b97dd096e2f8e36a0f50213808a8 (diff) | |
parent | d057dc4e35e16050befa3dda943876dab39cbf80 (diff) |
Merge tag 'seccomp-v4.16-rc3' of https://git.kernel.org/pub/scm/linux/kernel/git/kees/linux into fixes-v4.16-rc3
- Fix seccomp GET_METADATA to deal with field sizes correctly (Tycho Andersen)
- Add selftest to make sure GET_METADATA doesn't regress (Tycho Andersen)
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/seccomp.c | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/kernel/seccomp.c b/kernel/seccomp.c index 940fa408a288..dc77548167ef 100644 --- a/kernel/seccomp.c +++ b/kernel/seccomp.c @@ -1076,14 +1076,16 @@ long seccomp_get_metadata(struct task_struct *task, size = min_t(unsigned long, size, sizeof(kmd)); - if (copy_from_user(&kmd, data, size)) + if (size < sizeof(kmd.filter_off)) + return -EINVAL; + + if (copy_from_user(&kmd.filter_off, data, sizeof(kmd.filter_off))) return -EFAULT; filter = get_nth_filter(task, kmd.filter_off); if (IS_ERR(filter)) return PTR_ERR(filter); - memset(&kmd, 0, sizeof(kmd)); if (filter->log) kmd.flags |= SECCOMP_FILTER_FLAG_LOG; |