lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAKwvOdnDOQPRe3v7ZD6SRR=TgbLqo1wfn_zmgfJpbqGEZyJ1-Q@mail.gmail.com>
Date:   Fri, 10 Sep 2021 15:26:09 -0700
From:   Nick Desaulniers <ndesaulniers@...gle.com>
To:     Rasmus Villemoes <linux@...musvillemoes.dk>
Cc:     axboe@...nel.dk, josef@...icpanda.com, libaokun1@...wei.com,
        linux-kernel@...r.kernel.org, linux-next@...r.kernel.org,
        llvm@...ts.linux.dev, Arnd Bergmann <arnd@...nel.org>,
        Nathan Chancellor <nathan@...nel.org>, sfr@...b.auug.org.au
Subject: Re: linux-next: build failure while building Linus' tree

On Fri, Sep 10, 2021 at 3:17 PM Nick Desaulniers
<ndesaulniers@...gle.com> wrote:
>
> On Fri, Sep 10, 2021 at 3:02 PM Nick Desaulniers
> <ndesaulniers@...gle.com> wrote:
> >
> > On Thu, Sep 9, 2021 at 3:50 PM Nick Desaulniers <ndesaulniers@...gle.com> wrote:
> > >
> > > + Rasmus
> > >
> > > This was introduced in
> > > commit f0907827a8a91 ("compiler.h: enable builtin overflow checkers and add
> > > fallback code")
> > > which added division using the `/` operator, which is problematic when checking
> > > for overflows of 64b operands on 32b targets.
> > >
> > > We'll probably need helpers from linux/math64.h and some combination of
> > > __builtin_choose_expr/__builtin_types_compatible_p.
> > >
> > > That will help us fix another compiler bug for older clang releases, too.
> > > https://github.com/ClangBuiltLinux/linux/issues/1438.
> >
> > Ok, I have something hacked up that I think will work:
> > https://gist.github.com/nickdesaulniers/2479818f4983bbf2d688cebbab435863
>
> hmm...playing around with adding some static asserts to the above, I

ah! static_assert can't be used for the type agnostic macros,
BUILD_BUG_ON needs to be used in its place. Ok, let me add a few and
see if that can help instill some confidence here.

> don't think it's quite right, specifically:
> #define div_64(dividend, divisor) ({            \
>   typeof(dividend) z;
>
> might declare z with the expected sign, but not necessarily the
> correct width when the dividend is 32b but the divisor is 64b.  Feels
> a bit like trying to encode the C type promotion rules in a macro...
>
> > This incomplete diff is a little hacked up to reproduce the issue with
> > a known-bad revision of clang that demonstrates a similar issue to GCC
> > 4.9.  You can ignore the movement of check_mul_overflow and friends in
> > include/linux/overflow.h.
> >
> > I think I'm going to break that up into 2 or 3 patches:
> > 1. move is_signed_type from include/linux/overflow.h to perhaps
> > include/linux/typecheck.h.
> > 2. add div64_x64, div_x64, and div_64 to include/linux/math64.h, use
> > them in include/linux/overflow.h to fix GCC 4.9
> > 3. move multiply fallbacks out of
> > COMPILER_HAS_GENERIC_BUILTIN_OVERFLOW for clang < 14.
> > --
> > Thanks,
> > ~Nick Desaulniers
>
>
>
> --
> Thanks,
> ~Nick Desaulniers



-- 
Thanks,
~Nick Desaulniers

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ