[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250526104355.GM24938@noisy.programming.kicks-ass.net>
Date: Mon, 26 May 2025 12:43:55 +0200
From: Peter Zijlstra <peterz@...radead.org>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: x86@...nel.org, linux-kernel@...r.kernel.org,
Petr Mladek <pmladek@...e.com>, Miroslav Benes <mbenes@...e.cz>,
Joe Lawrence <joe.lawrence@...hat.com>,
live-patching@...r.kernel.org, Song Liu <song@...nel.org>,
laokz <laokz@...mail.com>, Jiri Kosina <jikos@...nel.org>,
Marcos Paulo de Souza <mpdesouza@...e.com>,
Weinan Liu <wnliu@...gle.com>,
Fazla Mehrab <a.mehrab@...edance.com>,
Chen Zhongjin <chenzhongjin@...wei.com>,
Puranjay Mohan <puranjay@...nel.org>
Subject: Re: [PATCH v2 29/62] objtool: Mark prefix functions
On Fri, May 09, 2025 at 01:16:53PM -0700, Josh Poimboeuf wrote:
> In preparation for the objtool klp diff subcommand, introduce a flag to
> identify __pfx_*() and __cfi_*() functions in advance so they don't need
> to be manually identified every time a check is needed.
>
> Signed-off-by: Josh Poimboeuf <jpoimboe@...nel.org>
> ---
> tools/objtool/check.c | 3 +--
> tools/objtool/elf.c | 5 +++++
> tools/objtool/include/objtool/elf.h | 6 ++++++
> 3 files changed, 12 insertions(+), 2 deletions(-)
>
> diff --git a/tools/objtool/check.c b/tools/objtool/check.c
> index a2a025ec57e8..6b2e57d9aaf8 100644
> --- a/tools/objtool/check.c
> +++ b/tools/objtool/check.c
> @@ -3601,8 +3601,7 @@ static int validate_branch(struct objtool_file *file, struct symbol *func,
>
> if (func && insn_func(insn) && func != insn_func(insn)->pfunc) {
> /* Ignore KCFI type preambles, which always fall through */
> - if (!strncmp(func->name, "__cfi_", 6) ||
> - !strncmp(func->name, "__pfx_", 6))
> + if (is_prefix_func(func))
> return 0;
>
> if (file->ignore_unreachables)
> diff --git a/tools/objtool/elf.c b/tools/objtool/elf.c
> index 59568381486c..9a1fc0392b7f 100644
> --- a/tools/objtool/elf.c
> +++ b/tools/objtool/elf.c
> @@ -442,6 +442,11 @@ static void elf_add_symbol(struct elf *elf, struct symbol *sym)
> elf_hash_add(symbol, &sym->hash, sym->idx);
> elf_hash_add(symbol_name, &sym->name_hash, str_hash(sym->name));
>
> + if (is_func_sym(sym) && sym->len == 16 &&
Where did that 'sym->len == 16' thing come from? I mean, they are, but
the old code didn't assert that.
I would rather objtool issue a warn if not 16, but still consider these
as prefix.
> + (strstarts(sym->name, "__pfx") || strstarts(sym->name, "__cfi_")))
> + sym->prefix = 1;
> +
> +
> if (is_func_sym(sym) && strstr(sym->name, ".cold"))
> sym->cold = 1;
> sym->pfunc = sym->cfunc = sym;
Powered by blists - more mailing lists