Received: by 2002:a6b:fb09:0:0:0:0:0 with SMTP id h9csp1011347iog; Wed, 29 Jun 2022 15:14:06 -0700 (PDT) X-Google-Smtp-Source: AGRyM1vnGCrGZ7kpDH4CKF3M4PdDrvH4nvnOSAiiIYedrbsx/a+oVuMD6po1V82q9ewPqcsg1oer X-Received: by 2002:a17:907:9805:b0:726:96cf:2bd2 with SMTP id ji5-20020a170907980500b0072696cf2bd2mr5738111ejc.119.1656540846717; Wed, 29 Jun 2022 15:14:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1656540846; cv=none; d=google.com; s=arc-20160816; b=ZWOF1pCLyMMU3IPq1AGgqrSLx07df1qPxOdL94zTb+Riu1ZR4NsEilkXI1bM2dklHP g1GUu8K8qJqYvuLCid6m5gZWsAc/HV4AAtL/ums5obZbtDMKSP4/Awiobi9/n0BuQhTV 8u7PbyV48sQpxC4jPzg89YzdsdEVY48a7gkai9hVIJYfeqEe3WW0ZSayy6fvwuNMFsmj /15t26p+wuiOMFCWB3NXV3a+YRjEHb5x1THzg712OOCWXTB/fBg+u61f7BNk7BMzXcTH OAcgpbnjl4iBTQsusXDPkugJWP80ONMpvgEfeSevZUH6vTtGgqwTpjg1BKcuOl09R4Tp VhmQ== 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=klf2T5uOmYkulw+Ytxhor7E1jRh+wZUXX4z/9h4gYAk=; b=kvUhaL4xXevYyMI7IR32OQJSUGUqYEDL6+xr07GPf+zHffoUBpBk1FnikfkLenfY5j f+nDlC9BDW41VxTSNOXPBYpzApabgifGpxG56JYiEyv7YZh8SnjKiKbnrSozMG9ksf3U Npi7QBKPselkTTlhHdoV+DoOkteR6LbEs/aXXSsTEMuQ2oAftyZ0BSXxSq5dh/szda9H RZa3+dvTzw/UHK69JfjjeicluyKlTyjPqVzgiP2FKfwCN+OvaVOpmTDOyHV1eGbMgq6W Xd2MnaDpAtgYxYYhi14xz+PhdBqwdHwyETxinhojeemlJQnSi79EGDqhTa8U8RSnrC1x PmxA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linux-foundation.org header.s=google header.b=hAQm1c13; 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 m7-20020a17090679c700b00722e85dcd91si3871826ejo.175.2022.06.29.15.13.41; Wed, 29 Jun 2022 15:14:06 -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=hAQm1c13; 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 S230175AbiF2VkI (ORCPT + 99 others); Wed, 29 Jun 2022 17:40:08 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:47682 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230125AbiF2VkH (ORCPT ); Wed, 29 Jun 2022 17:40:07 -0400 Received: from mail-ed1-x531.google.com (mail-ed1-x531.google.com [IPv6:2a00:1450:4864:20::531]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id BA67B34BB3 for ; Wed, 29 Jun 2022 14:40:05 -0700 (PDT) Received: by mail-ed1-x531.google.com with SMTP id n8so10050169eda.0 for ; Wed, 29 Jun 2022 14:40:05 -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=klf2T5uOmYkulw+Ytxhor7E1jRh+wZUXX4z/9h4gYAk=; b=hAQm1c13W/XqzJEQGpVDQndjuXTIF/hnLGFygg19fcRMwVFwwvtwTnuY62qNkTKPsN ummZuhAltApu5WzcBlZRapxwbWg7c0aLtThrKLZaU63b6nHxlLMnebmA/0hCeagDrFcn hagyyVyTMpXMrTeCXHSAtT7Z8257jVCbYTvK4= 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=klf2T5uOmYkulw+Ytxhor7E1jRh+wZUXX4z/9h4gYAk=; b=a/qMLYQwDK545jIQfijbcAWdaJFNpV6gZD3grdlG2OHeLnoJffbuGtQg+LsWxQnK/u ebaV7K19l+YW0SQVt0nc8+XjuNIsaqv3ohAzRZhhw5FvGBRvWd0/L7+OusyzzCUYBuje BlAyHKYAsfCweD/micC6BpRl5h0HEBf1uYdDE3dcxpeu9KjV7Bd3qFRnmXFao6pX/GHS +jipw5K9fYTuhSzN4xv1oVZUveNlSepMehqsInjO9mZgAlgU81V6p2U9zmDo/sBa/Sq0 jDI9fpi4C1oiDOXT2H+Ocb867BgklmkaxOq4rctnn/rPkx+6KVJN3IjVmuHQyujqeAZo sBtw== X-Gm-Message-State: AJIora/Xu5bkDXJlxkySekM4CDp9SSCC0FmXXvgqu+dLDGhq/3Xu3qjU HWn3RJIu6tTxG9FW2aQvZBd4X8RxVbuQY5L2 X-Received: by 2002:a05:6402:274a:b0:435:9807:7752 with SMTP id z10-20020a056402274a00b0043598077752mr7457387edd.63.1656538804107; Wed, 29 Jun 2022 14:40:04 -0700 (PDT) Received: from mail-wm1-f41.google.com (mail-wm1-f41.google.com. [209.85.128.41]) by smtp.gmail.com with ESMTPSA id s16-20020a170906455000b00722bc0aa9e3sm1911850ejq.162.2022.06.29.14.40.01 for (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Wed, 29 Jun 2022 14:40:03 -0700 (PDT) Received: by mail-wm1-f41.google.com with SMTP id f190so9854605wma.5 for ; Wed, 29 Jun 2022 14:40:01 -0700 (PDT) X-Received: by 2002:a05:600c:4ecc:b0:3a1:68bf:d17a with SMTP id g12-20020a05600c4ecc00b003a168bfd17amr5659198wmq.154.1656538801585; Wed, 29 Jun 2022 14:40:01 -0700 (PDT) MIME-Version: 1.0 References: <20220628224255.w4lmzalkx3qejuyg@treble> <20220629163400.cgeqmuu45zsyxtwq@treble> In-Reply-To: From: Linus Torvalds Date: Wed, 29 Jun 2022 14:39:45 -0700 X-Gmail-Original-Message-ID: Message-ID: Subject: Re: mainline build failure due to 281d0c962752 ("fortify: Add Clang support") To: Nick Desaulniers Cc: Josh Poimboeuf , Josh Poimboeuf , Sudip Mukherjee , Nathan Chancellor , Kees Cook , Linux Kernel Mailing List , clang-built-linux , Peter Zijlstra 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 Wed, Jun 29, 2022 at 2:21 PM Nick Desaulniers wrote: > > For hahas I tried: > > ``` > diff --git a/drivers/video/fbdev/smscufx.c b/drivers/video/fbdev/smscufx.c Yeah, no. I think the proper fix is to just say depends on !CLANG in the UBSAN Kconfig. The whole point of UBSAN is to *detect* undefined behavior, but continue. If we wanted to crash on undefined behavior, we'd just leave it alone, without any compiler option. Think of it this way: you have a user (corporate-speak: "customer") that is seeing behavior you can't figure out. You enable a lot of these debug options to see "are they triggering something I can't trigger?". But you want to get the *report* about that, you don't want to actually break the users load. You want the user to be able to do what they always did, knowing that at least you're not making their problem any worse. Sure, it's slower, but it should just continue as well as it ever did. Whatever UBSAN then detects may OR MAY NOT be the actual cause of the user report. So no, it's not ok to say "Ahh, I found it, I will now print out the report and crash". So at no point is it ok to say "oh, that's undefined, so we can do anything we want". NOT AT ALL. That's actually true in general, but it's _particularly_ true when you build with UBSAN, since now you're actively trying to get reports about undefined behavior, and crashing will destroy that. It will destroy that particularly for a kernel where crashing in an unusual place that the developer doesn't see quite possibly means "odd device driver". In this case it would be the particular frame buffer the user uses - crashing there probably means that there is no output to help debug things. But this is actually true even for non-kernel uses: if you are running an app as a developer, and you're looking for problems, having one place with undefined behavior in no way means that you don't care about any other undefined places. So crashing is literally *never* the right thing to do. So no, the whole "it's still undefined, so we can't return" argument is completely broken. Linus