Received: by 2002:ab2:6857:0:b0:1ef:ffd0:ce49 with SMTP id l23csp3458912lqp; Tue, 26 Mar 2024 09:37:26 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCWk9IpEdyyOQi3fo/Fg6esvw+wwIccUHgBjR3nQa50U25v6DuF3ryowEKWNRqRNbYZyyAiryyq5uBdgob4qx/haKHlc7dGrddnnG4dXMA== X-Google-Smtp-Source: AGHT+IGAUGj50MKUL8HZuxOaoIy6xH6ykV/osYkj8zmBpc7PVu7RHuo7k3YvhwBIsXQhSVKcFVss X-Received: by 2002:a50:cd52:0:b0:568:aced:e5a0 with SMTP id d18-20020a50cd52000000b00568acede5a0mr1930676edj.14.1711471045847; Tue, 26 Mar 2024 09:37:25 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1711471045; cv=pass; d=google.com; s=arc-20160816; b=stRHPDLFuGIKG7H41W6qdjMTnrnyBfeBDKhoziY6GkpLAIulFdOAYkbHBoZRn/aFqQ mhCkAKxgyt+nc89uNNmp8RpdL8xXltiOb7D51JxA63hbvYnMFWwFSl0fwR0UjQwvfhOx hxLW9Egk4a3wkX0YQ7fkTZ3C6pkT4lyiwSmJhNef/WO5aGLXfwfAeOA+uo0A173TrLO7 IDvHnYKLxfaVy2euRQ+8pmfT66gtsaeU4MAl5v5Du7DCR3RMFcs1XqortmdZ6S9/fRBv lWqpDsN4kNwbul8AieTOfxPZuMToaNHmupU4RXMppd8MizY2SxR7vTtkkai8vc3Araw2 Ll7g== 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; bh=9itvCjSTMviL+UndwQHHomrpAPTWaiAAHnRSebK0YP0=; fh=w7YXUMcqrOjR/8VGLlv9ETX6AnNVBK+vVFN7UOZS5uE=; b=wzyHRtGimTa8Yr+eiWcxFv5P4QOGkttJRxhQaebGN6cgNCLPpOlejC6XRxkYGBqMFy lbOMx6NCPbEX/FMkGXSrMFeakxp/5SwmYziBqv1UO92YW6aHkrTsMnRc/D6xoAcHe/2v bvd25L51lhwwkLV72qwtn8Pgutwdw89RutVyxSKsfLYN0lZTvJlzThdewUyOaaNSdW18 3ykPkd6TnoH6YrJVZ7toj2DLQ2RW+lsX9dYLcVSUxvn6gfQ0Eb+an4+Mlu3zui/IaopV R0wCEr0Fde+x8gRjG7jwfVOw08KxzaUFSGakLPgKF3KbboxGYsUHBXAthq7UTMQKQn6N B4Gg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-119479-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119479-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id ew4-20020a056402538400b0056c1891b0d6si1654835edb.469.2024.03.26.09.37.25 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 26 Mar 2024 09:37:25 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-119479-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; arc=pass (i=1 spf=pass spfdomain=arm.com dmarc=pass fromdomain=arm.com); spf=pass (google.com: domain of linux-kernel+bounces-119479-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-119479-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=fail (p=NONE sp=NONE dis=NONE) header.from=arm.com 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 am.mirrors.kernel.org (Postfix) with ESMTPS id 66C341F64B2E for ; Tue, 26 Mar 2024 16:37:04 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 15CFC14A82; Tue, 26 Mar 2024 16:36:44 +0000 (UTC) Received: from foss.arm.com (foss.arm.com [217.140.110.172]) by smtp.subspace.kernel.org (Postfix) with ESMTP id A70B01C694 for ; Tue, 26 Mar 2024 16:36:40 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=217.140.110.172 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711471003; cv=none; b=GEgkNyIlnsTX3qYMWo8fPCAdq0+T0jZE1zPLH8JEQVsMQpfuCTGX5CX4Y5CzuSxAPsQOAYaS3etORDHBvm9a3U9R6TD6PqfTExdaPxWx6xUxqN0UfCZ16FCF8evMwdhrmMNEQEgxYcgiP7pGpxOmupd3aD9NzwLYZuqXf2wivKE= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1711471003; c=relaxed/simple; bh=6l3ztR+na6fIJOI07vhVnE8PPwhW1EVFzqZBqt5/uwk=; h=From:To:Cc:Subject:Date:Message-Id:In-Reply-To:References: MIME-Version; b=E1cYZUzVVF43S4Uk2vGZLej/Y/NmPSmO5UXXpJFrAuOgoF2ksbVUwjHjSEtIhTBYjt50dY3kNxUOIM8125rSi4YzjcNEfm05/4ZIUPnjcX7FGQlskKFQasNHw5FMQtVz32di0bUfn93aAInhA89idGNU4DgBiT4J5sZfzqlfq6k= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com; spf=pass smtp.mailfrom=arm.com; arc=none smtp.client-ip=217.140.110.172 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=arm.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=arm.com 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 D1C52113E; Tue, 26 Mar 2024 09:37:13 -0700 (PDT) Received: from lakrids.cambridge.arm.com (usa-sjc-imap-foss1.foss.arm.com [10.121.207.14]) by usa-sjc-imap-foss1.foss.arm.com (Postfix) with ESMTPA id 9002F3F694; Tue, 26 Mar 2024 09:36:37 -0700 (PDT) From: Mark Rutland To: linux-kernel@vger.kernel.org Cc: agordeev@linux.ibm.com, anil.s.keshavamurthy@intel.com, aou@eecs.berkeley.edu, bp@alien8.de, catalin.marinas@arm.com, dave.hansen@linux.intel.com, davem@davemloft.net, gor@linux.ibm.com, hca@linux.ibm.com, jarkko@kernel.org, jcalvinowens@gmail.com, linux-arm-kernel@lists.infradead.org, mark.rutland@arm.com, mhiramat@kernel.org, mingo@redhat.com, mpe@ellerman.id.au, naveen.n.rao@linux.ibm.com, palmer@dabbelt.com, paul.walmsley@sifive.com, tglx@linutronix.de, will@kernel.org Subject: [PATCH 2/4] kprobes/treewide: Add kprobes_ prefix to insn alloc/free functions Date: Tue, 26 Mar 2024 16:36:22 +0000 Message-Id: <20240326163624.3253157-3-mark.rutland@arm.com> X-Mailer: git-send-email 2.30.2 In-Reply-To: <20240326163624.3253157-1-mark.rutland@arm.com> References: <20240326163624.3253157-1-mark.rutland@arm.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit The alloc_(opt)insn_page() and free_(opt)insn_page() functions are specific to KPROBES, but their name makes them sound more generic than they are. Given them a 'kprobes_' prefix to make it clear that they're part of kprobes. This was generated automatically with: sed -i 's/alloc_insn_page/kprobes_alloc_insn_page/' $(git grep -l 'alloc_insn_page') sed -i 's/free_insn_page/kprobes_free_insn_page/' $(git grep -l 'free_insn_page') sed -i 's/alloc_optinsn_page/kprobes_alloc_optinsn_page/' $(git grep -l 'alloc_optinsn_page') sed -i 's/free_optinsn_page/kprobes_free_optinsn_page/' $(git grep -l 'free_optinsn_page') There should be no functional change as a result of this patch. Signed-off-by: Mark Rutland Cc: Anil S Keshavamurthy Cc: David S. Miller Cc: Jarkko Sakkinen Cc: Masami Hiramatsu Cc: Naveen N. Rao --- arch/arm64/kernel/probes/kprobes.c | 2 +- arch/powerpc/kernel/kprobes.c | 2 +- arch/powerpc/kernel/optprobes.c | 4 ++-- arch/riscv/kernel/probes/kprobes.c | 2 +- arch/s390/kernel/kprobes.c | 2 +- arch/x86/kernel/kprobes/core.c | 2 +- include/linux/kprobes.h | 6 +++--- kernel/kprobes.c | 20 ++++++++++---------- 8 files changed, 20 insertions(+), 20 deletions(-) diff --git a/arch/arm64/kernel/probes/kprobes.c b/arch/arm64/kernel/probes/kprobes.c index 327855a11df2f..4b6ab7b1fa211 100644 --- a/arch/arm64/kernel/probes/kprobes.c +++ b/arch/arm64/kernel/probes/kprobes.c @@ -129,7 +129,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) return 0; } -void *alloc_insn_page(void) +void *kprobes_alloc_insn_page(void) { return __vmalloc_node_range(PAGE_SIZE, 1, VMALLOC_START, VMALLOC_END, GFP_KERNEL, PAGE_KERNEL_ROX, VM_FLUSH_RESET_PERMS, diff --git a/arch/powerpc/kernel/kprobes.c b/arch/powerpc/kernel/kprobes.c index bbca90a5e2ec0..0b297718d5de6 100644 --- a/arch/powerpc/kernel/kprobes.c +++ b/arch/powerpc/kernel/kprobes.c @@ -126,7 +126,7 @@ kprobe_opcode_t *arch_adjust_kprobe_addr(unsigned long addr, unsigned long offse return (kprobe_opcode_t *)(addr + offset); } -void *alloc_insn_page(void) +void *kprobes_alloc_insn_page(void) { void *page; diff --git a/arch/powerpc/kernel/optprobes.c b/arch/powerpc/kernel/optprobes.c index 004fae2044a3e..0ddbda217073f 100644 --- a/arch/powerpc/kernel/optprobes.c +++ b/arch/powerpc/kernel/optprobes.c @@ -27,7 +27,7 @@ static bool insn_page_in_use; -void *alloc_optinsn_page(void) +void *kprobes_alloc_optinsn_page(void) { if (insn_page_in_use) return NULL; @@ -35,7 +35,7 @@ void *alloc_optinsn_page(void) return &optinsn_slot; } -void free_optinsn_page(void *page) +void kprobes_free_optinsn_page(void *page) { insn_page_in_use = false; } diff --git a/arch/riscv/kernel/probes/kprobes.c b/arch/riscv/kernel/probes/kprobes.c index 2f08c14a933d0..75201ce721057 100644 --- a/arch/riscv/kernel/probes/kprobes.c +++ b/arch/riscv/kernel/probes/kprobes.c @@ -105,7 +105,7 @@ int __kprobes arch_prepare_kprobe(struct kprobe *p) } #ifdef CONFIG_MMU -void *alloc_insn_page(void) +void *kprobes_alloc_insn_page(void) { return __vmalloc_node_range(PAGE_SIZE, 1, VMALLOC_START, VMALLOC_END, GFP_KERNEL, PAGE_KERNEL_READ_EXEC, diff --git a/arch/s390/kernel/kprobes.c b/arch/s390/kernel/kprobes.c index f0cf20d4b3c58..91ca4d501d4ef 100644 --- a/arch/s390/kernel/kprobes.c +++ b/arch/s390/kernel/kprobes.c @@ -34,7 +34,7 @@ struct kretprobe_blackpoint kretprobe_blacklist[] = { }; static int insn_page_in_use; -void *alloc_insn_page(void) +void *kprobes_alloc_insn_page(void) { void *page; diff --git a/arch/x86/kernel/kprobes/core.c b/arch/x86/kernel/kprobes/core.c index d0e49bd7c6f3f..7f01bbbfa9e2a 100644 --- a/arch/x86/kernel/kprobes/core.c +++ b/arch/x86/kernel/kprobes/core.c @@ -491,7 +491,7 @@ static int prepare_singlestep(kprobe_opcode_t *buf, struct kprobe *p, } /* Make page to RO mode when allocate it */ -void *alloc_insn_page(void) +void *kprobes_alloc_insn_page(void) { void *page; diff --git a/include/linux/kprobes.h b/include/linux/kprobes.h index 0ff44d6633e33..ad4b561100f9e 100644 --- a/include/linux/kprobes.h +++ b/include/linux/kprobes.h @@ -430,10 +430,10 @@ int enable_kprobe(struct kprobe *kp); void dump_kprobe(struct kprobe *kp); -void *alloc_insn_page(void); +void *kprobes_alloc_insn_page(void); -void *alloc_optinsn_page(void); -void free_optinsn_page(void *page); +void *kprobes_alloc_optinsn_page(void); +void kprobes_free_optinsn_page(void *page); int kprobe_get_kallsym(unsigned int symnum, unsigned long *value, char *type, char *sym); diff --git a/kernel/kprobes.c b/kernel/kprobes.c index 9d9095e817928..35adf56430c9b 100644 --- a/kernel/kprobes.c +++ b/kernel/kprobes.c @@ -110,7 +110,7 @@ enum kprobe_slot_state { SLOT_USED = 2, }; -void __weak *alloc_insn_page(void) +void __weak *kprobes_alloc_insn_page(void) { /* * Use module_alloc() so this page is within +/- 2GB of where the @@ -121,15 +121,15 @@ void __weak *alloc_insn_page(void) return module_alloc(PAGE_SIZE); } -static void free_insn_page(void *page) +static void kprobes_free_insn_page(void *page) { module_memfree(page); } struct kprobe_insn_cache kprobe_insn_slots = { .mutex = __MUTEX_INITIALIZER(kprobe_insn_slots.mutex), - .alloc = alloc_insn_page, - .free = free_insn_page, + .alloc = kprobes_alloc_insn_page, + .free = kprobes_free_insn_page, .sym = KPROBE_INSN_PAGE_SYM, .pages = LIST_HEAD_INIT(kprobe_insn_slots.pages), .insn_size = MAX_INSN_SIZE, @@ -333,21 +333,21 @@ int kprobe_cache_get_kallsym(struct kprobe_insn_cache *c, unsigned int *symnum, } #ifdef CONFIG_OPTPROBES -void __weak *alloc_optinsn_page(void) +void __weak *kprobes_alloc_optinsn_page(void) { - return alloc_insn_page(); + return kprobes_alloc_insn_page(); } -void __weak free_optinsn_page(void *page) +void __weak kprobes_free_optinsn_page(void *page) { - free_insn_page(page); + kprobes_free_insn_page(page); } /* For optimized_kprobe buffer */ struct kprobe_insn_cache kprobe_optinsn_slots = { .mutex = __MUTEX_INITIALIZER(kprobe_optinsn_slots.mutex), - .alloc = alloc_optinsn_page, - .free = free_optinsn_page, + .alloc = kprobes_alloc_optinsn_page, + .free = kprobes_free_optinsn_page, .sym = KPROBE_OPTINSN_PAGE_SYM, .pages = LIST_HEAD_INIT(kprobe_optinsn_slots.pages), /* .insn_size is initialized later */ -- 2.30.2