Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1284666
| From | Sasha Levin <sasha.levin@oracle.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH] time: verify time values in adjtimex ADJ_SETOFFSET to avoid overflow |
| Date | 2015-12-06 01:20 +0100 |
| Message-ID | <qCvdw-81R-5@gated-at.bofh.it> (permalink) |
| References | <qBP4C-5Gb-3@gated-at.bofh.it> <qCoF4-3UB-5@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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.
Thanks,
Sasha
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
[PATCH] time: verify time values in adjtimex ADJ_SETOFFSET to avoid overflow Sasha Levin <sasha.levin@oracle.com> - 2015-12-04 04:20 +0100
Re: [PATCH] time: verify time values in adjtimex ADJ_SETOFFSET to avoid overflow John Stultz <john.stultz@linaro.org> - 2015-12-04 21:30 +0100
Re: [PATCH] time: verify time values in adjtimex ADJ_SETOFFSET to avoid overflow Thomas Gleixner <tglx@linutronix.de> - 2015-12-05 18:20 +0100
Re: [PATCH] time: verify time values in adjtimex ADJ_SETOFFSET to avoid overflow Sasha Levin <sasha.levin@oracle.com> - 2015-12-06 01:20 +0100
Re: [PATCH] time: verify time values in adjtimex ADJ_SETOFFSET to avoid overflow Thomas Gleixner <tglx@linutronix.de> - 2015-12-06 10:10 +0100
Re: [PATCH] time: verify time values in adjtimex ADJ_SETOFFSET to avoid overflow Richard Cochran <richardcochran@gmail.com> - 2015-12-06 23:20 +0100
Re: [PATCH] time: verify time values in adjtimex ADJ_SETOFFSET to avoid overflow John Stultz <john.stultz@linaro.org> - 2015-12-07 21:00 +0100
Re: [RFC][PATCH -reworked] time: Verify time values in adjtimex ADJ_SETOFFSET to avoid overflow John Stultz <john.stultz@linaro.org> - 2015-12-07 21:20 +0100
Re: [RFC][PATCH -reworked] time: Verify time values in adjtimex ADJ_SETOFFSET to avoid overflow Thomas Gleixner <tglx@linutronix.de> - 2015-12-07 21:20 +0100
[RFC][PATCH -reworked] time: Verify time values in adjtimex ADJ_SETOFFSET to avoid overflow John Stultz <john.stultz@linaro.org> - 2015-12-07 21:20 +0100
Re: [PATCH] time: verify time values in adjtimex ADJ_SETOFFSET to avoid overflow Thomas Gleixner <tglx@linutronix.de> - 2015-12-07 21:20 +0100
Re: [PATCH] time: verify time values in adjtimex ADJ_SETOFFSET to avoid overflow John Stultz <john.stultz@linaro.org> - 2015-12-07 21:20 +0100
Re: [PATCH] time: verify time values in adjtimex ADJ_SETOFFSET to avoid overflow John Stultz <john.stultz@linaro.org> - 2015-12-07 21:30 +0100
csiph-web