From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-9.8 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_PATCH, MAILING_LIST_MULTI,SIGNED_OFF_BY,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id C9DD6C4363A for ; Mon, 26 Oct 2020 16:57:30 +0000 (UTC) Received: from merlin.infradead.org (merlin.infradead.org [205.233.59.134]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 576C62068D for ; Mon, 26 Oct 2020 16:57:30 +0000 (UTC) Authentication-Results: mail.kernel.org; dkim=pass (2048-bit key) header.d=lists.infradead.org header.i=@lists.infradead.org header.b="AbjE21Fe" DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 576C62068D Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=arm.com Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=merlin.20170209; h=Sender:Content-Transfer-Encoding: Content-Type:Cc:List-Subscribe:List-Help:List-Post:List-Archive: List-Unsubscribe:List-Id:In-Reply-To:MIME-Version:References:Message-ID: Subject:To:From:Date:Reply-To:Content-ID:Content-Description:Resent-Date: Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID:List-Owner; bh=UIAY08c2Bf4K8hzD+fe6QM7n/Efkua6qUxZi6QVklyo=; b=AbjE21FeW7zZAJWuYneL1775A NuYPRO7eNajG2VPL8tgVfCdmTvki5DA9YBphgiG/QKwL7JOwgrbZmYf1w02XVpuZb7P44mQLm+2cr BiHV7de2dKqwmmi5iNrgvHWMXFq/BRvHz/nHc1h6SkOELs2H1ZtstEbEQm9p8Vsq21qg9Fq/7ytcx S2VEUWbgj7r8PaAz9sjIlTCGvO1XrRBKS/WuurVYSKj4rywmR/SV43rk3Ew5aJ6d1GRVm1KaNU2Qi DrcyWAc+uSuK5Fz9IIiz6XUlLu4t3AVPC5W4kN26hSBEX+wWM3dytYQ/gp4TDgT2RzAgxujdkhvoU wBtaP7JAg==; Received: from localhost ([::1] helo=merlin.infradead.org) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kX5n3-0004uF-O8; Mon, 26 Oct 2020 16:56:13 +0000 Received: from foss.arm.com ([217.140.110.172]) by merlin.infradead.org with esmtp (Exim 4.92.3 #3 (Red Hat Linux)) id 1kX5mz-0004sm-GE for linux-arm-kernel@lists.infradead.org; Mon, 26 Oct 2020 16:56:11 +0000 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 A3687106F; Mon, 26 Oct 2020 09:56:07 -0700 (PDT) Received: from C02TD0UTHF1T.local (unknown [10.57.56.187]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPSA id E07A13F719; Mon, 26 Oct 2020 09:56:05 -0700 (PDT) Date: Mon, 26 Oct 2020 16:55:55 +0000 From: Mark Rutland To: Arnd Bergmann Subject: Re: [PATCH 2/4] arm64: hide more compat_vdso code Message-ID: <20201026165543.GA42952@C02TD0UTHF1T.local> References: <20201026160342.3705327-1-arnd@kernel.org> <20201026160342.3705327-2-arnd@kernel.org> MIME-Version: 1.0 Content-Disposition: inline In-Reply-To: <20201026160342.3705327-2-arnd@kernel.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20201026_125609_677167_139AD810 X-CRM114-Status: GOOD ( 26.78 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Michel Lespinasse , Arnd Bergmann , Catalin Marinas , Mark Brown , linux-kernel@vger.kernel.org, Andrei Vagin , Vincenzo Frascino , Will Deacon , Ard Biesheuvel , linux-arm-kernel@lists.infradead.org Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org On Mon, Oct 26, 2020 at 05:03:29PM +0100, Arnd Bergmann wrote: > From: Arnd Bergmann > > When CONFIG_COMPAT_VDSO is disabled, we get a warning > about a potential out-of-bounds access: > > arch/arm64/kernel/vdso.c: In function 'aarch32_vdso_mremap': > arch/arm64/kernel/vdso.c:86:37: warning: array subscript 1 is above array bounds of 'struct vdso_abi_info[1]' [-Warray-bounds] > 86 | unsigned long vdso_size = vdso_info[abi].vdso_code_end - > | ~~~~~~~~~^~~~~ > > This is all in dead code however that the compiler is unable to > eliminate by itself. > > Change the array to individual local variables that can be > dropped in dead code elimination to let the compiler understand > this better. > > Fixes: 0cbc2659123e ("arm64: vdso32: Remove a bunch of #ifdef CONFIG_COMPAT_VDSO guards") > Signed-off-by: Arnd Bergmann This looks like a nice cleanup to me! I agree we don't need the array here. Reviewed-by: Mark Rutland Thanks, Mark. > --- > arch/arm64/kernel/vdso.c | 56 ++++++++++++++++++---------------------- > 1 file changed, 25 insertions(+), 31 deletions(-) > > diff --git a/arch/arm64/kernel/vdso.c b/arch/arm64/kernel/vdso.c > index debb8995d57f..0b69d2894742 100644 > --- a/arch/arm64/kernel/vdso.c > +++ b/arch/arm64/kernel/vdso.c > @@ -286,36 +286,9 @@ static int aarch32_vdso_mremap(const struct vm_special_mapping *sm, > return __vdso_remap(VDSO_ABI_AA32, sm, new_vma); > } > > -enum aarch32_map { > - AA32_MAP_VECTORS, /* kuser helpers */ > - AA32_MAP_SIGPAGE, > - AA32_MAP_VVAR, > - AA32_MAP_VDSO, > -}; > - > static struct page *aarch32_vectors_page __ro_after_init; > static struct page *aarch32_sig_page __ro_after_init; > > -static struct vm_special_mapping aarch32_vdso_maps[] = { > - [AA32_MAP_VECTORS] = { > - .name = "[vectors]", /* ABI */ > - .pages = &aarch32_vectors_page, > - }, > - [AA32_MAP_SIGPAGE] = { > - .name = "[sigpage]", /* ABI */ > - .pages = &aarch32_sig_page, > - }, > - [AA32_MAP_VVAR] = { > - .name = "[vvar]", > - .fault = vvar_fault, > - .mremap = vvar_mremap, > - }, > - [AA32_MAP_VDSO] = { > - .name = "[vdso]", > - .mremap = aarch32_vdso_mremap, > - }, > -}; > - > static int aarch32_alloc_kuser_vdso_page(void) > { > extern char __kuser_helper_start[], __kuser_helper_end[]; > @@ -352,14 +325,25 @@ static int aarch32_alloc_sigpage(void) > return 0; > } > > +static struct vm_special_mapping aarch32_vdso_map_vvar = { > + .name = "[vvar]", > + .fault = vvar_fault, > + .mremap = vvar_mremap, > +}; > + > +static struct vm_special_mapping aarch32_vdso_map_vdso = { > + .name = "[vdso]", > + .mremap = aarch32_vdso_mremap, > +}; > + > static int __aarch32_alloc_vdso_pages(void) > { > > if (!IS_ENABLED(CONFIG_COMPAT_VDSO)) > return 0; > > - vdso_info[VDSO_ABI_AA32].dm = &aarch32_vdso_maps[AA32_MAP_VVAR]; > - vdso_info[VDSO_ABI_AA32].cm = &aarch32_vdso_maps[AA32_MAP_VDSO]; > + vdso_info[VDSO_ABI_AA32].dm = &aarch32_vdso_map_vvar; > + vdso_info[VDSO_ABI_AA32].cm = &aarch32_vdso_map_vdso; > > return __vdso_init(VDSO_ABI_AA32); > } > @@ -380,6 +364,11 @@ static int __init aarch32_alloc_vdso_pages(void) > } > arch_initcall(aarch32_alloc_vdso_pages); > > +static struct vm_special_mapping aarch32_vdso_map_vectors = { > + .name = "[vectors]", /* ABI */ > + .pages = &aarch32_vectors_page, > +}; > + > static int aarch32_kuser_helpers_setup(struct mm_struct *mm) > { > void *ret; > @@ -394,11 +383,16 @@ static int aarch32_kuser_helpers_setup(struct mm_struct *mm) > ret = _install_special_mapping(mm, AARCH32_VECTORS_BASE, PAGE_SIZE, > VM_READ | VM_EXEC | > VM_MAYREAD | VM_MAYEXEC, > - &aarch32_vdso_maps[AA32_MAP_VECTORS]); > + &aarch32_vdso_map_vectors); > > return PTR_ERR_OR_ZERO(ret); > } > > +static struct vm_special_mapping aarch32_vdso_map_sigpage = { > + .name = "[sigpage]", /* ABI */ > + .pages = &aarch32_sig_page, > +}; > + > static int aarch32_sigreturn_setup(struct mm_struct *mm) > { > unsigned long addr; > @@ -417,7 +411,7 @@ static int aarch32_sigreturn_setup(struct mm_struct *mm) > ret = _install_special_mapping(mm, addr, PAGE_SIZE, > VM_READ | VM_EXEC | VM_MAYREAD | > VM_MAYWRITE | VM_MAYEXEC, > - &aarch32_vdso_maps[AA32_MAP_SIGPAGE]); > + &aarch32_vdso_map_sigpage); > if (IS_ERR(ret)) > goto out; > > -- > 2.27.0 > _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel