[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20230517204505.f6411ff8ed3f782ae23e1af9@kernel.org>
Date: Wed, 17 May 2023 20:45:05 +0900
From: Masami Hiramatsu (Google) <mhiramat@...nel.org>
To: Dan Carpenter <dan.carpenter@...aro.org>
Cc: oe-kbuild@...ts.linux.dev, lkp@...el.com,
oe-kbuild-all@...ts.linux.dev, linux-kernel@...r.kernel.org,
"Steven Rostedt (Google)" <rostedt@...dmis.org>
Subject: Re: kernel/trace/fprobe.c:59 fprobe_handler() error: uninitialized
symbol 'ret'.
Hi Dan,
Sorry, I missed my fix :(
https://lore.kernel.org/all/168100731160.79534.374827110083836722.stgit@devnote2/
That will fix the problem, could you test it?
Thanks,
On Mon, 8 May 2023 08:17:09 +0300
Dan Carpenter <dan.carpenter@...aro.org> wrote:
> tree: https://git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git master
> head: 2e1e1337881b0e9844d687982aa54b31b1269b11
> commit: 39d954200bf6ad503c722e44d0be80c7b826fa42 fprobe: Skip exit_handler if entry_handler returns !0
> config: i386-randconfig-m041-20230501 (https://download.01.org/0day-ci/archive/20230506/202305061702.6h3JzCPA-lkp@intel.com/config)
> compiler: gcc-11 (Debian 11.3.0-12) 11.3.0
>
> If you fix the issue, kindly add following tag where applicable
> | Reported-by: kernel test robot <lkp@...el.com>
> | Reported-by: Dan Carpenter <error27@...il.com>
> | Link: https://lore.kernel.org/r/202305061702.6h3JzCPA-lkp@intel.com/
>
> smatch warnings:
> kernel/trace/fprobe.c:59 fprobe_handler() error: uninitialized symbol 'ret'.
>
> vim +/ret +59 kernel/trace/fprobe.c
>
> cad9931f64dc7f Masami Hiramatsu 2022-03-15 23 static void fprobe_handler(unsigned long ip, unsigned long parent_ip,
> cad9931f64dc7f Masami Hiramatsu 2022-03-15 24 struct ftrace_ops *ops, struct ftrace_regs *fregs)
> cad9931f64dc7f Masami Hiramatsu 2022-03-15 25 {
> 5b0ab78998e325 Masami Hiramatsu 2022-03-15 26 struct fprobe_rethook_node *fpr;
> 76d0de5729c056 Masami Hiramatsu (Google 2023-02-02 27) struct rethook_node *rh = NULL;
> cad9931f64dc7f Masami Hiramatsu 2022-03-15 28 struct fprobe *fp;
> 76d0de5729c056 Masami Hiramatsu (Google 2023-02-02 29) void *entry_data = NULL;
> 39d954200bf6ad Masami Hiramatsu (Google 2023-02-02 30) int bit, ret;
> cad9931f64dc7f Masami Hiramatsu 2022-03-15 31
> cad9931f64dc7f Masami Hiramatsu 2022-03-15 32 fp = container_of(ops, struct fprobe, ops);
> cad9931f64dc7f Masami Hiramatsu 2022-03-15 33 if (fprobe_disabled(fp))
> cad9931f64dc7f Masami Hiramatsu 2022-03-15 34 return;
> cad9931f64dc7f Masami Hiramatsu 2022-03-15 35
> cad9931f64dc7f Masami Hiramatsu 2022-03-15 36 bit = ftrace_test_recursion_trylock(ip, parent_ip);
> cad9931f64dc7f Masami Hiramatsu 2022-03-15 37 if (bit < 0) {
> cad9931f64dc7f Masami Hiramatsu 2022-03-15 38 fp->nmissed++;
> cad9931f64dc7f Masami Hiramatsu 2022-03-15 39 return;
> cad9931f64dc7f Masami Hiramatsu 2022-03-15 40 }
> cad9931f64dc7f Masami Hiramatsu 2022-03-15 41
> 5b0ab78998e325 Masami Hiramatsu 2022-03-15 42 if (fp->exit_handler) {
> 5b0ab78998e325 Masami Hiramatsu 2022-03-15 43 rh = rethook_try_get(fp->rethook);
> 5b0ab78998e325 Masami Hiramatsu 2022-03-15 44 if (!rh) {
> 5b0ab78998e325 Masami Hiramatsu 2022-03-15 45 fp->nmissed++;
> 5b0ab78998e325 Masami Hiramatsu 2022-03-15 46 goto out;
> 5b0ab78998e325 Masami Hiramatsu 2022-03-15 47 }
> 5b0ab78998e325 Masami Hiramatsu 2022-03-15 48 fpr = container_of(rh, struct fprobe_rethook_node, node);
> 5b0ab78998e325 Masami Hiramatsu 2022-03-15 49 fpr->entry_ip = ip;
> 76d0de5729c056 Masami Hiramatsu (Google 2023-02-02 50) if (fp->entry_data_size)
> 76d0de5729c056 Masami Hiramatsu (Google 2023-02-02 51) entry_data = fpr->data;
> 5b0ab78998e325 Masami Hiramatsu 2022-03-15 52 }
> 5b0ab78998e325 Masami Hiramatsu 2022-03-15 53
> 76d0de5729c056 Masami Hiramatsu (Google 2023-02-02 54) if (fp->entry_handler)
> 39d954200bf6ad Masami Hiramatsu (Google 2023-02-02 55) ret = fp->entry_handler(fp, ip, ftrace_get_regs(fregs), entry_data);
> 76d0de5729c056 Masami Hiramatsu (Google 2023-02-02 56)
> 39d954200bf6ad Masami Hiramatsu (Google 2023-02-02 57) /* If entry_handler returns !0, nmissed is not counted. */
> 39d954200bf6ad Masami Hiramatsu (Google 2023-02-02 58) if (rh) {
> 39d954200bf6ad Masami Hiramatsu (Google 2023-02-02 @59) if (ret)
>
> I reported this one earlier. The code assumes that if there is an
> -exit_handler there is also an ->entry_handler(). You had said you
> would just initialized ret = 0;
>
> 39d954200bf6ad Masami Hiramatsu (Google 2023-02-02 60) rethook_recycle(rh);
> 39d954200bf6ad Masami Hiramatsu (Google 2023-02-02 61) else
> 76d0de5729c056 Masami Hiramatsu (Google 2023-02-02 62) rethook_hook(rh, ftrace_get_regs(fregs), true);
> 39d954200bf6ad Masami Hiramatsu (Google 2023-02-02 63) }
> 5b0ab78998e325 Masami Hiramatsu 2022-03-15 64 out:
> cad9931f64dc7f Masami Hiramatsu 2022-03-15 65 ftrace_test_recursion_unlock(bit);
> cad9931f64dc7f Masami Hiramatsu 2022-03-15 66 }
>
> --
> 0-DAY CI Kernel Test Service
> https://github.com/intel/lkp-tests
>
--
Masami Hiramatsu (Google) <mhiramat@...nel.org>
Powered by blists - more mailing lists