lkml.org 
[lkml]   [2014]   [Jul]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
SubjectRe: [PATCH ftrace/core v3 3/3] kprobes: Set IPMODIFY flag only if the probe can change regs->ip
Date
Hi Masami,

On Tue, 15 Jul 2014 06:00:35 +0000, Masami Hiramatsu wrote:
> +static int __ftrace_add_filter_ip(struct ftrace_ops *ops, unsigned long ip,
> + int *ref)
> +{
> + int ret;
> +
> + /* Try to set given ip to filter */
> + ret = ftrace_set_filter_ip(ops, ip, 0, 0);
> + if (ret < 0)
> + return ret;
> +
> + (*ref)++;
> + if (*ref == 1) {
> + ret = register_ftrace_function(ops);
> + if (ret < 0) {
> + /* Rollback refcounter and filter */
> + (*ref)--;
> + ftrace_set_filter_ip(ops, ip, 1, 0);
> + }
> + }
> +
> + return ret;
> +}

This function also can be changed in a similar way:

if (*ref == 0) {
ret = register_ftrace_function(ops);
if (ret < 0) {
/* Rollback filter if failed */
ftrace_set_filter_ip(ops, ip, 1, 0);
return ret;
}
}

(*ref)++;

return 0;


Thanks,
Namhyung



\
 
 \ /
  Last update: 2014-07-18 08:01    [W:0.114 / U:0.640 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site