Received: by 2002:ab2:7b86:0:b0:1f7:5705:b850 with SMTP id q6csp914511lqh; Sun, 5 May 2024 07:30:46 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCVlqP6w2zwZTtXc6XNqi8JfLjECSebJS7kNIuU78DFCFkoarPlnP4dlBcD4TgcIiI+a7uLPFqHZfigCZqLovUQQOfyhfWe/NDgw6I1Q8w== X-Google-Smtp-Source: AGHT+IEjsQbCD63u/suvA0opyD9SQ0r0wghJzHy6LMhmS4SSOj9YztPtAHLQ6cWLCGi9zUnvtQpc X-Received: by 2002:a05:620a:44ca:b0:790:dfd6:57f0 with SMTP id y10-20020a05620a44ca00b00790dfd657f0mr9342749qkp.45.1714919445962; Sun, 05 May 2024 07:30:45 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1714919445; cv=pass; d=google.com; s=arc-20160816; b=Rtrlmt2yjpHxe1Kyzt+ke62P9YE3GniaJjzC/JFz5KiI+buShCDZHuBHEwsnMpPEUy /cdI7biQ/N7q1R8LF0he7ZI6tF67wVJHnD6o5sFH9ZrJNAvx1wazmtnoP39fhlYzHQrG X9d34B7QP3BqZygi3+kXlIKiFooxFnExFhZ2qJcLF3uAGZlQv4DI+2FxXbo1u2iLoQpQ 6MC9ZKHsX7snssR9vNTVuQbr0b4bRdiYtJ74d561+MlnSgAdYrLIHZ5YPprEE1POcJZU kc1cI8s8c071TOpt2JPU+QDht557zEOzrtMhEfjm/PiOeLOETcN1ZaWEB1ntupsIaTod atEw== 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=oLs7ha/ejWiV9MhKBKPmOhB5FXoOp7zP+38zeLCgRqo8VniVLHOr6O0TKxzBMvvvgG oRy829CAV/ZKibudJw2EPJLCTjwErrNuDQ9ev3JXHnNfdcL//N4rHx0l65U3DJcBWG9r /05ow1QL0JyCfyyM8BwLOcwQk4iXLyKhVP2ugw/GVENoFvlqEYLuAEwZWaN4xdb5tOso BrdddpgWY5MQd6vE5E1vvDCei9aXQ33pXX4DRda/2Cb/edAAppqYUeQTUovHf/imxgUn 8HEtnFGjkRUTNU7/VedNxBPamu0roEJ62hVQiVielth6cfOGMZNsoKwruErXRWvqwSIh RfUA==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PHxXhHC8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-169010-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169010-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [147.75.199.223]) by mx.google.com with ESMTPS id h19-20020a05620a401300b0078f1a2aa10bsi8091465qko.63.2024.05.05.07.30.45 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Sun, 05 May 2024 07:30:45 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-169010-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) client-ip=147.75.199.223; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=PHxXhHC8; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-169010-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.199.223 as permitted sender) smtp.mailfrom="linux-kernel+bounces-169010-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id AEC1A1C20E53 for ; Sun, 5 May 2024 14:30:45 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 9BBA36D1D7; Sun, 5 May 2024 14:28:23 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="PHxXhHC8" 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 9C4E8383A3; Sun, 5 May 2024 14:28:22 +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=1714919302; cv=none; b=pf2nOMiesVjC9/Vi2vcXWEfrEGIkcpvXkN4Of7h4kEYwuyyvTo1D1lUEz8zYLQI/t9CpGe/o5BfzWlZU/ky0YIWu0RtzTUhhTN4849SHlH/T+CGqsDjfBj9ag4gDlM9GF/TOupXwE9F1U2BGWVtnjCdtP3YRzYwYFC4nGsl4aVY= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1714919302; c=relaxed/simple; bh=baelIo5gqQ6dNoONu464d37hHX6/MoaALRFlqjsyJfc=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=S3W11RoIZwSFS84qQN5NSSYhF36xKSfH2JksMv7dE39kLYE14j2cs1PFQjeyAD6FriVh1d/fwp5PWT0coDpbQNt4YfHRVzpNNaXDfQWfF+QPEHs2lSR7kiWi/ySvoE0MtCIeJAekzby55k2rgQ0nvfhGkuuV5D6ybQZji3Z1k9A= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=PHxXhHC8; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id BB82EC113CC; Sun, 5 May 2024 14:28:10 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1714919302; bh=baelIo5gqQ6dNoONu464d37hHX6/MoaALRFlqjsyJfc=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=PHxXhHC8rkUDdApsaz0Wu8zNDhjBFugtbubfQQ0OsI7aJv0fGa07Rze4oulHLDC70 0hXVV4L414t9ApdglEOcQYUxLlA0gGWTAfPMDnUy8vxloxGJFdkem+KAomkNROY6bj SRqpls8Bx2IPzB0STr3+PyHq6T4lb6f/KFacw5kTWmVKX+CC5q5y8Xt7RmwKOjE3DT +qL5znqnDQe1s96fseldOv0anL7qPAl+ESMUzOwmNVdxiK48khpyQf6+jMayxQdqo8 SH++wVZDyGRgI4c2GQAtNnKM0Usl2Ss6TPPoKhMHWvJbn8cQB2jfMCYYNuovFqjpaM vOrKLdmFZ5l0w== 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 v8 10/17] arm64: extend execmem_info for generated code allocations Date: Sun, 5 May 2024 17:25:53 +0300 Message-ID: <20240505142600.2322517-11-rppt@kernel.org> X-Mailer: git-send-email 2.43.0 In-Reply-To: <20240505142600.2322517-1-rppt@kernel.org> References: <20240505142600.2322517-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