From: tip-bot for Kangjie Lu <tipbot@zytor.com>
To: linux-tip-commits@vger.kernel.org
Cc: linux-kernel@vger.kernel.org, peterz@infradead.org,
torvalds@linux-foundation.org, tglx@linutronix.de, hpa@zytor.com,
stable@vger.kernel.org, mingo@kernel.org, kjlu@umn.edu
Subject: [tip:sched/core] sched/core: Fix a potential double-fetch bug in sched_copy_attr()
Date: Mon, 21 Jan 2019 03:32:36 -0800 [thread overview]
Message-ID: <tip-120e4e76857ddbc9268e1aa3f9de61a498e84618@git.kernel.org> (raw)
In-Reply-To: <20190109074524.10176-1-kjlu@umn.edu>
Commit-ID: 120e4e76857ddbc9268e1aa3f9de61a498e84618
Gitweb: https://git.kernel.org/tip/120e4e76857ddbc9268e1aa3f9de61a498e84618
Author: Kangjie Lu <kjlu@umn.edu>
AuthorDate: Wed, 9 Jan 2019 01:45:24 -0600
Committer: Ingo Molnar <mingo@kernel.org>
CommitDate: Mon, 21 Jan 2019 11:26:17 +0100
sched/core: Fix a potential double-fetch bug in sched_copy_attr()
"uattr->size" is copied in from user space and checked. However, it is
copied in again after the security check. A malicious user may race to
change it. The fix sets uattr->size to be the checked size.
Signed-off-by: Kangjie Lu <kjlu@umn.edu>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: pakki001@umn.edu
Cc: <stable@vger.kernel.org>
Link: https://lkml.kernel.org/r/20190109074524.10176-1-kjlu@umn.edu
Signed-off-by: Ingo Molnar <mingo@kernel.org>
---
kernel/sched/core.c | 3 +++
1 file changed, 3 insertions(+)
diff --git a/kernel/sched/core.c b/kernel/sched/core.c
index a674c7db2f29..d4d3514c4fe9 100644
--- a/kernel/sched/core.c
+++ b/kernel/sched/core.c
@@ -4499,6 +4499,9 @@ static int sched_copy_attr(struct sched_attr __user *uattr, struct sched_attr *a
if (ret)
return -EFAULT;
+ /* In case attr->size was changed by user-space: */
+ attr->size = size;
+
/*
* XXX: Do we want to be lenient like existing syscalls; or do we want
* to be strict and return an error on out-of-bounds values?
next parent reply other threads:[~2019-01-21 11:32 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
[not found] <20190109074524.10176-1-kjlu@umn.edu>
2019-01-21 11:32 ` tip-bot for Kangjie Lu [this message]
2019-01-27 11:04 ` [tip:sched/core] sched/core: Fix a potential double-fetch bug in sched_copy_attr() Thomas Gleixner
2019-01-27 11:28 ` Ingo Molnar
2019-01-28 7:58 ` Peter Zijlstra
2019-01-28 13:15 ` Thomas Gleixner
2019-03-10 10:09 ` Thomas Gleixner
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=tip-120e4e76857ddbc9268e1aa3f9de61a498e84618@git.kernel.org \
--to=tipbot@zytor.com \
--cc=hpa@zytor.com \
--cc=kjlu@umn.edu \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-tip-commits@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=peterz@infradead.org \
--cc=stable@vger.kernel.org \
--cc=tglx@linutronix.de \
--cc=torvalds@linux-foundation.org \
/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;
as well as URLs for NNTP newsgroup(s).