[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20220223074139.161acfd0@rorschach.local.home>
Date: Wed, 23 Feb 2022 07:41:39 -0500
From: Steven Rostedt <rostedt@...dmis.org>
To: Peter Zijlstra <peterz@...radead.org>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>, x86@...nel.org,
joao@...rdrivepizza.com, hjl.tools@...il.com,
andrew.cooper3@...rix.com, linux-kernel@...r.kernel.org,
ndesaulniers@...gle.com, keescook@...omium.org,
samitolvanen@...gle.com, mark.rutland@....com,
alyssa.milburn@...el.com, Miroslav Benes <mbenes@...e.cz>
Subject: Re: [PATCH 04/29] x86/livepatch: Validate __fentry__ location
On Wed, 23 Feb 2022 11:57:26 +0100
Peter Zijlstra <peterz@...radead.org> wrote:
> --- a/kernel/trace/ftrace.c
> +++ b/kernel/trace/ftrace.c
> @@ -1578,7 +1578,23 @@ unsigned long ftrace_location_range(unsi
> */
> unsigned long ftrace_location(unsigned long ip)
> {
> - return ftrace_location_range(ip, ip);
> + struct dyn_ftrace *rec;
> + unsigned long offset;
> + unsigned long size;
> +
> + rec = lookup_rec(ip, ip);
> + if (!rec) {
> + if (!kallsyms_lookup_size_offset(ip, &size, &offset))
> + goto out;
> +
> + rec = lookup_rec(ip - offset, (ip - offset) + size);
> + }
> +
Please create a new function for this. Perhaps find_ftrace_location().
ftrace_location() is used to see if the address given is a ftrace
nop or not. This change will make it always return true.
-- Steve
Powered by blists - more mailing lists