Re: [PATCH 2/2] ftrace/x86/extable: Add is_ftrace_trampoline() function

From: Steven Rostedt
Date: Tue Nov 18 2014 - 23:15:42 EST


On Tue, 18 Nov 2014 22:33:33 -0500
Steven Rostedt <rostedt@xxxxxxxxxxx> wrote:


> +/*
> + * This is used by __kernel_text_address() to return true if the
> + * the address is on a dynamically allocated trampoline that would
> + * not return true for either core_kernel_text() or
> + * is_module_text_address().
> + */
> +bool is_ftrace_trampoline(unsigned long addr)
> +{
> + struct ftrace_ops *op;
> +
> + do_for_each_ftrace_op(op, ftrace_ops_list) {
> + /*
> + * This is to check for dynamically allocated trampolines.
> + * Trampolines that are in kernel text will have
> + * core_kernel_text() return true.
> + */
> + if (op->trampoline && op->trampoline_size)
> + if (addr >= op->trampoline &&
> + addr < op->trampoline + op->trampoline_size)
> + return true;
> + } while_for_each_ftrace_op(op);
> +
> + return false;
> +}
> +

Hmm, preemption should be disabled here. We can't guarantee that the
caller will have that. Will update.

-- Steve
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/