Received: by 2002:a05:6358:9144:b0:117:f937:c515 with SMTP id r4csp846666rwr; Wed, 19 Apr 2023 14:09:31 -0700 (PDT) X-Google-Smtp-Source: AKy350YrldSPGddM430frijXQ0htOWl3GdU7lIxYrdGqu7sfiN5nIG2u8DUE03CcWvk2lR1Zr2ES X-Received: by 2002:a05:6a00:1815:b0:625:fe95:f120 with SMTP id y21-20020a056a00181500b00625fe95f120mr6098366pfa.8.1681938571405; Wed, 19 Apr 2023 14:09:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681938571; cv=none; d=google.com; s=arc-20160816; b=KXoSjw9D62XKevohDJx62T/qqV+1g5P0GgrDtds1andY5lxAaCwuAabHfpG5B59FFY 0eZAAlHuXmKWFsK3hMotpMYJzo/nQLXvrRvb/pZFRuWOdTtPxku1Q0zKBhV/C3xEFQbo FOlwn8PVHNCulkpJ6WT9Qk2iwvMECshpq6q9wJcMav65ebGnNQFqG3n2hJYE57DHIHIG WiH8bnPktV7XJ9a0UF7hcTwCrVNgYu+uzyByKm3iy7GsUgB4xjLiD8q8iLNhhRJPL41u tkyLzEqssYBsS6rSOBysf98vgfghawDIHB7vrnQcxs3d4HgK28WPC2gobU9/81IVrq9N FaGQ== 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=DyuMuSEmljtk0uCa6yhRHNZgUIVDVBS+k9XudbHJtvA=; b=YwE6mSZPqEOzrGBpS5nGRFTZU8I0dgSuPDC/3ntwIo2s0N2BBlmSQSApjde4Pe9H0Y /qfsQfgSzU8H2cs53sRAunR6Y/Ogj9DahLGl3/PPd1j9GDTzqMkaH0/m5YjgWIqMqCMs 8//HBUZkeD2dYcSa+94f79NY1K3XzP4wEX/XAfJKP7VAuGehRigEPkEOchvUWvpBTD3o aI208+YxJYFBXEA9guJRbOVQ0zw7MdN20RJcMCbFIEyR64OJdbiPmsA+4vO8xvg+gO4t ea0ufkxV7WKe71x3TcLb/lAX0ZqkuFw2Kz/ES3c4ilfY3p7X35tpG/F9Vt7uhjPVNiY2 sM6A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=NLbpzlPu; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id bm18-20020a656e92000000b004fab4df6dfdsi17687774pgb.369.2023.04.19.14.09.18; Wed, 19 Apr 2023 14:09:31 -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=@google.com header.s=20221208 header.b=NLbpzlPu; 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; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230361AbjDSVCg (ORCPT + 99 others); Wed, 19 Apr 2023 17:02:36 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58452 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229542AbjDSVCe (ORCPT ); Wed, 19 Apr 2023 17:02:34 -0400 Received: from mail-pl1-x629.google.com (mail-pl1-x629.google.com [IPv6:2607:f8b0:4864:20::629]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6E44D4C19 for ; Wed, 19 Apr 2023 14:02:33 -0700 (PDT) Received: by mail-pl1-x629.google.com with SMTP id d9443c01a7336-1a9290a6f96so55865ad.1 for ; Wed, 19 Apr 2023 14:02:33 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1681938153; x=1684530153; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=DyuMuSEmljtk0uCa6yhRHNZgUIVDVBS+k9XudbHJtvA=; b=NLbpzlPuW8YRaR7ZBfd0UwmtozZCtfufOPiJKcb35nvfU47ArbMZnKzXT9sTLnPcAd 8hGNdip4XvNJ1W30z1IamXiX8dojcLP5mHGNP15iARHvhyrxIYKCL1e1d3hw8uiZw4he RgSaMrvD5/t21c+F8wgj9LosNvR62bx60wUJ/YepUxY2pRSPXO0BdRnRruGKemettefF tl4JDGzAjbd5Se/Qhmsl08Ny1XxweGrnlGIsPe/vdEOKT3F/kaZGgXdr1OqZIdS4uzE0 +EWnazDNHkXXCjuLflA2bfaGsJurFYAwDvlhzBX4cQTthY/3OM9yRDWrhX/tIF1W5kGM s5Kw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1681938153; x=1684530153; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=DyuMuSEmljtk0uCa6yhRHNZgUIVDVBS+k9XudbHJtvA=; b=KU43nhKKgghI3YScnyXUyAvM+6Arp5JRxc2GFniVHpkvLS+9eoOUhoUZFcF02cqmHk Uf8LdGd6tzPzP6NRFJofM41FL4pRyDN9e5Qo8dSw6Us4ywHtaCgODKbckDKe0681Xt2n Mil6dr//Ik03pDWD5cH08RnZDU6T/MQ6+URxdmtpIlZwnTeDq7D6ss4getiYZK/HntFk yjox2WTTHHhzP4jfxjqX1xH6LnzXOdoyadEvPo6w3z0QSt89wxSi17i28gBI0imWoYjT srGbLOXrcT2br8hBaRvtSAOFv7Md6IzDDUOoSGloFNjLPn8jeHqffrNj2CGIsGH7l97V EOHw== X-Gm-Message-State: AAQBX9dWJ4f+EmEq/bYf70ODlsOF/li0fKziudTqpYQOKtO+Y2FzDArr OB/uw7VEcAQRFOsb/FlEV2RQTET6CDkjodfTx9spLg== X-Received: by 2002:a17:902:f70e:b0:198:af50:e4de with SMTP id h14-20020a170902f70e00b00198af50e4demr76325plo.4.1681938152739; Wed, 19 Apr 2023 14:02:32 -0700 (PDT) MIME-Version: 1.0 References: <20230407215406.768464-1-ndesaulniers@google.com> <20230407215824.GA1524475@dev-arch.thelio-3990X> <6436ca47.a70a0220.e83cf.adf4@mx.google.com> In-Reply-To: From: Fangrui Song Date: Wed, 19 Apr 2023 14:02:21 -0700 Message-ID: Subject: Re: [PATCH] ubsan: remove cc-option test for UBSAN_TRAP To: Nick Desaulniers Cc: Kees Cook , Nathan Chancellor , Masahiro Yamada , linux-hardening@vger.kernel.org, Tom Rix , Josh Poimboeuf , Peter Zijlstra , Miroslav Benes , linux-kernel@vger.kernel.org, llvm@lists.linux.dev, linux-kbuild@vger.kernel.org Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,URIBL_BLOCKED,USER_IN_DEF_DKIM_WL, USER_IN_DEF_SPF_WL autolearn=ham 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, Apr 12, 2023 at 11:13=E2=80=AFAM Fangrui Song = wrote: > > On Wed, Apr 12, 2023 at 8:12=E2=80=AFAM Kees Cook = wrote: > > > > On Tue, Apr 11, 2023 at 05:12:24PM -0700, Fangrui Song wrote: > > > On Fri, Apr 7, 2023 at 2:58=E2=80=AFPM Nathan Chancellor wrote: > > > > > > > > On Fri, Apr 07, 2023 at 02:54:06PM -0700, Nick Desaulniers wrote: > > > > > -fsanitize-undefined-trap-on-error has been supported since GCC 5= .1 and > > > > > Clang 3.2. The minimum supported version of these according to > > > > > Documentation/process/changes.rst is 5.1 and 11.0.0 respectively.= Drop > > > > > this cc-option check. > > > > > > > > > > Signed-off-by: Nick Desaulniers > > > > > > > > Reviewed-by: Nathan Chancellor > > > > > > > > As an aside, we should really consider having some standard format = of > > > > comment around cc-option checks so that we can easily remove them w= hen > > > > they become stale... > > > > > > > > > --- > > > > > Masahiro, Kees: get_maintainer.pl leaves much to be desired for t= his > > > > > file. Can one of you please pick this up? > > > > > > > > > > lib/Kconfig.ubsan | 1 - > > > > > 1 file changed, 1 deletion(-) > > > > > > > > > > diff --git a/lib/Kconfig.ubsan b/lib/Kconfig.ubsan > > > > > index fd15230a703b..0e7ad0782399 100644 > > > > > --- a/lib/Kconfig.ubsan > > > > > +++ b/lib/Kconfig.ubsan > > > > > @@ -15,7 +15,6 @@ if UBSAN > > > > > config UBSAN_TRAP > > > > > bool "On Sanitizer warnings, abort the running kernel code" > > > > > depends on !COMPILE_TEST > > > > > - depends on $(cc-option, -fsanitize-undefined-trap-on-error) > > > > > help > > > > > Building kernels with Sanitizer features enabled tends to= grow > > > > > the kernel size by around 5%, due to adding all the debug= ging > > > > > -- > > > > > 2.40.0.577.gac1e443424-goog > > > > > > > > > > > > > > > -fsanitize-undefined-trap-on-error is a legacy option from 2013 when > > > -fcatch-undefined-behavior instead of -fsanitize=3Dundefined enabled > > > UBSan. > > > On the Clang side, http://reviews.llvm.org/D10464 added > > > -fsanitize-trap=3D in June 2015. > > > It's best to use -fsanitize-trap=3Dundefined and avoid uses of > > > -fsanitize-undefined-trap-on-error. > > > > But that's Clang-only. -fsanitize-undefined-trap-on-error works for bot= h > > GCC and Clang. > > > > -- > > Kees Cook > > Just filed a -fsanitize-trap=3D feature request for GCC: > https://gcc.gnu.org/bugzilla/show_bug.cgi?id=3D109489 :) > > https://reviews.llvm.org/D10464 (2015) does mention the state of the > legacy option: > > // https://clang.llvm.org/docs/UsersManual.html#cmdoption-fsanitize-und= efined-trap-on-error > -fsanitize-undefined-trap-on-error > Deprecated alias for -fsanitize-trap=3Dundefined. Circling back. it seems that GCC 13 will have -fsanitize-trap=3Dundefined (a commit from 2022-06). The current https://gcc.gnu.org/onlinedocs/gcc/Instrumentation-Options.html says "The -fsanitize-undefined-trap-on-error option is deprecated equivalent of -fsanitize-trap=3Dall." We need to discourage further uses of the deprecated -fsanitize-undefined-trap-on-error.