[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+55aFwCUyy3gF9M7JXuyRGgOzELVbPAe0T_7giqufgGCn3XKg@mail.gmail.com>
Date: Wed, 26 Nov 2014 11:12:26 -0800
From: Linus Torvalds <torvalds@...ux-foundation.org>
To: Sasha Levin <sasha.levin@...cle.com>
Cc: Andrey Ryabinin <ryabinin.a.a@...il.com>, mingo <mingo@...nel.org>,
Andrew Morton <akpm@...ux-foundation.org>,
LKML <linux-kernel@...r.kernel.org>
Subject: Re: [RFC 2/2] kvm: eventfd: detect integer overflow using check_*_overflow
On Wed, Nov 26, 2014 at 11:06 AM, Sasha Levin <sasha.levin@...cle.com> wrote:
>
> I'm pretty sure that this is something GCC will warn you about in the
> compilation stage.
It does? I've never seen it, but maybe it's a new thing.
The gcc signedness warnings have historically been so wretched that
it's just sad, and they have to be turned off.
> 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".
Linus
--
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