Received: by 2002:ad5:4acb:0:0:0:0:0 with SMTP id n11csp968523imw; Thu, 14 Jul 2022 14:31:17 -0700 (PDT) X-Google-Smtp-Source: AGRyM1un5OIVA3ug9Y/ZpVR4MRlUYyZfYhSeo/GxCjPMk16m4BvISsyZPKJY9dLgSeXLDO5S34/k X-Received: by 2002:a05:6402:3807:b0:435:20fb:318d with SMTP id es7-20020a056402380700b0043520fb318dmr14440492edb.272.1657834276909; Thu, 14 Jul 2022 14:31:16 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1657834276; cv=none; d=google.com; s=arc-20160816; b=kClD30wQ1E1Vq3lI8q9VI7FwSndjz7y0eN7he9gAs5JvLBm3PnTNzwsaDrKF9Z30qe bt6OW5s2KS7fjbJjsv6RN9wR26RyZQIDyXiWtQFMkao6eGPtTKyBlZdwcrkMKYT04DcI X2x/qOlfK2bHEiZYaMw+utYDoRscZ7PSlRyJPvlmUIA8y8QkWRZV66euqu0XbiOQfXpA RhhcGAp+g+2NG0Im6eyZ5Rdbh3N+br2dyZjKRtMmGgnhGyuddJbq122nm4brV/ACAGtP HxLql3t+fW9SKfiBgJZIqgkWGt2qkBE7ues3L+KE1yXsqRBRkDb/w7H4/MZjaUfg7Yd3 6U+w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=3t3I9dkeOpZv3dAGJjzgDy35dMg8T+EkyLmF6AEUuHY=; b=Nr7xDFYebkU+LDtfuXPKQEYaQHaXSrJeODEbjC9m4TugZVEKMLdzqZvTfXRCrnR/QJ dnZ0kzUZ9c7BzRKOX/RH2bAzGrZEt2CFHsgV1l2UHeUw1pkZzG0qnc804uwlzW9g3Y2k 6RwPUhwSHc9J+lR8JGhQn2QeXA3QRFuAZep6YmbyrtSeWRMGpINdXCFRbS8hpSRp3TZe h8puS3Exw/sOy4oLw/EMIaGNKVGNcaZpCNBrUQul8uklPzBT9hLlPd10wrGVOvRiJlOQ zhJKMnUXQ5ySaBnKxU7tRqyEz7ipFvsC9w+6sjjoLVptfRGZ+JQhaYYq1oNy74XXr/ll CtYQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b="dfM/p2ka"; 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 d2-20020aa7d5c2000000b0043accd8a892si3045332eds.184.2022.07.14.14.30.51; Thu, 14 Jul 2022 14:31:16 -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="dfM/p2ka"; 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 S240767AbiGNVZH (ORCPT + 99 others); Thu, 14 Jul 2022 17:25:07 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:54436 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240536AbiGNVZD (ORCPT ); Thu, 14 Jul 2022 17:25:03 -0400 Received: from mail-ej1-x629.google.com (mail-ej1-x629.google.com [IPv6:2a00:1450:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 0DB726D9EC for ; Thu, 14 Jul 2022 14:25:02 -0700 (PDT) Received: by mail-ej1-x629.google.com with SMTP id l23so5690737ejr.5 for ; Thu, 14 Jul 2022 14:25:01 -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:content-transfer-encoding; bh=3t3I9dkeOpZv3dAGJjzgDy35dMg8T+EkyLmF6AEUuHY=; b=dfM/p2kaK73Hlj3gYy/B6pQeiTl6yNjenC/l7tWyHXO/NKnlYmKfPFxUnWCALi2Nza qBh/ZB/SDONX8G+QlzbRNpr4opolwhsauiPD4PEgBz6DTrBixKZNwJj2dqFTFIprdvAa fS3maq4vZY7wJ4sp0qBva9wRpI4kHMcIOecMw= 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:content-transfer-encoding; bh=3t3I9dkeOpZv3dAGJjzgDy35dMg8T+EkyLmF6AEUuHY=; b=DMcHMFaayaBaDVw1O4Ri2UmMnTgRTOkMFMDxPckxC4BxoJvFmiUv+PyTZ9NnZeyrz+ skXrkCUdWvR/pzi7CY3hzLpv8kl2iJhEbGeBl9qVPqrHV02ZsHbKKpmUyjRhUUo376bi sXGhGCOLMukpevtA3fcraBsxe/ojbNTT+kK2gFwC9CYpfUi/bFsBOxDJJ+l7gnNbVHA1 FPh3MDRVmD1F3t8lGMOFaN1dPKqenRzGSpaPOLa4uZmP0eODFRRPw4iOBLqmyAT0tFue fUu8BkVB0sd48FnN/VTCjYxNQsd6yrDSBSGeHvZQym+IaIiI2P2mMwe5BU8/2tmQ41Yt h/xQ== X-Gm-Message-State: AJIora8XOpYQRr7nKvNqYCoHLPdp4aDpWy6dq1Y2pmS2moKtUpm/gvvZ ZZi9JU/iZzhjHTRLcbE8Kh1zIdDIDqZkbLdHvNg= X-Received: by 2002:a17:907:6e05:b0:72a:a141:962 with SMTP id sd5-20020a1709076e0500b0072aa1410962mr10503011ejc.545.1657833900284; Thu, 14 Jul 2022 14:25:00 -0700 (PDT) Received: from mail-wm1-f54.google.com (mail-wm1-f54.google.com. [209.85.128.54]) by smtp.gmail.com with ESMTPSA id e25-20020a056402089900b0043a46f5fb82sm1694718edy.73.2022.07.14.14.24.59 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Thu, 14 Jul 2022 14:24:59 -0700 (PDT) Received: by mail-wm1-f54.google.com with SMTP id o8so1789499wms.2 for ; Thu, 14 Jul 2022 14:24:59 -0700 (PDT) X-Received: by 2002:a05:600c:4ec9:b0:3a2:e9bd:fcd9 with SMTP id g9-20020a05600c4ec900b003a2e9bdfcd9mr17595143wmq.154.1657833899118; Thu, 14 Jul 2022 14:24:59 -0700 (PDT) MIME-Version: 1.0 References: <20220714205646.4023495-1-ndesaulniers@google.com> In-Reply-To: <20220714205646.4023495-1-ndesaulniers@google.com> From: Linus Torvalds Date: Thu, 14 Jul 2022 14:24:43 -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 Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable 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 1:56 PM Nick Desaulniers wrote: > > Linus, > I still think we should add explicit checks to gaurd against divide by > zero. I mean, that's what UBSAN_DIV_ZERO is supposed to do. The fact that clang then messes it up, and turns "I found undefined behavior" into "I just crashed the machine" is why it needs to be disabled. Please conmvince clang people to fix the sanitizer. san=C2=B7i=C2=B7tize /=CB=88san=C9=99=CB=8Ct=C4=ABz/ verb make clean and hygienic; disinfect. note how "sanitize" is meant to clean things of undefined behavior. The way you do that is by warning, and giving it defined behavior. It really is that simple. Clang seems to warn and then just turn it into ANOTHER - and much worse - undefined behavior. In other words, clang doesn't "sanitize" anything at all. It just moves the mess around and makes it worse. Linus