Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp994892imw; Thu, 14 Jul 2022 15:05:29 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vFc+/NYPAj7y1c4eerX8TcsipJgvfwBcdrpCqoPYFznrgMxXjMU8Bgy+0wubsHNszG4FZe X-Received: by 2002:a17:907:c14:b0:72b:6762:de34 with SMTP id ga20-20020a1709070c1400b0072b6762de34mr10649881ejc.94.1657836329508; Thu, 14 Jul 2022 15:05:29 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657836329; cv=none; d=google.com; s=arc-20160816; b=JaPz1Fj4qbpIx0t/YpNiEkxYTbD1UncfL9Z9p+wQJkBHLhqFqzGbdcG8pVUayHVcGq Ue6VrgRvsVbqgw7WcBGxTGC8VDlw0dy+I2e14w73gtiqhDqP1EYU3bPuQFh0W2/WVQON L457Fs1xQ4CyPN6I+imm+C/3gXgjWhA3z7a/kVngKLAwc6HHtHrtGqQu0dwTWyAJGUEx cygOfAC27A6B7dBp/Scmg6Gb5hySPrk8LcWj2Qmg6LuipsSPbMOHDgF0OoB5ktTpJ0Cx 4m4iN0ghX/Am7Cwug3eir5m1+fUX14MvuWTfEolW6uRWgcfIGQ16sVVRpAfT02+poGbu wShA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=L1iX27wFeV0T/X/fBHF2BNfaWRJqrDGUQT8DlTbAlDg=; b=k6qflzLklNBZU9bMlXymAgwq1+wNCnyD30EVR8df1jDlGD25Z81mv66329k47pccIE 2F8yJl68SroIPHtQ020pYKv/y6q3JqLSCbaPXp0qv0Ohb6ypntm8CGradW9GD8Nds2s0 TBtb594D4lY0pUR3osdur6LC/EMARcY6NLBbORAEdexh0szr2augCF8yAiJgJEbn80v5 sRTOZjp6SXKe5XpSByqZothrfwMqNxlsgozX4PPewxUBGy3BhYGJHOBv5qif6oAmDy3s FV/aOowpIzH+pRv/DnHnweLRU9AuYJf7gpxoeKFuQiqx7MC288OErlXxKRcTrRpo3Vc2 iwmg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=FWC7HCmy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bc25-20020a056402205900b0043a3f424e00si1683561edb.390.2022.07.14.15.05.04; Thu, 14 Jul 2022 15:05:29 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=FWC7HCmy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S234545AbiGNVtA (ORCPT + 99 others); Thu, 14 Jul 2022 17:49:00 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:45798 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231793AbiGNVs6 (ORCPT ); Thu, 14 Jul 2022 17:48:58 -0400 Received: from mail-ej1-x62f.google.com (mail-ej1-x62f.google.com [IPv6:2a00:1450:4864:20::62f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 8CD4132EC1 for ; Thu, 14 Jul 2022 14:48:56 -0700 (PDT) Received: by mail-ej1-x62f.google.com with SMTP id bp15so5775488ejb.6 for ; Thu, 14 Jul 2022 14:48:56 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linux-foundation.org; s=google; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=L1iX27wFeV0T/X/fBHF2BNfaWRJqrDGUQT8DlTbAlDg=; b=FWC7HCmyZVead3f2O3DASZjsf1DvWU3lo55I8StLcNFNInBWNn7wtRAGdMMZc7vrOy 4gtk6E+oaR9L65XjWqwLxsWfinSbNh3ow9dXD48q+t8QtaY3AmdJvPCbjHSn25eVEFJh CND1MbO0rSFNpPNls/b2Mfc4joBGdSTOm5a5g= 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=L1iX27wFeV0T/X/fBHF2BNfaWRJqrDGUQT8DlTbAlDg=; b=cUEMDu2vwkoz5g/K6lQrKYuMiSDr1oHrIICT0YzpAsdRIDPuRFBYqSqiHEg9+ta/Ik UJTcml2I2cxN87NIMuGUPeRcEGFYHSprjNaBgjrQwmH9USlR2cCzdm6mgBAKd6kIBWrx 6gXGDYsrG+xMj58kGrliiMIDsGDAWVNVsI/JcnGnYLDDKTfDoaO6zw14DCcezD9ftBGl x+d7li+VQjHXLbI4ATisNDDHdisC+GwIXl3OSzsHKQbrZhJ2BdmJFHctsVDf/b/IJ1Qj AlpcexxySk9TfzHbfs9F/6TTqdkO1p/tay3OX/sPg/fod8TBIVoGXuty1s9c6z4HwJUV SVzg== X-Gm-Message-State: AJIora91DSLhDi3hzRIVSdxnEADQZWr1+dg8+mBAavscS3Yp+AQcJKpU 8eI8HOqJKV0I9bwZgkYSUDQ/FEW5E/i1aUjeZhg= X-Received: by 2002:a17:907:a055:b0:72b:16dd:d485 with SMTP id gz21-20020a170907a05500b0072b16ddd485mr10643567ejc.435.1657835334855; Thu, 14 Jul 2022 14:48:54 -0700 (PDT) Received: from mail-wr1-f42.google.com (mail-wr1-f42.google.com. [209.85.221.42]) by smtp.gmail.com with ESMTPSA id n24-20020a170906119800b0072b8fbc9be1sm1157793eja.187.2022.07.14.14.48.53 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Jul 2022 14:48:54 -0700 (PDT) Received: by mail-wr1-f42.google.com with SMTP id r10so4302566wrv.4 for ; Thu, 14 Jul 2022 14:48:53 -0700 (PDT) X-Received: by 2002:a05:6000:180f:b0:21d:68f8:c4ac with SMTP id m15-20020a056000180f00b0021d68f8c4acmr10262406wrh.193.1657835333499; Thu, 14 Jul 2022 14:48:53 -0700 (PDT) MIME-Version: 1.0 References: <20220714205646.4023495-1-ndesaulniers@google.com> In-Reply-To: From: Linus Torvalds Date: Thu, 14 Jul 2022 14:48:37 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: [PATCH] ubsan: disable UBSAN_DIV_ZERO for clang To: Nick Desaulniers Cc: Kees Cook , Sudip Mukherjee , Nathan Chancellor , Tom Rix , Marco Elver , Andrew Morton , Josh Poimboeuf , "Peter Zijlstra (Intel)" , Linux Kernel Mailing List , clang-built-linux , Alexander Potapenko Content-Type: text/plain; charset="UTF-8" X-Spam-Status: No, score=-1.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS, RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE autolearn=no autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Jul 14, 2022 at 2:38 PM Nick Desaulniers wrote: > > int do_div (int dividend, int divisor) { > return dividend / divisor; > } > > has UB should divisor ever be zero, not much different from: So? What about the million other '/' in the kernel? Adding one check to 'do_div()' is just stupid. It's like using a bottle-cap as an umbrella. Nick, that's the whole _point_ of having compiler support for things like this - automation. Because doing them manually one at a time is just completely broken and stupid. Linus