Received: by 2002:a05:7412:251c:b0:e2:908c:2ebd with SMTP id w28csp1369320rda; Mon, 23 Oct 2023 10:21:32 -0700 (PDT) X-Google-Smtp-Source: AGHT+IH3UpN4LI/og855miljeVMW9Y4uXudpF+tjk2dbucv4UVQyQFEI2irlkd7p994p4w2Qg0jI X-Received: by 2002:a17:90b:1fce:b0:27d:47b4:785f with SMTP id st14-20020a17090b1fce00b0027d47b4785fmr7606504pjb.18.1698081691883; Mon, 23 Oct 2023 10:21:31 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1698081691; cv=none; d=google.com; s=arc-20160816; b=0hyJ5rp2EDb46b4jrrNWclyx1QdHk2mihFETEBbUm9yaFVRfMLIu8y8oNQlkoH9Dw7 Qd6jrDfSaN7ZgxrkRENfc1zGmTpNNo5/tKjCd1mNv3Vzcp0/1GxYsPib9iH5y5HLgeTO lPQCcuSzdg9aCbWM1VQ6Gz21ac/WiSP4Yj9MSA/p0Oe8jm4b5gHNqiu8+u0gc/G+hW/b QLQekLphVSGeLXaYiOW0jcwLQ1/QiQ8fAUB+KVzLVi3bFKYDMHB2rZR7Pg+Bcu6YPSpT DIVQA4a/EGyFHZbHBqTSnlcEWYthzB6NiWQFWHhRlCgwUPQEMB4GMUvNiuJwWhIgrsk2 DC8w== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:user-agent:in-reply-to:content-disposition :mime-version:references:message-id:subject:cc:to:from:date :dkim-signature; bh=mpBk0bee1Vo9ZQzPXjYzdfJKL27+PJnNMWscFl745aM=; fh=OJK98ATgFJmfCN0gRmseDUU5URm5/2Pk0J7JwopS/Jo=; b=xX9WF+7b0CjCTOASH2cyipMX+cvuRnW2iDNsxfl0rxyryWaZWuB4fCsXlK+U3JUXQ6 CNPGJsDOdYTWbBW/otZGXEr7QynqvN5Euh8YKRQMbMAIygUJ++y3lpzPeDPOI/WDBkX9 v0iqJFYCYLWdRdnidZ/FtuYiO2lRIJrQaZZqIu/k4gfmdxh4OpTulYElip3vXyhpiWba JFnsfX1yfpNKoRvWLxa+SJiemQMZaOCdEzDfFmsKChi9lmXD3fYq6RbnLYPzC1G78j12 Cjkqzfk59jZaY5KL1N5XUjbYcvK0Rw/su005VMs76DEd/0r6NFTiFLsu4goM5Bgr1f1x NYlw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZOVDksWf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 lipwig.vger.email (lipwig.vger.email. [23.128.96.33]) by mx.google.com with ESMTPS id r19-20020a170902c61300b001c35cccca33si6301238plr.448.2023.10.23.10.21.30 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 23 Oct 2023 10:21:31 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 as permitted sender) client-ip=23.128.96.33; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=ZOVDksWf; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.33 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 (depot.vger.email [IPv6:2620:137:e000::3:0]) by lipwig.vger.email (Postfix) with ESMTP id 1F787803796E; Mon, 23 Oct 2023 10:21:29 -0700 (PDT) X-Virus-Status: Clean X-Virus-Scanned: clamav-milter 0.103.10 at lipwig.vger.email Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231362AbjJWRVN (ORCPT + 99 others); Mon, 23 Oct 2023 13:21:13 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:44556 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S229453AbjJWRVM (ORCPT ); Mon, 23 Oct 2023 13:21:12 -0400 Received: from smtp.kernel.org (relay.kernel.org [52.25.139.140]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 6EE3794; Mon, 23 Oct 2023 10:21:10 -0700 (PDT) Received: by smtp.kernel.org (Postfix) with ESMTPSA id 977DEC433C7; Mon, 23 Oct 2023 17:21:03 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1698081670; bh=WQYEKm0Mc7inaH0wFnxcEUmfAmPR1JoMV7fRygVNKQQ=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=ZOVDksWfw+hV9R+Z5ZexM6NcY3xDNdzdq9AsRt4vO9wMdxWhqWWcxLwP+eW4A962q Qk6ekhq2Ipm65VVsfFxXGy8qQeQOWzCvDqLJfEU8nWaZHFbI6flnaXvlVH0CRDWH+w hIMRahts5mdD+tpF+6eXFcpVMEl1Ep7tHL5W7fbVdPmlfZ6yQugf14RafBolwJcEMn 21vyDdZz0h9WC0+Q/QJBX2oIB6fGQ1kXhcFuxCsKB2tbLoPEgU/BSdSOixB9qw31iO OgDPN8A4Uqs6uFqTMJcPk6zjMZ/offJmG+hcHSxPefHsLKYd1oYsfoKs6fvoRIkbKX wMvEth+vb/+ag== Date: Mon, 23 Oct 2023 18:21:00 +0100 From: Will Deacon To: Mike Rapoport Cc: linux-kernel@vger.kernel.org, Andrew Morton , =?iso-8859-1?Q?Bj=F6rn_T=F6pel?= , Catalin Marinas , Christophe Leroy , "David S. Miller" , Dinh Nguyen , Heiko Carstens , Helge Deller , Huacai Chen , Kent Overstreet , Luis Chamberlain , Mark Rutland , Michael Ellerman , Nadav Amit , "Naveen N. Rao" , Palmer Dabbelt , Puranjay Mohan , Rick Edgecombe , Russell King , Song Liu , Steven Rostedt , Thomas Bogendoerfer , Thomas Gleixner , bpf@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linux-mm@kvack.org, linux-modules@vger.kernel.org, linux-parisc@vger.kernel.org, linux-riscv@lists.infradead.org, linux-s390@vger.kernel.org, linux-trace-kernel@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, loongarch@lists.linux.dev, netdev@vger.kernel.org, sparclinux@vger.kernel.org, x86@kernel.org Subject: Re: [PATCH v3 07/13] arm64, execmem: extend execmem_params for generated code allocations Message-ID: <20231023172059.GB4041@willie-the-truck> References: <20230918072955.2507221-1-rppt@kernel.org> <20230918072955.2507221-8-rppt@kernel.org> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20230918072955.2507221-8-rppt@kernel.org> User-Agent: Mutt/1.10.1 (2018-07-13) X-Spam-Status: No, score=-1.2 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,MAILING_LIST_MULTI, SPF_HELO_NONE,SPF_PASS autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lipwig.vger.email Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org X-Greylist: Sender passed SPF test, not delayed by milter-greylist-4.6.4 (lipwig.vger.email [0.0.0.0]); Mon, 23 Oct 2023 10:21:29 -0700 (PDT) On Mon, Sep 18, 2023 at 10:29:49AM +0300, Mike Rapoport wrote: > From: "Mike Rapoport (IBM)" > > The memory allocations for kprobes and BPF on arm64 can be placed > anywhere in vmalloc address space and currently this is implemented with > overrides of alloc_insn_page() and bpf_jit_alloc_exec() in arm64. > > Define EXECMEM_KPROBES and EXECMEM_BPF ranges in arm64::execmem_params and > drop overrides of alloc_insn_page() and bpf_jit_alloc_exec(). > > Signed-off-by: Mike Rapoport (IBM) > --- > arch/arm64/kernel/module.c | 13 +++++++++++++ > arch/arm64/kernel/probes/kprobes.c | 7 ------- > arch/arm64/net/bpf_jit_comp.c | 11 ----------- > 3 files changed, 13 insertions(+), 18 deletions(-) > > diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c > index cd6320de1c54..d27db168d2a2 100644 > --- a/arch/arm64/kernel/module.c > +++ b/arch/arm64/kernel/module.c > @@ -116,6 +116,16 @@ static struct execmem_params execmem_params __ro_after_init = { > .flags = EXECMEM_KASAN_SHADOW, > .alignment = MODULE_ALIGN, > }, > + [EXECMEM_KPROBES] = { > + .start = VMALLOC_START, > + .end = VMALLOC_END, > + .alignment = 1, > + }, > + [EXECMEM_BPF] = { > + .start = VMALLOC_START, > + .end = VMALLOC_END, > + .alignment = 1, > + }, > }, > }; > > @@ -140,6 +150,9 @@ struct execmem_params __init *execmem_arch_params(void) > r->end = module_plt_base + SZ_2G; > } > > + execmem_params.ranges[EXECMEM_KPROBES].pgprot = PAGE_KERNEL_ROX; > + execmem_params.ranges[EXECMEM_BPF].pgprot = PAGE_KERNEL; > + > return &execmem_params; > } > > diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c > index 70b91a8c6bb3..6fccedd02b2a 100644 > --- a/arch/arm64/kernel/probes/kprobes.c > +++ b/arch/arm64/kernel/probes/kprobes.c > @@ -129,13 +129,6 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) > return 0; > } > > -void *alloc_insn_page(void) > -{ > - return __vmalloc_node_range(PAGE_SIZE, 1, VMALLOC_START, VMALLOC_END, > - GFP_KERNEL, PAGE_KERNEL_ROX, VM_FLUSH_RESET_PERMS, > - NUMA_NO_NODE, __builtin_return_address(0)); > -} It's slightly curious that we didn't clear the tag here, so it's nice that it all happens magically with your series: Acked-by: Will Deacon Will