[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20211025151517.f295f7804993e55997f0258f@kernel.org>
Date: Mon, 25 Oct 2021 15:15:17 +0900
From: Masami Hiramatsu <mhiramat@...nel.org>
To: Tiezhu Yang <yangtiezhu@...ngson.cn>
Cc: naveen.n.rao@...ux.ibm.com, anil.s.keshavamurthy@...el.com,
davem@...emloft.net, corbet@....net, ananth@...ibm.com,
akpm@...ux-foundation.org, randy.dunlap@...cle.com,
mathieu.desnoyers@...ymtl.ca, linux-doc@...r.kernel.org,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH 1/4] samples/kretprobes: Fix return value if
register_kretprobe() failed
On Mon, 25 Oct 2021 11:30:57 +0800
Tiezhu Yang <yangtiezhu@...ngson.cn> wrote:
> Use the actual return value instead of always -1 if register_kretprobe()
> failed.
>
> E.g. without this patch:
>
> # insmod samples/kprobes/kretprobe_example.ko func=no_such_func
> insmod: ERROR: could not insert module samples/kprobes/kretprobe_example.ko: Operation not permitted
>
> With this patch:
>
> # insmod samples/kprobes/kretprobe_example.ko func=no_such_func
> insmod: ERROR: could not insert module samples/kprobes/kretprobe_example.ko: Unknown symbol in module
>
> Fixes: 804defea1c02 ("Kprobes: move kprobe examples to samples/")
> Signed-off-by: Tiezhu Yang <yangtiezhu@...ngson.cn>
This looks good to me.
Acked-by: Masami Hiramatsu <mhiramat@...nel.org>
Thanks!
> ---
> samples/kprobes/kretprobe_example.c | 2 +-
> 1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/samples/kprobes/kretprobe_example.c b/samples/kprobes/kretprobe_example.c
> index 5dc1bf3..228321e 100644
> --- a/samples/kprobes/kretprobe_example.c
> +++ b/samples/kprobes/kretprobe_example.c
> @@ -86,7 +86,7 @@ static int __init kretprobe_init(void)
> ret = register_kretprobe(&my_kretprobe);
> if (ret < 0) {
> pr_err("register_kretprobe failed, returned %d\n", ret);
> - return -1;
> + return ret;
> }
> pr_info("Planted return probe at %s: %p\n",
> my_kretprobe.kp.symbol_name, my_kretprobe.kp.addr);
> --
> 2.1.0
>
--
Masami Hiramatsu <mhiramat@...nel.org>
Powered by blists - more mailing lists