Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp957514lqh; Sun, 5 May 2024 09:12:34 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVqsVe/r1F/3GdVyQ3z516fuFXH1tRVCzHWzkJulg2w4w9UsgbttyLH2zP/hXpD/GNM0Wt6WhKue2hVxI5B7zPbvfEU0PuEAkwxFlKdPQ== X-Google-Smtp-Source: AGHT+IGsqkP1LS3ByW9WmF0Gur971gRHjyZ2A7NmunAG3WE09MS0Ise2D5+hqWNpIUFuxJTuhkKN X-Received: by 2002:a05:6a20:9c8d:b0:1a3:aed1:4d50 with SMTP id mj13-20020a056a209c8d00b001a3aed14d50mr10896810pzb.31.1714925554176; Sun, 05 May 2024 09:12:34 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714925554; cv=pass; d=google.com; s=arc-20160816; b=EsNLkj+lqCbqaPhtQXx3A7fVVyzW5nhIoDU7emRjyn5oBZCW/1Lf3hwxS9Tn8ULuaN o+/HRN7Wb7oRezOCk7LpN27IeSA+p1+x8yqUsVC86JR9zGRDZl0+HDlIg6oGGX3VIO+7 btNXMFCxLZ/us0C39WGoWAasbZdXTrpyXdxBE5m+JZutzKNI8jrM4lbXL4xWvodC9PXF kgCnP0mADBzZndNiCSYVSw7AF7waEIAqAVqN+US0IjOC/aGczHCWYpNehZGJOCmxtLjq YO728erOA4SPktVxiTJMFeoILwseOplDShlFaJHaFi/V3rGDEYhcT646WU9cSZPpn5tg VGXg== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :date:subject:cc:to:from:dkim-signature; bh=VpbkUxuadtAaKX6Fnq0w2CEcga3ignfuLmYWKso72/Y=; fh=Hur1Ox4UVY8CJ+UkFvS1tjjuIJbfjIxUd04pOdDk42c=; b=FMJt2Ag9O01VGPRu987OqgzRPmVjpxdSxNF1DWk2RKpZcHKoffbM1FuPbNWdGl73FN pIjXM3G3jrNmtZRTAkvsCH5bbYYBnPyiB28PzyiReGg4RADTpLZ7ICnfEJhvca+7CO4U JLk7QX2B+pcaGnQ62VrSsv/uoRPuZHXE14NNz+aZJCpHSt0fI5tQWmcGx2BesrEJJIE4 UsK30AwWzJDguE/QOMdEhwhWM1hmVDngeJy3zN/WaoB4VYj+S9VkuSFBeElOAFjqQZu3 L9QLCiD6XVeITMzRVwPkE9sY7Yd69R/FohHxrdTZxYorA97XX0A7sQ/nZ7R3OKiPLAfg 9v8Q==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o8jiLvcf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-169046-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169046-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id c7-20020a63ef47000000b005ceca1094c3si6537451pgk.853.2024.05.05.09.12.33 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 May 2024 09:12:34 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169046-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=o8jiLvcf; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-169046-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169046-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id 9654DB2171A for ; Sun, 5 May 2024 16:11:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id B33F33FB01; Sun, 5 May 2024 16:08:47 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="o8jiLvcf" Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B46783E48F; Sun, 5 May 2024 16:08:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714925326; cv=none; b=AedRlJDyFDIcHHRBnrVBEeZyGaEawvJX7SD9RTFTQPbOiqI6WYG6AWCjJK1/OKEH9ZsND01eeV+YYj5NCnadXO716uKWpxVBRQUz+lPYV4F4hrnfr2rcxX/9woa97FSBtlCGhYtYMDBp4MjWQCJsylU9fFqHhip1CY5zPs2Xwko= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714925326; c=relaxed/simple; bh=baelIo5gqQ6dNoONu464d37hHX6/MoaALRFlqjsyJfc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=QcZaBhLQNjakVwf4SUaup2BQp1i8EnKRBKv27h7iR/yE2AAEnCjNJblGMb+aZSJec5TO9LGo46etbI7z7GryRaiWeUtWk/PTDE5++M6pcNCKwLns67+UW5NjLU/VqAL6YfWbaYiREudI9wmMqYC9nZE8PX7Dg0xOYz0fdhgtKZI= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=o8jiLvcf; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C2B7C4AF66; Sun, 5 May 2024 16:08:35 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714925326; bh=baelIo5gqQ6dNoONu464d37hHX6/MoaALRFlqjsyJfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=o8jiLvcfyNXB2iKxVuJHVMVEodBkbD1zblOEpItf8uhQXKQxqKdCGY7s0UctSKPri k3As8VAahDJ4NZSDJZmP61b1qd29PgNi4/WY8gt8pcKwe+U4mL0gWKr6G0c0l3jpEh lALY/R8NgYRkr74Dq4kIvOKK9Z8fxbuOpiw8GpmS2/XpjxcCx/Vu0WjnQ947IN3TrW v+f+OWtztPnMo6X5MTTu0wTYyR/w4hxiWyvDCgQheibsLdCYKyF8k/C/97DxOoCjPL DXuwU6qdfZL8+QFtJj1eo0qsbPEa5DTL9c098i09INCdxXLQTtnFDA8FsMheRTKOOZ 98lqdYyVWEYLg== From: Mike Rapoport To: linux-kernel@vger.kernel.org Cc: Alexandre Ghiti , Andrew Morton , =?UTF-8?q?Bj=C3=B6rn=20T=C3=B6pel?= , Catalin Marinas , Christophe Leroy , "David S. Miller" , Dinh Nguyen , Donald Dutile , Eric Chanudet , Heiko Carstens , Helge Deller , Huacai Chen , Kent Overstreet , Liviu Dudau , Luis Chamberlain , Mark Rutland , Masami Hiramatsu , Michael Ellerman , Mike Rapoport , Nadav Amit , Palmer Dabbelt , Peter Zijlstra , =?UTF-8?q?Philippe=20Mathieu-Daud=C3=A9?= , Rick Edgecombe , Russell King , Sam Ravnborg , Song Liu , Steven Rostedt , Thomas Bogendoerfer , Thomas Gleixner , Will Deacon , bpf@vger.kernel.org, linux-arch@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: [PATCH RESEND v8 10/16] arm64: extend execmem_info for generated code allocations Date: Sun, 5 May 2024 19:06:22 +0300 Message-ID: <20240505160628.2323363-11-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240505160628.2323363-1-rppt@kernel.org> References: <20240505160628.2323363-1-rppt@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit 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_info and drop overrides of alloc_insn_page() and bpf_jit_alloc_exec(). Signed-off-by: Mike Rapoport (IBM) Acked-by: Will Deacon --- arch/arm64/kernel/module.c | 12 ++++++++++++ arch/arm64/kernel/probes/kprobes.c | 7 ------- arch/arm64/net/bpf_jit_comp.c | 11 ----------- 3 files changed, 12 insertions(+), 18 deletions(-) diff --git a/arch/arm64/kernel/module.c b/arch/arm64/kernel/module.c index b7a7a23f9f8f..a52240ea084b 100644 --- a/arch/arm64/kernel/module.c +++ b/arch/arm64/kernel/module.c @@ -146,6 +146,18 @@ struct execmem_info __init *execmem_arch_setup(void) .fallback_start = fallback_start, .fallback_end = fallback_end, }, + [EXECMEM_KPROBES] = { + .start = VMALLOC_START, + .end = VMALLOC_END, + .pgprot = PAGE_KERNEL_ROX, + .alignment = 1, + }, + [EXECMEM_BPF] = { + .start = VMALLOC_START, + .end = VMALLOC_END, + .pgprot = PAGE_KERNEL, + .alignment = 1, + }, }, }; diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c index 327855a11df2..4268678d0e86 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)); -} - /* arm kprobe: install breakpoint in text */ void __kprobes arch_arm_kprobe(struct kprobe *p) { diff --git a/arch/arm64/net/bpf_jit_comp.c b/arch/arm64/net/bpf_jit_comp.c index 122021f9bdfc..456f5af239fc 100644 --- a/arch/arm64/net/bpf_jit_comp.c +++ b/arch/arm64/net/bpf_jit_comp.c @@ -1793,17 +1793,6 @@ u64 bpf_jit_alloc_exec_limit(void) return VMALLOC_END - VMALLOC_START; } -void *bpf_jit_alloc_exec(unsigned long size) -{ - /* Memory is intended to be executable, reset the pointer tag. */ - return kasan_reset_tag(vmalloc(size)); -} - -void bpf_jit_free_exec(void *addr) -{ - return vfree(addr); -} - /* Indicate the JIT backend supports mixing bpf2bpf and tailcalls. */ bool bpf_jit_supports_subprog_tailcalls(void) { -- 2.43.0