lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <okmrns5zlxqkwrou5rspq3zyakuv4gwwe4do7yovjbeaa5eajh@fud5amphpycu>
Date: Wed, 21 Jan 2026 13:04:25 -0800
From: Josh Poimboeuf <jpoimboe@...nel.org>
To: Petr Pavlu <petr.pavlu@...e.com>
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 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.

-- 
Josh

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ