From patchwork Thu Nov 16 03:27:05 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Gustavo A. R. Silva" X-Patchwork-Id: 165679 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b909:0:b0:403:3b70:6f57 with SMTP id t9csp2964638vqg; Wed, 15 Nov 2023 19:28:53 -0800 (PST) X-Google-Smtp-Source: AGHT+IFoIvQSgnwWtkcsA8ovl2j/Oz8FRjdTXXPfAuZMj8Q/VnfzVr9P/mH7MtVaXCmMmf6R57uP X-Received: by 2002:a05:6358:728c:b0:16c:24d:8252 with SMTP id w12-20020a056358728c00b0016c024d8252mr6126853rwf.8.1700105333602; Wed, 15 Nov 2023 19:28:53 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1700105333; cv=none; d=google.com; s=arc-20160816; b=gogMhk8/lcu6fKEZHs25jQyUKCSS/5hLt/u+LHQyVRP8QoirlrqON3rUNXWiEQ4Syv y0HXlcWtmgbRclGh7Jh5EJ7uSByttY0CTXLg7ghnes5hj/2XGTRiQQQPsWzgxePbRIuO pVtFs/bH4/l5hUDUnARbRA8HpRVFx+b8r2EjGC9/1wlH1RJ+Bc6OJjEMsj37xCNk6bdO ibVzUwWuMm1HbSN+ZHpYM/Uva2Fh3NO9v0xEsQ39Q1srW41fAyvxvbBgdGTtCmHiiMGJ 4wCG1cKKskm3piLMPwDV+dUYlx/BAlVTbok9OmGfAthqJO6mM1i7LDtBy2xUwCk4xl2k 5BKQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-disposition:mime-version:message-id :subject:cc:to:from:date:dkim-signature; bh=/DoICLfHLEQW26QnMk7o+s/qI6jn/kLLy8y8FHMc/Ng=; fh=U8JJuM5tGjqt5FAYbSGAHxuuSUv/Bv9r/BfDzUDMLn8=; b=AB5kq2CUy/YRwx0tRg5vm7hk03bMwb8cif+MWJ7I3GAapd2Foh2LJn/YdT6Dhxbemu I9L0XOM8o8qzbCgSc43+aiFNZB7zonhba1AqLOovdnC2fNnRxT+sVjXi7tqVoc4zT/iW rvs2sQ2PwGW48rxNDUa0kt7tcfY9lqjqdVA3nPntQgkLIaQzhuiTEDf4to4r5QLN0egC 2k1XD6w/8Cfzr0gS9o5DVm/xnFmRTGTBnW3WagFuSFnlfKapXSZgqqFcHjHp+p8zcItE RQM39LwY5J22CBAoGlTgCBBu6Cjdb412BE4f6LtF7UF/luneiOYMHm4yxW0tyKlNbV7m oOIw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g28Utjwy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from snail.vger.email (snail.vger.email. [2620:137:e000::3:7]) by mx.google.com with ESMTPS id l192-20020a6391c9000000b005b934643e39si11040190pge.599.2023.11.15.19.28.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Wed, 15 Nov 2023 19:28:53 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) client-ip=2620:137:e000::3:7; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=g28Utjwy; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::3:7 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (depot.vger.email [IPv6:2620:137:e000::3:0]) by snail.vger.email (Postfix) with ESMTP id 3513B809871D; Wed, 15 Nov 2023 19:27:29 -0800 (PST) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.11 at snail.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1344852AbjKPD1P (ORCPT + 28 others); Wed, 15 Nov 2023 22:27:15 -0500 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:60364 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S235695AbjKPD1N (ORCPT ); Wed, 15 Nov 2023 22:27:13 -0500 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B90D01A7 for ; Wed, 15 Nov 2023 19:27:09 -0800 (PST) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4CE41C433C7; Thu, 16 Nov 2023 03:27:08 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1700105229; bh=0RxvFSGgxRT7IzJsthnJWzmXWCyJavEwPeaq9aEW7Sc=; h=Date:From:To:Cc:Subject:From; b=g28Utjwy9tiQeSYo5Ou1JeJZ+xpcjmO2McxjRXcY6dku5ZFpCfd89/xGX+FMUj7dR kAYlx66JNZF+0x8GSf495dBz12b92M2laK/mKiH/gyHH41odO33dbCsvCFal1bMLcH cbE4DGYuxS7/QuWOfMspVxWURHDZOMvDACU8uXZh8hb1mowsEbUCIQZI9cCXhZidET ZnPcFPPM8C+5uRjgPiM48cPMbP+zB5NQv5tTrV5/TJac1BGN3KB1ISnTGH8RDY+TjQ baJqz3isNod82PvbColGx2jWivFpsEEO5RatsdyDagTQSjfVHCftQ4tYjmrtozdRJf QrLuGZhbeTHRA== Date: Wed, 15 Nov 2023 21:27:05 -0600 From: "Gustavo A. R. Silva" To: Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Nicolas Schier Cc: linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, "Gustavo A. R. Silva" , linux-hardening@vger.kernel.org Subject: [PATCH][next] Makefile: Enable -Wstringop-overflow globally Message-ID: MIME-Version: 1.0 Content-Disposition: inline X-Spam-Status: No, score=-4.5 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED, SPF_HELO_NONE,SPF_PASS,T_SCC_BODY_TEXT_LINE 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 X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (snail.vger.email [0.0.0.0]); Wed, 15 Nov 2023 19:27:29 -0800 (PST) X-getmail-retrieved-from-mailbox: INBOX X-GMAIL-THRID: 1782689650116403621 X-GMAIL-MSGID: 1782689650116403621 It seems that we have finished addressing all the remaining issues regarding compiler option -Wstringop-overflow. So, we are now in good shape to enable this compiler option globally. Signed-off-by: Gustavo A. R. Silva --- Makefile | 3 +++ scripts/Makefile.extrawarn | 2 -- 2 files changed, 3 insertions(+), 2 deletions(-) diff --git a/Makefile b/Makefile index 690cde550acd..452b7d0e19e9 100644 --- a/Makefile +++ b/Makefile @@ -985,6 +985,9 @@ NOSTDINC_FLAGS += -nostdinc # perform bounds checking. KBUILD_CFLAGS += $(call cc-option, -fstrict-flex-arrays=3) +# We are now in good shape to enable this option. +KBUILD_CFLAGS += $(call cc-option, -Wstringop-overflow) + # disable invalid "can't wrap" optimizations for signed / pointers KBUILD_CFLAGS += -fno-strict-overflow diff --git a/scripts/Makefile.extrawarn b/scripts/Makefile.extrawarn index 2fe6f2828d37..1527199161d7 100644 --- a/scripts/Makefile.extrawarn +++ b/scripts/Makefile.extrawarn @@ -106,7 +106,6 @@ KBUILD_CFLAGS += $(call cc-option, -Wunused-const-variable) KBUILD_CFLAGS += $(call cc-option, -Wpacked-not-aligned) KBUILD_CFLAGS += $(call cc-option, -Wformat-overflow) KBUILD_CFLAGS += $(call cc-option, -Wformat-truncation) -KBUILD_CFLAGS += $(call cc-option, -Wstringop-overflow) KBUILD_CFLAGS += $(call cc-option, -Wstringop-truncation) KBUILD_CPPFLAGS += -Wundef @@ -122,7 +121,6 @@ KBUILD_CFLAGS += $(call cc-disable-warning, restrict) KBUILD_CFLAGS += $(call cc-disable-warning, packed-not-aligned) KBUILD_CFLAGS += $(call cc-disable-warning, format-overflow) KBUILD_CFLAGS += $(call cc-disable-warning, format-truncation) -KBUILD_CFLAGS += $(call cc-disable-warning, stringop-overflow) KBUILD_CFLAGS += $(call cc-disable-warning, stringop-truncation) ifdef CONFIG_CC_IS_CLANG