[<prev] [next>] [thread-next>] [day] [month] [year] [list]
Message-Id: <20190406155543.15353-1-svens@stackframe.org>
Date: Sat, 6 Apr 2019 17:55:43 +0200
From: Sven Schnelle <svens@...ckframe.org>
To: linux-kernel@...r.kernel.org
Cc: Sven Schnelle <svens@...ckframe.org>,
"Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>,
Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>,
"David S. Miller" <davem@...emloft.net>,
Masami Hiramatsu <mhiramat@...nel.org>
Subject: [PATCH] kprobes: fix compilation when KPROBE_EVENTS is enabled without kretpobes
While implementing kprobes on PA-RISC (without kretprobes) compilation
fails when CONFIG_KPROBE_EVENTS is enabled:
kernel/trace/trace_kprobe.o: in function `trace_kprobe_create':
kernel/trace/trace_kprobe.c:666: undefined reference to `kprobe_on_func_entry'
kernel/trace/trace_kprobe.o: in function `trace_kprobe_on_func_entry':
kernel/trace/trace_kprobe.c:167: undefined reference to `kprobe_on_func_entry'
kernel/trace/trace_kprobe.c:167: undefined reference to `kprobe_on_func_entry'
make: *** [Makefile:1029: vmlinux] Error 1
Given the fact that these functions have no dependencies on kretprobes i think
they should be moved out of the #ifdef CONFIG_KRETPROBES block.
Signed-off-by: Sven Schnelle <svens@...ckframe.org>
Cc: "Naveen N. Rao" <naveen.n.rao@...ux.ibm.com>
Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@...el.com>
Cc: "David S. Miller" <davem@...emloft.net>
Cc: Masami Hiramatsu <mhiramat@...nel.org>
---
kernel/kprobes.c | 39 ++++++++++++++++++++-------------------
1 file changed, 20 insertions(+), 19 deletions(-)
diff --git a/kernel/kprobes.c b/kernel/kprobes.c
index c83e54727131..10a7e67fea67 100644
--- a/kernel/kprobes.c
+++ b/kernel/kprobes.c
@@ -1819,6 +1819,26 @@ unsigned long __weak arch_deref_entry_point(void *entry)
return (unsigned long)entry;
}
+bool __weak arch_kprobe_on_func_entry(unsigned long offset)
+{
+ return !offset;
+}
+
+bool kprobe_on_func_entry(kprobe_opcode_t *addr, const char *sym,
+ unsigned long offset)
+{
+ kprobe_opcode_t *kp_addr = _kprobe_addr(addr, sym, offset);
+
+ if (IS_ERR(kp_addr))
+ return false;
+
+ if (!kallsyms_lookup_size_offset((unsigned long)kp_addr, NULL, &offset) ||
+ !arch_kprobe_on_func_entry(offset))
+ return false;
+
+ return true;
+}
+
#ifdef CONFIG_KRETPROBES
/*
* This kprobe pre_handler is registered with every kretprobe. When probe
@@ -1875,25 +1895,6 @@ static int pre_handler_kretprobe(struct kprobe *p, struct pt_regs *regs)
}
NOKPROBE_SYMBOL(pre_handler_kretprobe);
-bool __weak arch_kprobe_on_func_entry(unsigned long offset)
-{
- return !offset;
-}
-
-bool kprobe_on_func_entry(kprobe_opcode_t *addr, const char *sym, unsigned long offset)
-{
- kprobe_opcode_t *kp_addr = _kprobe_addr(addr, sym, offset);
-
- if (IS_ERR(kp_addr))
- return false;
-
- if (!kallsyms_lookup_size_offset((unsigned long)kp_addr, NULL, &offset) ||
- !arch_kprobe_on_func_entry(offset))
- return false;
-
- return true;
-}
-
int register_kretprobe(struct kretprobe *rp)
{
int ret = 0;
--
2.20.1
Powered by blists - more mailing lists