Received: by 2002:a05:6358:53a8:b0:117:f937:c515 with SMTP id z40csp771245rwe; Fri, 14 Apr 2023 09:29:27 -0700 (PDT) X-Google-Smtp-Source: AKy350Yu64pkYjyL0dPqwjT35CW6G7nAwbqtxQcwpRNQj2Id6TJowIUquEJIiOAIkSx+JOAXRxwt X-Received: by 2002:a05:6a00:2191:b0:63b:599b:a2da with SMTP id h17-20020a056a00219100b0063b599ba2damr6713238pfi.27.1681489767558; Fri, 14 Apr 2023 09:29:27 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1681489767; cv=none; d=google.com; s=arc-20160816; b=FliJLANJsnDRKd61e5BQFxrHolDXvnEFK+jfB3ZsuxQHnAeiEKiWU6juo0h7cLjIq+ RKAHXoYRTbtxamUW/eIv1ARLJBPp0cHhDcQvcdQwRqdi68ldg7Yw0pFCUUXv/WRv2b/V m940hF936RnHl9r/BzlV74QSCe0aF/YWT5coMAu0UdmKCJv51b2w7sdTrFoDPlpFCEZ4 lqnXc7B4ihNZDwOuyt9PofEBjMunRTm967KDc5+x0jWQofSiZZBEhhkurtiIbgStE6OG 2ECJwc53MZ9u2tC5Y3g/mQ7pB632TRSsQMjHKKD5zB8pnwu3gZBKmmmpa8npWyDFr5Yw RC7A== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:in-reply-to:content-disposition:mime-version :references:message-id:subject:cc:to:from:date:dkim-signature; bh=eEc8Fm/wm0VKS1K1UBuz5uetd7KCRftJswDSiYhnE4g=; b=zix34mOhhs+94/N3MOOS4yDzX7k/lndRMabmRn0FV4l6SPab+eehyls/lzhaEMHveQ plA4qdYOqCTucDUkYRLmOBhP0w1BnrZJJZY9GN9PAF728KEHpnC7OJWMNfz9IUznbRjN /Uoo2YxkRv9QiyEGI/1paF6UVNgv6JBEOhS3Gw8dVj6Flp2WVSUdJLZqRbejWLb2PJOH xztUYXuDgOwHZi9aVtCcNo74waVC+ut+jbT0oeJzEpjGF26sRMh/gWos6TgQjfiWwreB lTxy3sTzCV7hqu5GNMsawn9EA6rtzGYV80aNCvXmbETgJGfMlg0zI6ikTYZwbwD4K1bc 2dcQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b="j3qAa/tC"; 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 Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id x14-20020aa79ace000000b0063b679d095bsi1999895pfp.19.2023.04.14.09.29.13; Fri, 14 Apr 2023 09:29:27 -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="j3qAa/tC"; 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 S229920AbjDNQ0M (ORCPT + 99 others); Fri, 14 Apr 2023 12:26:12 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:33986 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229893AbjDNQ0K (ORCPT ); Fri, 14 Apr 2023 12:26:10 -0400 Received: from dfw.source.kernel.org (dfw.source.kernel.org [139.178.84.217]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 1738C26A6; Fri, 14 Apr 2023 09:26:09 -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 95674648F6; Fri, 14 Apr 2023 16:26:08 +0000 (UTC) Received: by smtp.kernel.org (Postfix) with ESMTPSA id B7B58C433D2; Fri, 14 Apr 2023 16:26:06 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1681489568; bh=9dGs3TW9SOqFu3PmMFt8oVQybRajp0/o5j5Brj6gn0o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=j3qAa/tCEuOQUzRwfLB0aGf7iU1bf2YL4bclomJmgllHNHUVZqFxLgxPN0hwSBsr2 6cpRt5bVCm5ItQtZV92nvqQpmEqU2syQzwuxx+Cy+ss4E1JBzJncXuTRVgzChvksm7 yRqyNUv8VxLZn99sZaTBQ+STa2c+xj2e/1Fvd/d/9l7phb3zYlGxcv5fOtz1cD9al7 vESoRZA+A25yjhW9kPcijjWuR7QFfSBAyXa9U4Cl25dUG0mHUVVuQhjN0h8eKCuA9C nOxX1dIzLW7gm9XRPNGRBzB3/M4lhNUGD3nsNDYq5/8zavX9b/DeqWIbZkAbVrn2ox L9DBeg9yxx2Cw== Date: Fri, 14 Apr 2023 09:26:05 -0700 From: Nathan Chancellor To: Arnd Bergmann Cc: Andrey Ryabinin , Masahiro Yamada , Nick Desaulniers , Marco Elver , 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: Re: [PATCH] kasan: remove hwasan-kernel-mem-intrinsic-prefix=1 for clang-14 Message-ID: <20230414162605.GA2161385@dev-arch.thelio-3990X> References: <20230414082943.1341757-1-arnd@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230414082943.1341757-1-arnd@kernel.org> 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 On Fri, Apr 14, 2023 at 10:29:27AM +0200, Arnd Bergmann wrote: > 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 Hmmm, how did a change like commit 0e1aa5b62160 ("kcsan: Restrict supported compilers") work if cc-option does not work with unknown '-mllvm' flags (or did it)? That definitely seems like a problem, as I see a few different places where '-mllvm' options are used with cc-option. I guess I will leave that up to the sanitizer folks to comment on that further, one small comment below. > 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 I do not think you need to duplicate this block, I think ifeq ($(call clang-min-version, 150000)$(call gcc-min-version, 130000),y) CFLAGS_KASAN += $(call cc-param,hwasan-kernel-mem-intrinsic-prefix=1) endif would work, as only one of those conditions can be true at a time. Cheers, Nathan