[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <30b09639-42e3-48f5-8e7a-12d2589f20e4@suse.com>
Date: Thu, 22 Jan 2026 09:34:20 +0100
From: Petr Pavlu <petr.pavlu@...e.com>
To: Josh Poimboeuf <jpoimboe@...nel.org>
Cc: Jiri Kosina <jikos@...nel.org>, Miroslav Benes <mbenes@...e.cz>,
Petr Mladek <pmladek@...e.com>, Joe Lawrence <joe.lawrence@...hat.com>,
Luis Chamberlain <mcgrof@...nel.org>, Daniel Gomez <da.gomez@...nel.org>,
Sami Tolvanen <samitolvanen@...gle.com>, Aaron Tomlin <atomlin@...mlin.com>,
Peter Zijlstra <peterz@...radead.org>, live-patching@...r.kernel.org,
linux-modules@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v2 1/2] livepatch: Fix having __klp_objects relics in
non-livepatch modules
On 1/21/26 10:04 PM, Josh Poimboeuf wrote:
> On Wed, Jan 21, 2026 at 09:28:16AM +0100, Petr Pavlu wrote:
>> +void *klp_locate_section_objs(const struct module *mod, const char *name,
>> + size_t object_size, unsigned int *nr_objs)
>> +{
>> + struct klp_modinfo *info = mod->klp_info;
>> +
>> + for (int i = 1; i < info->hdr.e_shnum; i++) {
>> + Elf_Shdr *shdr = &info->sechdrs[i];
>> +
>> + if (strcmp(info->secstrings + shdr->sh_name, name))
>> + continue;
>> +
>> + *nr_objs = shdr->sh_size / object_size;
>> + return (void *)shdr->sh_addr;
>> + }
>> +
>> + *nr_objs = 0;
>> + return NULL;
>> +}
>> +EXPORT_SYMBOL_GPL(klp_locate_section_objs);
>
> How about we make it even more generic with something like
>
> void *klp_find_section_by_name(const struct module *mod, const char *name,
> size_t *sec_size);
>
> ?
>
> I think that would help the code read more clearly.
Ok, I'll update it.
--
Thanks,
Petr
Powered by blists - more mailing lists