From patchwork Tue Apr 18 12:23:35 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 84831 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp2804583vqo; Tue, 18 Apr 2023 05:25:47 -0700 (PDT) X-Google-Smtp-Source: AKy350a60b5OHkcOy6ErqRtq1w6sl2dNJuZH5nsJGj9ErV1xoocWwziRPRtuX+cmqQPrhvDBuBJM X-Received: by 2002:a17:902:fb86:b0:1a5:f36:ae09 with SMTP id lg6-20020a170902fb8600b001a50f36ae09mr1725048plb.7.1681820747508; Tue, 18 Apr 2023 05:25:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681820747; cv=none; d=google.com; s=arc-20160816; b=0p08b9MPZX7W2sydrs2GkcMGFtBaOEnHrV1NafBVsdxaUF/J+qMlcMaLRveV1Ud0vI 3Pvb458bRWKlCp/rrphHIiu2TSH4xclOSON9m1FoxOhYxp+/Cmgnq+nngV3KJenm/qvj 4hJa4CP9Bl0cAdYMo63/6QjC5aC2GDoOQ5oU8oxdvS5JPWnz8HDFTUNDWDonPT4JTKp2 ZRM95/lELv4XdjabnpCnA8bw5d1LMwCVFBO8VWX75q47QcaU6WdqHubI28reB2g7/8l3 +iJmRoQid5rNuZWFXAPHmhR962glAeJP5ktTSQ5GEQdk1GhaiAvfm+964lRo7VCwbEsp oA/Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :message-id:date:subject:cc:to:from:dkim-signature; bh=rCHsboCrzW2SygIqg56Vq9y+2W0XVFNSXAStqyqIoOo=; b=DWzgUYw7ipKSbFt0RFiDVaqRVXBATHBnUDIPq0b7mnI1bF436rXFpiQYGXJu7FQzT7 cmFUkxf5je0ExwbDO7EGgpwJLXvcZ4lfLqnG5JOpKTG0IbXbsWTBNbbYf77ThkQ+jRid 66D/dgkNv1pBQU4oEXLTfgTWC84dvk7p8nYhKpD1i9yB7SJSDhFSMtPIFQlGyOr/jEtm mxmqR5jMFlMtafc2h6HoKXIASSBeZj77fvV9vbCfOMzl5rOqaxxlbPK2Xk6aX2SLAyd4 x7VoyMj9GyGCOHC7Xvh8jKDCpNGjBp7wBRaTi7jWByo1Hf+IfzW7bVJFhWO7+2UqvbrU 8x+A== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZV5ApDRA; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id p11-20020a1709026b8b00b001a4ee6ec8d3si4181653plk.65.2023.04.18.05.25.30; Tue, 18 Apr 2023 05:25:47 -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=@kernel.org header.s=k20201202 header.b=ZV5ApDRA; 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=NONE sp=NONE dis=NONE) header.from=kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231211AbjDRMYE (ORCPT + 99 others); Tue, 18 Apr 2023 08:24:04 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59876 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231222AbjDRMYC (ORCPT ); Tue, 18 Apr 2023 08:24:02 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [IPv6:2604:1380:4641:c500::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id B2D5E4C28; Tue, 18 Apr 2023 05:23:58 -0700 (PDT) Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by dfw.source.kernel.org (Postfix) with ESMTPS id 4125A630F2; Tue, 18 Apr 2023 12:23:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id CA6D4C4339B; Tue, 18 Apr 2023 12:23:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681820637; bh=Pl7qe1hAnrP+LtVJ6K+2U2pcxRX/WcQvra5GGhz/u6E=; h=From:To:Cc:Subject:Date:From; b=ZV5ApDRAANpiHhaO421exFkJL+f9/cyKqYJDClXnFpP78N6NHpc5acuTMCnwrO5U+ yCTXwgMlGU294bLFzBnsTvW3IrY/19mThftD5ndrMlJF6WfhoILio9vlCt7Xtl3H3n yxin7yexwPHB8ClnOsuilIDEhl6Knw7pBX6Lxn3YKFksCb7LiI2zNV2oKJ3p7kXrzh dwCdXOKtbHDSI+YXtuQ2bxjqFmFODE550Wu4Imp9G7LCmBAXbmV4kExNEd5urcqEpn Tl3FCJUTPuqIFgPZhQWwitBhAmTa3+jTd6FZ3UCq5z8j/nO74a7RlVmBXr0WmgKjhn khRNdTpQgffaQ== From: Arnd Bergmann To: Masahiro Yamada , Marco Elver Cc: Arnd Bergmann , Andrey Ryabinin , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Nathan Chancellor , Nick Desaulniers , Nicolas Schier , Tom Rix , Andrew Morton , "Peter Zijlstra (Intel)" , Michael Ellerman , kasan-dev@googlegroups.com, linux-kbuild@vger.kernel.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH] [v2] kasan: remove hwasan-kernel-mem-intrinsic-prefix=1 for clang-14 Date: Tue, 18 Apr 2023 14:23:35 +0200 Message-Id: <20230418122350.1646391-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-4.4 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-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1763516872313247374?= X-GMAIL-MSGID: =?utf-8?q?1763516872313247374?= From: Arnd Bergmann Some unknown -mllvm options (i.e. those starting with the letter "h") don't cause an error to be returned by clang, so the cc-option helper adds the unknown hwasan-kernel-mem-intrinsic-prefix=1 flag to CFLAGS with compilers that are new enough for hwasan but too old for this option. This causes a rather unreadable build failure: fixdep: error opening file: scripts/mod/.empty.o.d: No such file or directory make[4]: *** [/home/arnd/arm-soc/scripts/Makefile.build:252: scripts/mod/empty.o] Error 2 fixdep: error opening file: scripts/mod/.devicetable-offsets.s.d: No such file or directory make[4]: *** [/home/arnd/arm-soc/scripts/Makefile.build:114: scripts/mod/devicetable-offsets.s] Error 2 Add a version check to only allow this option with clang-15, gcc-13 or later versions. Fixes: 51287dcb00cc ("kasan: emit different calls for instrumentable memintrinsics") Link: https://lore.kernel.org/all/CANpmjNMwYosrvqh4ogDO8rgn+SeDHM2b-shD21wTypm_6MMe=g@mail.gmail.com/ Signed-off-by: Arnd Bergmann Reviewed-by: Marco Elver Reviewed-by: Nathan Chancellor --- v2: use one-line version check for both clang and gcc, clarify changelog text --- scripts/Makefile.kasan | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan index c186110ffa20..390658a2d5b7 100644 --- a/scripts/Makefile.kasan +++ b/scripts/Makefile.kasan @@ -69,7 +69,9 @@ CFLAGS_KASAN := -fsanitize=kernel-hwaddress \ $(instrumentation_flags) # Instrument memcpy/memset/memmove calls by using instrumented __hwasan_mem*(). +ifeq ($(call clang-min-version, 150000)$(call gcc-min-version, 130000),y) CFLAGS_KASAN += $(call cc-param,hwasan-kernel-mem-intrinsic-prefix=1) +endif endif # CONFIG_KASAN_SW_TAGS