All of lore.kernel.org
 help / color / mirror / Atom feed
From: Namhyung Kim <namhyung@gmail.com>
To: Masami Hiramatsu <masami.hiramatsu.pt@hitachi.com>
Cc: Steven Rostedt <rostedt@goodmis.org>,
	Josh Poimboeuf <jpoimboe@redhat.com>,
	Ingo Molnar <mingo@kernel.org>,
	Ananth N Mavinakayanahalli <ananth@in.ibm.com>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH ftrace/core v3 3/3] kprobes: Set IPMODIFY flag only if the probe can change regs->ip
Date: Fri, 18 Jul 2014 14:32:07 +0900	[thread overview]
Message-ID: <878unrkzag.fsf@sejong.aot.lge.com> (raw)
In-Reply-To: <20140715060035.12195.47782.stgit@kbuild-fedora.novalocal> (Masami Hiramatsu's message of "Tue, 15 Jul 2014 06:00:35 +0000")

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


  reply	other threads:[~2014-07-18  5:32 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2014-07-15  6:00 [PATCH ftrace/core v3 0/3] ftrace, kprobes: Introduce IPMODIFY flag for ftrace_ops to detect conflicts Masami Hiramatsu
2014-07-15  6:00 ` [PATCH ftrace/core v3 1/3] [BUGFIX]kprobes/ftrace: Recover original IP if pre_handler doesn't change it Masami Hiramatsu
2014-07-17 18:21   ` Steven Rostedt
2014-07-18  1:47     ` Masami Hiramatsu
2014-07-15  6:00 ` [PATCH ftrace/core v3 2/3] ftrace, kprobes: Support IPMODIFY flag to find IP modify conflict Masami Hiramatsu
2014-07-17 18:41   ` Steven Rostedt
2014-07-18  7:09     ` Masami Hiramatsu
2014-07-18 13:51       ` Steven Rostedt
2014-07-20  3:19         ` Masami Hiramatsu
2014-07-15  6:00 ` [PATCH ftrace/core v3 3/3] kprobes: Set IPMODIFY flag only if the probe can change regs->ip Masami Hiramatsu
2014-07-18  5:32   ` Namhyung Kim [this message]
2014-07-18  7:10     ` Masami Hiramatsu

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=878unrkzag.fsf@sejong.aot.lge.com \
    --to=namhyung@gmail.com \
    --cc=ananth@in.ibm.com \
    --cc=jpoimboe@redhat.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=masami.hiramatsu.pt@hitachi.com \
    --cc=mingo@kernel.org \
    --cc=rostedt@goodmis.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.