Linux Modules
 help / color / mirror / Atom feed
From: Steven Rostedt <rostedt@goodmis.org>
To: Lawrence Lin via B4 Relay <devnull+deduce.gmail.com@kernel.org>
Cc: deduce@gmail.com, "Masami Hiramatsu" <mhiramat@kernel.org>,
	"Mark Rutland" <mark.rutland@arm.com>,
	"Mathieu Desnoyers" <mathieu.desnoyers@efficios.com>,
	"Luis Chamberlain" <mcgrof@kernel.org>,
	"Petr Pavlu" <petr.pavlu@suse.com>,
	"Daniel Gomez" <da.gomez@kernel.org>,
	"Sami Tolvanen" <samitolvanen@google.com>,
	"Aaron Tomlin" <atomlin@atomlin.com>,
	"Stanislaw Gruszka" <stf_xl@wp.pl>,
	"David Laight" <david.laight.linux@gmail.com>,
	"Krzysztof Wilczyński" <kwilczynski@kernel.org>,
	linux-modules@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-trace-kernel@vger.kernel.org,
	"Tiezhu Yang" <yangtiezhu@loongson.cn>
Subject: Re: [PATCH v2 1/2] module: Add module_kallsyms_on_each_addr()
Date: Mon, 23 Nov 2026 16:17:29 -0500	[thread overview]
Message-ID: <20261123161729.4763c2af@gandalf.local.home> (raw)
In-Reply-To: <20261004-ftrace-mod-bsearch-v2-1-c1de73e72e73@gmail.com>

On Sun, 04 Oct 2026 14:51:00 -0500
Lawrence Lin via B4 Relay <devnull+deduce.gmail.com@kernel.org> wrote:

> @@ -286,15 +298,7 @@ static const char *find_kallsyms_symbol(struct module *mod,
>  		const Elf_Sym *sym = &kallsyms->symtab[i];
>  		unsigned long thisval = kallsyms_symbol_value(sym);
>  
> -		if (sym->st_shndx == SHN_UNDEF)
> -			continue;
> -
> -		/*
> -		 * We ignore unnamed symbols: they're uninformative
> -		 * and inserted at a whim.
> -		 */
> -		if (*kallsyms_symbol_name(kallsyms, i) == '\0' ||
> -		    is_mapping_symbol(kallsyms_symbol_name(kallsyms, i)))

Can you rebase to v7.4-rc4? The above function name was changed by:

  db91da8f05185 ("module/kallsyms: Rename is_mapping_symbol() to is_ignored_kernel_symbol()")

Thanks,

-- Steve

> +		if (!is_lookup_symbol(kallsyms, i))
>  			continue;
>  
>  		if (thisval <= addr && thisval > bestval) {
> @@ -458,6 +462,28 @@ unsigned long find_kallsyms_symbol_value(struct module *mod, const char *name)
>  	return __find_kallsyms_symbol_value(mod, name);
>  }
>  
> +/*
> + * Call @fn with the address of each symbol of @mod that find_kallsyms_symbol()
> + * may resolve an address to. Unlike module_kallsyms_on_each_symbol(), this
> + * also works while @mod is still being loaded.
> + */
> +void module_kallsyms_on_each_addr(struct module *mod,
> +				  void (*fn)(void *, unsigned long),
> +				  void *data)
> +{
> +	struct mod_kallsyms *kallsyms;
> +	unsigned int i;
> +
> +	guard(rcu)();
> +	kallsyms = rcu_dereference(mod->kallsyms);
> +
> +	/* ELF starts real symbols at 1. */
> +	for (i = 1; i < kallsyms->num_symtab; i++) {
> +		if (is_lookup_symbol(kallsyms, i))
> +			fn(data, kallsyms_symbol_value(&kallsyms->symtab[i]));
> +	}
> +}
> +
>  int module_kallsyms_on_each_symbol(const char *modname,
>  				   int (*fn)(void *, const char *, unsigned long),
>  				   void *data)


  reply	other threads:[~2026-11-23 21:17 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-10-04 19:50 [PATCH v2 0/2] ftrace: Drop weak function locations of modules when loading them Lawrence Lin via B4 Relay
2026-10-04 19:51 ` [PATCH v2 1/2] module: Add module_kallsyms_on_each_addr() Lawrence Lin via B4 Relay
2026-11-23 21:17   ` Steven Rostedt [this message]
2026-10-04 19:51 ` [PATCH v2 2/2] ftrace: Drop weak function locations of modules when loading them Lawrence Lin via B4 Relay
2026-11-06 13:13   ` Mitch Hen Chez
2026-11-06 16:11     ` Steven Rostedt
2026-11-06 22:22       ` Mitch Hen Chez

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261123161729.4763c2af@gandalf.local.home \
    --to=rostedt@goodmis.org \
    --cc=atomlin@atomlin.com \
    --cc=da.gomez@kernel.org \
    --cc=david.laight.linux@gmail.com \
    --cc=deduce@gmail.com \
    --cc=devnull+deduce.gmail.com@kernel.org \
    --cc=kwilczynski@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-modules@vger.kernel.org \
    --cc=linux-trace-kernel@vger.kernel.org \
    --cc=mark.rutland@arm.com \
    --cc=mathieu.desnoyers@efficios.com \
    --cc=mcgrof@kernel.org \
    --cc=mhiramat@kernel.org \
    --cc=petr.pavlu@suse.com \
    --cc=samitolvanen@google.com \
    --cc=stf_xl@wp.pl \
    --cc=yangtiezhu@loongson.cn \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox