From: Thomas Gleixner <tglx@linutronix.de>
To: Sasha Levin <sasha.levin@oracle.com>
Cc: john.stultz@linaro.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] time: verify time values in adjtimex ADJ_SETOFFSET to avoid overflow
Date: Sun, 6 Dec 2015 10:07:01 +0100 (CET) [thread overview]
Message-ID: <alpine.DEB.2.11.1512061006210.3595@nanos> (raw)
In-Reply-To: <56637E2D.1040603@oracle.com>
On Sat, 5 Dec 2015, Sasha Levin wrote:
> On 12/05/2015 12:10 PM, Thomas Gleixner wrote:
> > On Thu, 3 Dec 2015, Sasha Levin wrote:
> >
> >> Make sure the tv_usec makes sense. We might multiply them later which can
> >> cause an overflow and undefined behavior.
> >>
> >> Signed-off-by: Sasha Levin <sasha.levin@oracle.com>
> >> ---
> >> kernel/time/timekeeping.c | 4 ++++
> >> 1 file changed, 4 insertions(+)
> >>
> >> diff --git a/kernel/time/timekeeping.c b/kernel/time/timekeeping.c
> >> index d563c19..aa3c1c2 100644
> >> --- a/kernel/time/timekeeping.c
> >> +++ b/kernel/time/timekeeping.c
> >> @@ -1987,6 +1987,10 @@ int do_adjtimex(struct timex *txc)
> >>
> >> if (txc->modes & ADJ_SETOFFSET) {
> >> struct timespec delta;
> >> +
> >> + if (txc->time.tv_usec >= USEC_PER_SEC || txc->time.tv_usec <= -USEC_PER_SEC)
> >> + return -EINVAL;
> >
> > That's not a canonical timeval. timeval_valid() is what you want to
> > check it. Or has adjtimex some magic exception here?
>
> Nope, it looks like timeval_valid() is indeed what I've needed to use.
>
> Is there a reason ntp_validate_timex() doesn't do timeval_valid() too
> for at least the ADJ_SETOFFSET case? If not, I'll add it in.
Not that I know, but John might have some opinion on that.
Thanks,
tglx
next prev parent reply other threads:[~2015-12-06 9:07 UTC|newest]
Thread overview: 13+ messages / expand[flat|nested] mbox.gz Atom feed top
2015-12-04 3:09 Sasha Levin
2015-12-04 20:27 ` John Stultz
2015-12-05 17:10 ` Thomas Gleixner
2015-12-06 0:15 ` Sasha Levin
2015-12-06 9:07 ` Thomas Gleixner [this message]
2015-12-06 22:11 ` Richard Cochran
2015-12-07 19:54 ` John Stultz
2015-12-07 20:11 ` [RFC][PATCH -reworked] time: Verify " John Stultz
2015-12-07 20:13 ` John Stultz
2015-12-07 20:16 ` Thomas Gleixner
2015-12-07 20:15 ` [PATCH] time: verify " Thomas Gleixner
2015-12-07 20:19 ` John Stultz
2015-12-07 20:23 ` John Stultz
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=alpine.DEB.2.11.1512061006210.3595@nanos \
--to=tglx@linutronix.de \
--cc=john.stultz@linaro.org \
--cc=linux-kernel@vger.kernel.org \
--cc=sasha.levin@oracle.com \
/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
all inboxes | Powered by JetHome®