diff options
author | Vegard Nossum <vegard.nossum@oracle.com> | 2014-02-16 16:24:17 -0500 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2014-02-21 15:27:10 -0500 |
commit | 4efbc454ba68def5ef285b26ebfcfdb605b52755 (patch) | |
tree | 96fd992414451a19797a38476afed61b352d3d4f /kernel | |
parent | 3cf1962cdbf6b3a9e3ef21116d215bbab350ea37 (diff) |
sched: Fix information leak in sys_sched_getattr()
We're copying the on-stack structure to userspace, but forgot to give
the right number of bytes to copy. This allows the calling process to
obtain up to PAGE_SIZE bytes from the stack (and possibly adjacent
kernel memory).
This fix copies only as much as we actually have on the stack
(attr->size defaults to the size of the struct) and leaves the rest of
the userspace-provided buffer untouched.
Found using kmemcheck + trinity.
Fixes: d50dde5a10f30 ("sched: Add new scheduler syscalls to support an extended scheduling parameters ABI")
Cc: Dario Faggioli <raistlin@linux.it>
Cc: Juri Lelli <juri.lelli@gmail.com>
Cc: Ingo Molnar <mingo@kernel.org>
Signed-off-by: Vegard Nossum <vegard.nossum@oracle.com>
Signed-off-by: Peter Zijlstra <peterz@infradead.org>
Link: http://lkml.kernel.org/r/1392585857-10725-1-git-send-email-vegard.nossum@oracle.com
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'kernel')
-rw-r--r-- | kernel/sched/core.c | 2 |
1 files changed, 1 insertions, 1 deletions
diff --git a/kernel/sched/core.c b/kernel/sched/core.c index 33d030a133d2..a6e7470166c7 100644 --- a/kernel/sched/core.c +++ b/kernel/sched/core.c | |||
@@ -3786,7 +3786,7 @@ static int sched_read_attr(struct sched_attr __user *uattr, | |||
3786 | attr->size = usize; | 3786 | attr->size = usize; |
3787 | } | 3787 | } |
3788 | 3788 | ||
3789 | ret = copy_to_user(uattr, attr, usize); | 3789 | ret = copy_to_user(uattr, attr, attr->size); |
3790 | if (ret) | 3790 | if (ret) |
3791 | return -EFAULT; | 3791 | return -EFAULT; |
3792 | 3792 | ||