From: Sasha Levin <sasha.levin@oracle.com>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Andrey Ryabinin <ryabinin.a.a@gmail.com>,
mingo <mingo@kernel.org>,
Andrew Morton <akpm@linux-foundation.org>,
LKML <linux-kernel@vger.kernel.org>
Subject: Re: [RFC 2/2] kvm: eventfd: detect integer overflow using check_*_overflow
Date: Wed, 26 Nov 2014 14:27:44 -0500 [thread overview]
Message-ID: <547629B0.9020406@oracle.com> (raw)
In-Reply-To: <CA+55aFwCUyy3gF9M7JXuyRGgOzELVbPAe0T_7giqufgGCn3XKg@mail.gmail.com>
On 11/26/2014 02:12 PM, Linus Torvalds wrote:
>> kernel/time/ntp.c:process_adjtimex_modes():
>> >
>> > if (txc->modes & ADJ_FREQUENCY) {
>> > time_freq = txc->freq * PPM_SCALE; <=== Undefined overflow
>> > time_freq = min(time_freq, MAXFREQ_SCALED);
>> > time_freq = max(time_freq, -MAXFREQ_SCALED);
>> > /* update pps_freq */
>> > pps_set_freq(time_freq);
>> > }
>> >
>> > The multiplication is between signed integers, and it overflows (user triggerable).
> Well, we check that the end result - overflowed or not - is in a sane
> range. So this might fall under the heading of "user gets what he asks
> for".
I guess, though it wouldn't be clear to the user why it's broken since he passed a
seemingly valid looking value for txc->freq.
Thanks,
Sasha
next prev parent reply other threads:[~2014-11-26 19:27 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2014-11-26 14:00 [RFC 1/2] compiler: use compiler to detect integer overflows Sasha Levin
2014-11-26 14:00 ` [RFC 2/2] kvm: eventfd: detect integer overflow using check_*_overflow Sasha Levin
2014-11-26 17:50 ` Andrey Ryabinin
2014-11-26 17:55 ` Sasha Levin
2014-11-26 18:23 ` Linus Torvalds
2014-11-26 19:06 ` Sasha Levin
2014-11-26 19:12 ` Linus Torvalds
2014-11-26 19:27 ` Sasha Levin [this message]
2014-11-26 17:48 ` [RFC 1/2] compiler: use compiler to detect integer overflows Andrey Ryabinin
[not found] ` <CA+55aFzyDC=o_Beg+8hjW8+TQXYWCgQo_yfjgHsTz0LRTiomWA@mail.gmail.com>
2014-11-26 18:50 ` Sasha Levin
2014-11-26 18:58 ` Linus Torvalds
2014-11-27 20:42 ` Dan Carpenter
2014-12-05 9:54 ` Dan Carpenter
2014-12-05 18:50 ` Linus Torvalds
2014-12-05 19:39 ` Dan Carpenter
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=547629B0.9020406@oracle.com \
--to=sasha.levin@oracle.com \
--cc=akpm@linux-foundation.org \
--cc=linux-kernel@vger.kernel.org \
--cc=mingo@kernel.org \
--cc=ryabinin.a.a@gmail.com \
--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