[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20150721072608.GA16176@gmail.com>
Date: Tue, 21 Jul 2015 09:26:09 +0200
From: Ingo Molnar <mingo@...nel.org>
To: Rasmus Villemoes <linux@...musvillemoes.dk>
Cc: Sasha Levin <sasha.levin@...cle.com>, akpm@...ux-foundation.org,
linux-kernel@...r.kernel.org,
Peter Zijlstra <a.p.zijlstra@...llo.nl>,
Thomas Gleixner <tglx@...utronix.de>
Subject: Re: [RFC 1/3] compiler.h: enable builtin overflow checkers and add
fallback code
Linus Cc:-ed so he can chime in if he wants to.
Thanks,
Ingo
* Rasmus Villemoes <linux@...musvillemoes.dk> wrote:
> On Mon, Jul 20 2015, Sasha Levin <sasha.levin@...cle.com> wrote:
>
> > On 07/19/2015 07:17 PM, Rasmus Villemoes wrote:
> >> Last year, Sasha Levin suggested adding wrappers for the
> >> __builtin_*_overflow functions introduced with gcc 5.1 (based on
> >> similar, but type-specific, functions in clang). This is another
> >> attempt at providing such wrappers and fallback code for older compilers.
> >
> > What's the difference between this version and the one Linus essentially
> > rejected?
>
> Assuming you're referring to
> http://thread.gmane.org/gmane.linux.kernel/1838832 (the latest I could
> find, and the one Linus "[didn't] like"):
>
> I've tried to ensure that the fallback code has the same semantics as
> the gcc builtins [1] (in particular, to handle all kinds of overflow) -
> I think it would be rather dangerous if the types of overflow detected
> depended on the gcc version.
>
> The fallback code in the version referred to above had a number of
> problems:
>
> * relies on UB for signed types
>
> * both false positives and false negatives (because it more or less
> implicitly assumed that all values are positive)
>
> * even for unsigned types, plain a+b<a is broken for types narrower than
> int
>
> It's also inconvenient for the user to have to pass the appropriate
> type_max value to the mul_overflow checker.
>
> Rasmus
>
> [1] though with the extra requirement of all three arguments having the
> same type.
--
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