From: Peter Zijlstra <peterz@infradead.org>
To: Thomas Gleixner <tglx@linutronix.de>
Cc: mingo@kernel.org, kjlu@umn.edu, hpa@zytor.com,
stable@vger.kernel.org, torvalds@linux-foundation.org,
linux-kernel@vger.kernel.org, linux-tip-commits@vger.kernel.org
Subject: Re: [tip:sched/core] sched/core: Fix a potential double-fetch bug in sched_copy_attr()
Date: Mon, 28 Jan 2019 08:58:17 +0100 [thread overview]
Message-ID: <20190128075817.GE4500@hirez.programming.kicks-ass.net> (raw)
In-Reply-To: <alpine.DEB.2.21.1901271201170.1622@nanos.tec.linutronix.de>
On Sun, Jan 27, 2019 at 12:04:44PM +0100, Thomas Gleixner wrote:
> On Mon, 21 Jan 2019, tip-bot for Kangjie Lu wrote:
> > 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;
> > +
>
> Just when pondering to send that to Linus, I tried to write up a concise
> summary for this which made me look at the patch.
>
> If the size changed, then its clear that user space fiddled with the date
> between the size fetch and the full copy from user. So why restoring the
> size instead of doing the obvious:
>
> if (attr->size != size)
> return -ECRAP;
>
> Hmm?
Sure; but if we do that we should also change perf_copy_attr() which has
the exact same thing.
next prev parent reply other threads:[~2019-01-28 7:58 UTC|newest]
Thread overview: 9+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-12-25 22:16 [PATCH] sched: fix a potential double-fetch bug in sched_copy_attr Kangjie Lu
2019-01-07 17:11 ` Peter Zijlstra
2019-01-09 7:45 ` [PATCH v2] " Kangjie Lu
2019-01-21 11:32 ` [tip:sched/core] sched/core: Fix a potential double-fetch bug in sched_copy_attr() tip-bot for Kangjie Lu
2019-01-27 11:04 ` Thomas Gleixner
2019-01-27 11:28 ` Ingo Molnar
2019-01-28 7:58 ` Peter Zijlstra [this message]
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=20190128075817.GE4500@hirez.programming.kicks-ass.net \
--to=peterz@infradead.org \
--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=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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.