From: Masami Hiramatsu <mhiramat@kernel.org>
To: Sven Schnelle <svens@stackframe.org>
Cc: linux-kernel@vger.kernel.org,
"Naveen N. Rao" <naveen.n.rao@linux.ibm.com>,
Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>,
"David S. Miller" <davem@davemloft.net>,
Masami Hiramatsu <mhiramat@kernel.org>
Subject: Re: [PATCH] kprobes: fix compilation when KPROBE_EVENTS is enabled without kretpobes
Date: Mon, 8 Apr 2019 09:55:19 +0900 [thread overview]
Message-ID: <20190408095519.751c13615842a077745f3914@kernel.org> (raw)
In-Reply-To: <20190406155543.15353-1-svens@stackframe.org>
On Sat, 6 Apr 2019 17:55:43 +0200
Sven Schnelle <svens@stackframe.org> wrote:
> 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.
Ah, I got it. Yes, this function had been introduced for kretprobe (because
kretprobe must be the entry of functions) but is used for kprobe_event and
bpf now.
It should be moved out of CONFIG_KPROBE_EVENTS.
Acked-by: Masami Hiramatsu <mhiramat@kernel.org>
Thank you,
>
> Signed-off-by: Sven Schnelle <svens@stackframe.org>
> Cc: "Naveen N. Rao" <naveen.n.rao@linux.ibm.com>
> Cc: Anil S Keshavamurthy <anil.s.keshavamurthy@intel.com>
> Cc: "David S. Miller" <davem@davemloft.net>
> Cc: Masami Hiramatsu <mhiramat@kernel.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
>
--
Masami Hiramatsu <mhiramat@kernel.org>
prev parent reply other threads:[~2019-04-08 0:55 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2019-04-06 15:55 Sven Schnelle
2019-04-06 17:22 ` Naveen N. Rao
2019-04-06 17:42 ` Sven Schnelle
2019-04-08 0:55 ` Masami Hiramatsu [this message]
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20190408095519.751c13615842a077745f3914@kernel.org \
--to=mhiramat@kernel.org \
--cc=anil.s.keshavamurthy@intel.com \
--cc=davem@davemloft.net \
--cc=linux-kernel@vger.kernel.org \
--cc=naveen.n.rao@linux.ibm.com \
--cc=svens@stackframe.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
Powered by JetHome