From patchwork Fri Apr 14 08:29:27 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Arnd Bergmann X-Patchwork-Id: 83294 Return-Path: Delivered-To: ouuuleilei@gmail.com Received: by 2002:a59:b0ea:0:b0:3b6:4342:cba0 with SMTP id b10csp223549vqo; Fri, 14 Apr 2023 01:37:09 -0700 (PDT) X-Google-Smtp-Source: AKy350bnMheYuVOoeP9t+Ej986z5MLdxH5/l+tB6lGbB32GKXaVQxkjNTHp+hprdquWyaPg2eams X-Received: by 2002:a17:902:ce8c:b0:1a6:7b92:15ec with SMTP id f12-20020a170902ce8c00b001a67b9215ecmr2030263plg.41.1681461428995; Fri, 14 Apr 2023 01:37:08 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681461428; cv=none; d=google.com; s=arc-20160816; b=hFleXXnkQgY0n+51QvNu+0NoC8WfO06Fppm/7Y8BN2TjPY2HOsnYwdgH/MaIArdd4D +W6Egty0m9U2PnqldD4zcYMMlY8L8mrRAvTY4/tpQL+JxcJ9bTX+1MnYmoSrdWPcPbmb ppnWVNkELcSgvMV5F4vsAhRR+TRJx2l3zJA5RXYrTLuYUUbD1zZepcfZcVSb7r0yUjmR /GnANDRKKBxf/nbwxf2iF8H0Vy3ReqQmQFyIt+oR/kE1N+sUHmUUc4HnQtAT6kjo5oMX YeNDSTYWqRYv0bV3uOJIoT/MxMJLDQGQ79N1n5ov8ys/+FJzL/mSSSCP3ms3I31ZCQUU /FIQ== 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=F0nAr7knvbuggdLaOyKz0wqlPkbknidAEagf8h7aml4=; b=aXwIZ81Ac1cY8cZ9j1Nromvu/93xv/1fWoZxouUIfQUS3aJ5dv66VOAsNNFSx70+As w0wHhyit6aq7cAeXpb0cH1BAZk3gHFApbyxLXOvHn7JHrUiiHWx99FzqGstfOZbYoqWe T9iPWMMSiKFc5GQDwOB+xntImt9OKxMGPchtsoTcEQKM8N4JtPCEYJZD4RH+9rzyv7xk bCv3QxCou/fgsEYtDQvjr8N+0YJ8ZhLlqOstp3fWxAj6G0BpEK9W3TOyEYXBPbLWxj2b FBexH5DcEMF1cc94aqwAx2VAm90z+MJrV2iFyr1yxuLaA6hZhRvcqNmpbQixDs/LJsVg hGeQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=MAc0Wdvt; 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-20020a1709028a8b00b001a63af5f8d8si3888624plo.4.2023.04.14.01.36.51; Fri, 14 Apr 2023 01:37:08 -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=MAc0Wdvt; 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 S230214AbjDNIac (ORCPT + 99 others); Fri, 14 Apr 2023 04:30:32 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:37782 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230203AbjDNIaG (ORCPT ); Fri, 14 Apr 2023 04:30:06 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 88B6A6E9F; Fri, 14 Apr 2023 01:29: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 16EE9644E4; Fri, 14 Apr 2023 08:29:58 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 48916C433EF; Fri, 14 Apr 2023 08:29:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681460997; bh=ZTCTGs1pRDDeWJeFuWw6MUiRlW5oe3Xoqp/dtRXoY0o=; h=From:To:Cc:Subject:Date:From; b=MAc0WdvtaHTQOVtkR71fygSK181HZrRel+3IJliSMjR6cKg5dK5tzRhJDo1C1DnAE hRdOVKQ2Ip5CbFSmSU84TD3LjP7ZdbPWd1iGEkvtwgrXmdrDrxZL24zdDQq+t+5R+e aBVFLXTpI+fCGZ3onY6KnK+j5ZusS2MaxSB+PvBvc3oEf6H0ezQa+ujnG4ohFqS2/X K3N4MPlM3l668EE6yYNPGiaLVybR+oBVjQjHPIMuXLoVCdfMrdS7JE3jrGlZiCg4Bn INujmut/VQNgRi7hYKV5qlcf99alLjF5ILdUr25hqG42/inaD3nS1f2NgXnfW4/B0X uMTHV4E9s7kmQ== From: Arnd Bergmann To: Andrey Ryabinin , Masahiro Yamada , Nathan Chancellor , Nick Desaulniers , Marco Elver Cc: Arnd Bergmann , Nicolas Schier , Alexander Potapenko , Andrey Konovalov , Dmitry Vyukov , Vincenzo Frascino , Tom Rix , Andrew Morton , Michael Ellerman , "Peter Zijlstra (Intel)" , linux-kbuild@vger.kernel.org, kasan-dev@googlegroups.com, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Subject: [PATCH] kasan: remove hwasan-kernel-mem-intrinsic-prefix=1 for clang-14 Date: Fri, 14 Apr 2023 10:29:27 +0200 Message-Id: <20230414082943.1341757-1-arnd@kernel.org> X-Mailer: git-send-email 2.39.2 MIME-Version: 1.0 X-Spam-Status: No, score=-7.1 required=5.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_HI, 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?1763140099273615200?= X-GMAIL-MSGID: =?utf-8?q?1763140099273615200?= From: Arnd Bergmann Unknown -mllvm options 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") Signed-off-by: Arnd Bergmann --- There is probably a better way to do this than to add version checks, but I could not figure it out. --- scripts/Makefile.kasan | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/scripts/Makefile.kasan b/scripts/Makefile.kasan index c186110ffa20..2cea0592e343 100644 --- a/scripts/Makefile.kasan +++ b/scripts/Makefile.kasan @@ -69,7 +69,12 @@ CFLAGS_KASAN := -fsanitize=kernel-hwaddress \ $(instrumentation_flags) # Instrument memcpy/memset/memmove calls by using instrumented __hwasan_mem*(). +ifeq ($(call clang-min-version, 150000),y) CFLAGS_KASAN += $(call cc-param,hwasan-kernel-mem-intrinsic-prefix=1) +endif +ifeq ($(call gcc-min-version, 130000),y) +CFLAGS_KASAN += $(call cc-param,hwasan-kernel-mem-intrinsic-prefix=1) +endif endif # CONFIG_KASAN_SW_TAGS