Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp1508391pxp; Sun, 20 Mar 2022 20:08:33 -0700 (PDT) X-Google-Smtp-Source: ABdhPJxgDzW20IidAoc88SbaNNFSRoPCyxamCdvj/rVV2R+GGpWQPJKF2e0e0vUXm9ysPonLHBl3 X-Received: by 2002:a05:6402:1749:b0:419:325b:f8c with SMTP id v9-20020a056402174900b00419325b0f8cmr4851933edx.386.1647832113659; Sun, 20 Mar 2022 20:08:33 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647832113; cv=none; d=google.com; s=arc-20160816; b=PWu1kEdRe9X8wSWy18OOpiCWPQay/PuT4T4LyDUuSnmnnux9UUV7xEY/WLRwxiDs2a BdKt53kQSdvvo2smE+5zGW5pRXdZEMtljJy/+MTIK8wHlqJ/vq7tOfq16TpOnylr/0wk s/4hgXD4LpcZel0w0zC3nV9sazhMvDRvKhzz+eDOkceHOL63VlxkxzPuhr3yKqfMHMmh 5AR6SarpQRnnA98soQREAv3VQkYHh700jIX4QfS3fjGeVCHuD23/asb0k+e1xNR4AwKY qMJMuNkYzSJFGdrAsUbQmMowyB5YOfSECNJ4I4AybsfmD1zyEKasRY/He7/MPII6z7kJ 71gA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:cc:to:subject:message-id:date:from:in-reply-to :references:mime-version:dkim-signature; bh=AQ3E8sCDZrEL2wZ8doD+CiI98BAdcflnpsvxxLxIuMs=; b=nm42AcpPClILu9YAAm81iOR2u0q0cV8LWY7SlkGuByYuhvb02TA/zDGn6B50bSbsJR CSPCC5rEuhueNpH0xs/CDrdcAzbzIQiyjQD9XWa2iFVVUFoqWIlvX+HAbSK1P+9DcU/L 5TZ2Hq0wHFTKWgnAiGN06E83EXRHLeMmWvg9mKMney5/qB6dgOcVUSmxCSJUigC6BMMx kb7tzyeezjYGzGh1sefSfjBG/UygmhVpKwlWY6yQXyuitBXc00NQ98NOWv5OkfRi5Uuv aHORmD40jZD7qUzMQcSF3gD6W/vKTdpA8XR5WtFIdk8GDz7enuP+NRloZ6DIzLMhtQQo siig== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20210112 header.b=ENTvmxmf; 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 hr2-20020a1709073f8200b006df76385df3si7418435ejc.659.2022.03.20.20.08.08; Sun, 20 Mar 2022 20:08:33 -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=20210112 header.b=ENTvmxmf; 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 S240426AbiCRTxv (ORCPT + 99 others); Fri, 18 Mar 2022 15:53:51 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:42686 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240380AbiCRTxv (ORCPT ); Fri, 18 Mar 2022 15:53:51 -0400 Received: from mail-lf1-x130.google.com (mail-lf1-x130.google.com [IPv6:2a00:1450:4864:20::130]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E1B4A2EA0C7 for ; Fri, 18 Mar 2022 12:52:31 -0700 (PDT) Received: by mail-lf1-x130.google.com with SMTP id w12so15673301lfr.9 for ; Fri, 18 Mar 2022 12:52:31 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20210112; h=mime-version:references:in-reply-to:from:date:message-id:subject:to :cc; bh=AQ3E8sCDZrEL2wZ8doD+CiI98BAdcflnpsvxxLxIuMs=; b=ENTvmxmfC4BBPkAvhD10+g2ipgazNCa4PAo9eVHZtO0K7t4pwlwqgomak+5pu8YwRJ 05IbDBoO0ky49EF0YZ16JJCVFeR7Z9tKixBgevg/2393ptzAGOCK+UyXWJAsR8TlWx9R ZEjN0bsBQp4zVFejhCCUNvPjaId2PNhRRnnsQbJDR1bxrWukR/2LCBs8ftpwE68iS1ch vRxY210N95DMzLNpJH2jRAEQW25g4EtYLjiYQy532pwdPCzQnkGUZ/Hz2KLzgQo+MgQA djHW421qAfRshCbzSw2FzrnMQE3fucFLq7CGZfxVWOCAGxNIUiD/04HWve0DpOEztz0o 4zIg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:mime-version:references:in-reply-to:from:date :message-id:subject:to:cc; bh=AQ3E8sCDZrEL2wZ8doD+CiI98BAdcflnpsvxxLxIuMs=; b=54c3Jme3vJYZE8+eOQXwAHu/AojPM0FjmBUTFFwf99Ks6OlZpfxqfDkvy4TQ2enMEZ fTGtrc5pdp/Q8l2qkJVUhYw8EoyzLEIqnkYHu6MCICpPFhrmAUSen49zFD4oIDbSWzDC EBvcHoBjq3KVTXJgx5PXZfgItWYAJp7knhRYX8PQJ4GAz3gkqe+jXjpEI/XFl/VWEUgc ZoKKZ4BEf85FZSMWezCPDyc9plvMBSLmf3H7x6Jd5PQlaKAghCg5YAc/M5ZiGvgBZJJ/ bdUPdx7cnymogpew1ilHktWlQpbtkXFAYbvc+k5XA1VyeauBPjOJcachk/kVqr1Y2Dxd xQBg== X-Gm-Message-State: AOAM530PruaiJKh7HKv48uLqURLjyJk1bCLj6cv1dQTuT3lZZ/GEzCaR Fcq0MCmMzQcpr1XXi6jLCz9pBRdpYMn6HndPmX6jOA== X-Received: by 2002:a05:6512:308e:b0:448:3826:6d68 with SMTP id z14-20020a056512308e00b0044838266d68mr6639558lfd.184.1647633149856; Fri, 18 Mar 2022 12:52:29 -0700 (PDT) MIME-Version: 1.0 References: <20220316183833.1563139-1-arnd@kernel.org> <3b9cedd6-a084-5d87-2fdd-0da10146827b@arm.com> In-Reply-To: <3b9cedd6-a084-5d87-2fdd-0da10146827b@arm.com> From: Nick Desaulniers Date: Fri, 18 Mar 2022 12:52:18 -0700 Message-ID: Subject: Re: [PATCH] arm64: fix clang warning about TRAMP_VALIAS To: Robin Murphy Cc: Arnd Bergmann , Catalin Marinas , Will Deacon , Nathan Chancellor , James Morse , Arnd Bergmann , "Russell King (Oracle)" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev Content-Type: text/plain; charset="UTF-8" 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,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 Fri, Mar 18, 2022 at 12:11 PM Robin Murphy wrote: > > On 2022-03-16 18:38, Arnd Bergmann wrote: > > From: Arnd Bergmann > > > > The newly introduced TRAMP_VALIAS definition causes a build warning > > with clang-14: > > > > arch/arm64/include/asm/vectors.h:66:31: error: arithmetic on a null pointer treated as a cast from integer to pointer is a GNU extension [-Werror,-Wnull-pointer-arithmetic] > > Tangentially, all the other GNU extensions we depend on throughout Linux > are also GNU extensions. Do we know what's special about this one? My first thought is that -Wnull-pointer-arithmetic should be in the -Wgnu flag group, such that -Wno-gnu (as set by Kbuild) implies -Wno-null-pointer-arithmetic. One issue seems to be that -Wnull-pointer-arithmetic seems to control at least 2 different checks in clang. https://godbolt.org/z/hdYYejj3d So it's likely these two checks should have 2 distinct flags, such that the warning we're observing can be grouped under -Wgnu. Filed: https://github.com/llvm/llvm-project/issues/54444 > > Robin. > > > return (char *)TRAMP_VALIAS + SZ_2K * slot; > > > > Change the addition to something clang does not complain about. > > > > Fixes: bd09128d16fa ("arm64: Add percpu vectors for EL1") > > Signed-off-by: Arnd Bergmann > > --- > > arch/arm64/include/asm/vectors.h | 4 ++-- > > 1 file changed, 2 insertions(+), 2 deletions(-) > > > > I see this warning on 5.17-rc8, but did not test it on linux-next, > > which may already have a fix. > > > > diff --git a/arch/arm64/include/asm/vectors.h b/arch/arm64/include/asm/vectors.h > > index f64613a96d53..bc9a2145f419 100644 > > --- a/arch/arm64/include/asm/vectors.h > > +++ b/arch/arm64/include/asm/vectors.h > > @@ -56,14 +56,14 @@ enum arm64_bp_harden_el1_vectors { > > DECLARE_PER_CPU_READ_MOSTLY(const char *, this_cpu_vector); > > > > #ifndef CONFIG_UNMAP_KERNEL_AT_EL0 > > -#define TRAMP_VALIAS 0 > > +#define TRAMP_VALIAS 0ul > > #endif > > > > static inline const char * > > arm64_get_bp_hardening_vector(enum arm64_bp_harden_el1_vectors slot) > > { > > if (arm64_kernel_unmapped_at_el0()) > > - return (char *)TRAMP_VALIAS + SZ_2K * slot; > > + return (char *)(TRAMP_VALIAS + SZ_2K * slot); > > > > WARN_ON_ONCE(slot == EL1_VECTOR_KPTI); > > -- Thanks, ~Nick Desaulniers