Received: by 2002:a05:6a10:413:0:0:0:0 with SMTP id 19csp2309135pxp; Mon, 21 Mar 2022 16:32:53 -0700 (PDT) X-Google-Smtp-Source: ABdhPJzosU6sDPaXjaDrnEyDDQpo613wAok1VD90ZPd1Okh7+EDymuEzcWc3SlesJAdbaHQIYjr2 X-Received: by 2002:a17:90b:4d0f:b0:1bf:6a2:5637 with SMTP id mw15-20020a17090b4d0f00b001bf06a25637mr1667024pjb.106.1647905573545; Mon, 21 Mar 2022 16:32:53 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1647905573; cv=none; d=google.com; s=arc-20160816; b=I3SpPYWDQPPeQak2/NFRsWu43bW4daKrIlQQthuFmgnEJkqHl+LM+j2j+GQsy++fwJ Zczja4w16uXwzjMqf/PfQV2LIvo2/5yucK8libutyeGHHPB8LKCTptpVOviBlXx0JxP+ xFY0tnYrBCL2084nqhil6SIVaf4kxtOOxqXRG1qeobeAdi+GViKIXXm2Clri1PdH2Azs xZzDj7z4bWCh7ycKiL1uXMa9Cawnba86pHxmxsuwv/3ofcIVDYzT2iWGZ03BvJTmMmOE aVPmYBm5Aw0h+PDWFWk+qjbvgQoXrV/ZKjyjA8Ra3c8Dx0A+hPy1dP1cCVD70dX/fBpd QgXg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:content-language :in-reply-to:mime-version:user-agent:date:message-id:from:references :cc:to:subject; bh=c+LUtLId+Waq/xldcRcx9BkS6lMi5uYy0YV5t8hx+1E=; b=bLYs+BpBqy7SgLUOwhmGGZGnaNRwkhje6CZbTHAYcDFl2oX8Fco7XWDtbPaihVrBr8 7CHdidaPDHGKRp7BPKxBfgWpqOuNZfpNq+xCiZCMXGBPc9sTjuHNA0mDDb4IwpT2Mwcs QJS62JmNrhX6lTaHaPu7N7vpLZw3UIa/bZTqNywioJoTk+mfwFAYgPwFeUP/1muGsVHr 0aR5BNfMHlARbFqOrAr64ALY8Nny+os16KtVoOk3dc8pTdNjDSUCCVA4dVXf/mzVVqXy L88voxM4nk7lFwoBfDVw5x/NKWUM3j2zsIgre+DEjnhMul5cQ4d46OrPBR3G7mMSFNDk bS1Q== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from lindbergh.monkeyblade.net (lindbergh.monkeyblade.net. [2620:137:e000::1:18]) by mx.google.com with ESMTPS id l6-20020a639846000000b003816043f067si14245191pgo.604.2022.03.21.16.32.53 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 21 Mar 2022 16:32:53 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) client-ip=2620:137:e000::1:18; Authentication-Results: mx.google.com; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 43B644787FA; Mon, 21 Mar 2022 15:23:39 -0700 (PDT) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S236319AbiCRMij (ORCPT + 99 others); Fri, 18 Mar 2022 08:38:39 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49078 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230008AbiCRMii (ORCPT ); Fri, 18 Mar 2022 08:38:38 -0400 Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by lindbergh.monkeyblade.net (Postfix) with ESMTP id 1426B2E044C for ; Fri, 18 Mar 2022 05:37:20 -0700 (PDT) Received: from usa-sjc-imap-foss1.foss.arm.com (unknown [10.121.207.14]) by usa-sjc-mx-foss1.foss.arm.com (Postfix) with ESMTP id CC1CC1474; Fri, 18 Mar 2022 05:37:19 -0700 (PDT) Received: from [10.57.88.118] (unknown [10.57.88.118]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id 5FBAE3F7F5; Fri, 18 Mar 2022 05:37:18 -0700 (PDT) Subject: Re: [PATCH] arm64: fix clang warning about TRAMP_VALIAS To: Arnd Bergmann , Catalin Marinas , Will Deacon , Nathan Chancellor , Nick Desaulniers Cc: Arnd Bergmann , "Russell King (Oracle)" , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, llvm@lists.linux.dev References: <20220316183833.1563139-1-arnd@kernel.org> From: James Morse Message-ID: <92859987-5088-3b2c-3e51-e61222724d23@arm.com> Date: Fri, 18 Mar 2022 12:37:12 +0000 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:78.0) Gecko/20100101 Thunderbird/78.14.0 MIME-Version: 1.0 In-Reply-To: <20220316183833.1563139-1-arnd@kernel.org> Content-Type: text/plain; charset=utf-8; format=flowed Content-Language: en-US Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-1.9 required=5.0 tests=BAYES_00, HEADER_FROM_DIFFERENT_DOMAINS,MAILING_LIST_MULTI,NICE_REPLY_A, RDNS_NONE,SPF_HELO_NONE,T_SCC_BODY_TEXT_LINE autolearn=no 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 Hi Arnd, On 3/16/22 6:38 PM, 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] > return (char *)TRAMP_VALIAS + SZ_2K * slot; It is? Good to know! (clang 11 doesn't seem to be so fussy) Just for some more background: TRAMP_VALIAS existed before, but it wasn't defined if KPTI is disabled at compile time, you can't do that without CONFIG_EXPERT. I thought these dummy definitions would be cleaner than #ifdef'ing the code. > Change the addition to something clang does not complain about. Acked-by: James Morse Thanks! James > 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); > >