[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CALAqxLUCNCa1kzus_0BVYQgcu+zauF_H50xb4a+6TLs6S3Wa8Q@mail.gmail.com>
Date: Mon, 7 Dec 2015 12:23:59 -0800
From: John Stultz <john.stultz@...aro.org>
To: Thomas Gleixner <tglx@...utronix.de>
Cc: Richard Cochran <richardcochran@...il.com>,
Sasha Levin <sasha.levin@...cle.com>,
lkml <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] time: verify time values in adjtimex ADJ_SETOFFSET to
avoid overflow
On Mon, Dec 7, 2015 at 12:15 PM, Thomas Gleixner <tglx@...utronix.de> wrote:
> On Mon, 7 Dec 2015, John Stultz wrote:
>
>> On Sun, Dec 6, 2015 at 2:11 PM, Richard Cochran
>> <richardcochran@...il.com> wrote:
>> > The overflow is a latent problem, and the patch should:
>> >
>> > 1. return error in case (txc->time.tv_usec >= USEC_PER_SEC)
>> > 2. remove the redundant test in timekeeping_inject_offset.
>>
>> So we probably want to keep the check in timekeeping_inject_offset()
>> since there can be other users as well of that function.
>>
>> But its probably cleanest to add a check in ntp_validate_timex()
>> instead of where this patch does it.
>
> So instead of open coding the checks on both sites, can we please have
> an inline function with proper comments why time.tv_sec can be
> negative, something like adjtimex_timeval_is_valid() or such.
Right. So the only gotcha with this is that adjtimex wants to check
that the timeval is valid (before we convert it to a timespec), but
timekeeping_inject_offset wants to make sure the timespec is valid. So
one nice inline function won't cut it.
But I can add a timespec_inject_offset_valid() and
timeval_inject_offset_valid() which will do the same basic check for
each type.
thanks
-john
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists