Skip to content

Commit 213f891

Browse files
committed
Merge tag 'probes-fixes-v6.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace
Pull probes fixes from Masami Hiramatsu: - Fix fprobe document to add a new ret_ip parameter for callback functions. This has been introduced in v6.5 but the document was not updated. - Fix fprobe to check the number of active retprobes is not zero. This number is passed from parameter or calculated by the parameter and it can be zero which is not acceptable. But current code only check it is not minus. * tag 'probes-fixes-v6.6-rc6' of git://git.kernel.org/pub/scm/linux/kernel/git/trace/linux-trace: fprobe: Fix to ensure the number of active retprobes is not zero Documentation: probes: Add a new ret_ip callback parameter
2 parents 86d6a62 + 700b2b4 commit 213f891

File tree

2 files changed

+9
-5
lines changed

2 files changed

+9
-5
lines changed

Documentation/trace/fprobe.rst

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,9 +91,9 @@ The prototype of the entry/exit callback function are as follows:
9191

9292
.. code-block:: c
9393
94-
int entry_callback(struct fprobe *fp, unsigned long entry_ip, struct pt_regs *regs, void *entry_data);
94+
int entry_callback(struct fprobe *fp, unsigned long entry_ip, unsigned long ret_ip, struct pt_regs *regs, void *entry_data);
9595
96-
void exit_callback(struct fprobe *fp, unsigned long entry_ip, struct pt_regs *regs, void *entry_data);
96+
void exit_callback(struct fprobe *fp, unsigned long entry_ip, unsigned long ret_ip, struct pt_regs *regs, void *entry_data);
9797
9898
Note that the @entry_ip is saved at function entry and passed to exit handler.
9999
If the entry callback function returns !0, the corresponding exit callback will be cancelled.
@@ -108,6 +108,10 @@ If the entry callback function returns !0, the corresponding exit callback will
108108
Note that this may not be the actual entry address of the function but
109109
the address where the ftrace is instrumented.
110110

111+
@ret_ip
112+
This is the return address that the traced function will return to,
113+
somewhere in the caller. This can be used at both entry and exit.
114+
111115
@regs
112116
This is the `pt_regs` data structure at the entry and exit. Note that
113117
the instruction pointer of @regs may be different from the @entry_ip

kernel/trace/fprobe.c

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -189,7 +189,7 @@ static int fprobe_init_rethook(struct fprobe *fp, int num)
189189
{
190190
int i, size;
191191

192-
if (num < 0)
192+
if (num <= 0)
193193
return -EINVAL;
194194

195195
if (!fp->exit_handler) {
@@ -202,8 +202,8 @@ static int fprobe_init_rethook(struct fprobe *fp, int num)
202202
size = fp->nr_maxactive;
203203
else
204204
size = num * num_possible_cpus() * 2;
205-
if (size < 0)
206-
return -E2BIG;
205+
if (size <= 0)
206+
return -EINVAL;
207207

208208
fp->rethook = rethook_alloc((void *)fp, fprobe_exit_handler);
209209
if (!fp->rethook)

0 commit comments

Comments
 (0)