From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.3 required=3.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, MAILING_LIST_MULTI,MENTIONS_GIT_HOSTING,SPF_HELO_NONE,SPF_PASS, USER_IN_DEF_DKIM_WL autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 557A5C433FE for ; Fri, 10 Sep 2021 22:35:15 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 42B1C61205 for ; Fri, 10 Sep 2021 22:35:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231922AbhIJWgZ (ORCPT ); Fri, 10 Sep 2021 18:36:25 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54122 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230210AbhIJWgX (ORCPT ); Fri, 10 Sep 2021 18:36:23 -0400 Received: from mail-lf1-x12d.google.com (mail-lf1-x12d.google.com [IPv6:2a00:1450:4864:20::12d]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 49578C061756 for ; Fri, 10 Sep 2021 15:35:11 -0700 (PDT) Received: by mail-lf1-x12d.google.com with SMTP id k4so7021645lfj.7 for ; Fri, 10 Sep 2021 15:35:11 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=DWQGZrSo/Do81bAjpKTAeUBjh1IoG/kzcaTcruy7fk4=; b=saxjUAPFfGK5B7x+nTYAT8yzhPqGdjMcWQvcVRiW147le2Hcl7k+yEuEEnfNw/9TyA Y3vf1VNph4TncTlTx1IMM/x9uNvAzX3wbgQIHTeOsQXQnzlQQTTX15AxY3FnsB67Ggf3 hPEOE5t3ZyCWbbXJnDY0pU3XBxYNqcfTk8P8wQI/yV8Ql4708KRfCApaMROmhVXXUmvC 6vNrZTJjoCkt63PL5L1xSjXhzoB5MVuuQs4fqVCzbWHDR093c6Jv9i8aadzA57XFVCCR rL8F5phsIJ8TYBNg3M5uNOWc58OpDrhiOJ2paxP3MNbYc5BrOb92wi//AKbIbJOfwyfK U1ow== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=DWQGZrSo/Do81bAjpKTAeUBjh1IoG/kzcaTcruy7fk4=; b=RmM7IgSo/bzupjbn/h6aFAAoI/3bIas5IvR+614x25fLtt+fKYJvrMGwgdC9BPOPsP uE4t29HygrmLtlgxET3kWAnE/svOc21K8x2y4nGMinTU3ufNA0zoxIB9ONYv6uUYT+Jy Aa2X/Yqaf7gkZWBPRZPLImXutH5+uji19JiIgQTlA/ZXlhSTA5VryN0ypyjR2vcFm5kS PBFpwO/3XbiwBYB06yq/5wxCe5BstYFYJagHHQVBWzv3PYusmXLKZm8WfGjF3YFHG7C4 gqFIBt/3y3hayu+Ql3FKxyhXux1LcFjkS8XuiMSDkXZzMPCBwYHuvdss3EPO656BxFp4 ITNw== X-Gm-Message-State: AOAM5315kC6O++tNdSNKhg410rRNufHC7UzMuHvtTr6XmHV61HyJd78m qiWy1hC2HWGiWNhjj6kNHZNZUO7iYathGmosXqWLeg== X-Google-Smtp-Source: ABdhPJw541SsRoH3llrdeNz3D2AuhbrsNp86DUKg8d4moYQ1Lm0on5D/RGg9t2gjrSVV/TE6HoXob88bUDTMzYSAKfk= X-Received: by 2002:ac2:4c46:: with SMTP id o6mr5569552lfk.240.1631313309434; Fri, 10 Sep 2021 15:35:09 -0700 (PDT) MIME-Version: 1.0 References: <20210909182525.372ee687@canb.auug.org.au> <20210909225035.3990728-1-ndesaulniers@google.com> In-Reply-To: From: Nick Desaulniers Date: Fri, 10 Sep 2021 15:34:58 -0700 Message-ID: Subject: Re: linux-next: build failure while building Linus' tree To: Rasmus Villemoes Cc: axboe@kernel.dk, josef@toxicpanda.com, libaokun1@huawei.com, linux-kernel@vger.kernel.org, linux-next@vger.kernel.org, llvm@lists.linux.dev, Arnd Bergmann , Nathan Chancellor , sfr@canb.auug.org.au Content-Type: text/plain; charset="UTF-8" Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Fri, Sep 10, 2021 at 3:26 PM Nick Desaulniers wrote: > > On Fri, Sep 10, 2021 at 3:17 PM Nick Desaulniers > wrote: > > > > On Fri, Sep 10, 2021 at 3:02 PM Nick Desaulniers > > wrote: > > > > > > On Thu, Sep 9, 2021 at 3:50 PM Nick Desaulniers 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. Ah, I just saw your comment now about raising the minimum required version of gcc to 5.1. https://github.com/ClangBuiltLinux/linux/issues/1438#issuecomment-916745801 > > > 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. In that case, I do have __mulodi4() rewritten from compiler-rt to be usable in the kernel. -- Thanks, ~Nick Desaulniers