[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20250526184700.GS24938@noisy.programming.kicks-ass.net>
Date: Mon, 26 May 2025 20:47:00 +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 52/62] objtool/klp: Introduce klp diff subcommand for
diffing object files
On Fri, May 09, 2025 at 01:17:16PM -0700, Josh Poimboeuf wrote:
> +#define SEC_NAME_LEN 512
> #define SYM_NAME_LEN 512
>
> +static int validate_ffunction_fdata_sections(struct elf *elf)
> +{
> + struct symbol *sym;
> + bool found_text = false, found_data = false;
> +
> + for_each_sym(elf, sym) {
> + char sec_name[SEC_NAME_LEN];
> +
> + if (!found_text && is_func_sym(sym)) {
> + snprintf(sec_name, SEC_NAME_LEN, ".text.%s", sym->name);
So given SYM_NAME_LEN is 512, this SEC_NAME_LEN should be at least 6
more, no?
> + if (!strcmp(sym->sec->name, sec_name))
> + found_text = true;
> + }
> +
> + if (!found_data && is_object_sym(sym)) {
> + snprintf(sec_name, SEC_NAME_LEN, ".data.%s", sym->name);
> + if (!strcmp(sym->sec->name, sec_name))
> + found_data = true;
> + }
> +
> + if (found_text && found_data)
> + return 0;
> + }
> +
> + ERROR("changed object '%s' not built with -ffunction-sections and -fdata-sections", elf->name);
> + return -1;
> +}
Powered by blists - more mailing lists