Re: [RFC] apparent bogosity in unregister_ftrace_function_probe_func()

From: Masami Hiramatsu
Date: Mon Jan 29 2018 - 08:49:56 EST


On Sat, 27 Jan 2018 03:17:06 +0000
Al Viro <viro@xxxxxxxxxxxxxxxxxx> wrote:

> It contains something very odd:
>
> func_g.type = filter_parse_regex(glob, strlen(glob),
> &func_g.search, &not);
> func_g.len = strlen(func_g.search);
> func_g.search = glob;
>
> /* we do not support '!' for function probes */
> if (WARN_ON(not))
> return -EINVAL;
>
> What the hell is the last assignment for? After that call of
> filter_parse_regex() we could have func_g.search not equal to glob
> only if glob started with '!' or '*'. In the former case we would've
> buggered off with -EINVAL (not = 1). In the latter we would've set
> func_g.search equal to glob + 1, calculated the length of that thing
> in func_g.len and proceeded to reset func_g.search back to glob.

Ah, right. It must be a bug! func_g.search should be assigned in
filter_parse_regex(), and it should be "glob" without "!" if
it is MATCH_GLOB. Of course above assignment should be removed.

Thank you,

--
Masami Hiramatsu <mhiramat@xxxxxxxxxx>