linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* Re: [PATCH] module: correctly exit module_kallsyms_on_each_symbol when fn() != 0
       [not found] <20210520122326.18563-1-jmdr@disroot.org>
@ 2021-05-20 14:23 ` Petr Mladek
  2021-05-20 14:39 ` Miroslav Benes
  2021-05-26 12:58 ` Jessica Yu
  2 siblings, 0 replies; 3+ messages in thread
From: Petr Mladek @ 2021-05-20 14:23 UTC (permalink / raw)
  To: Jon Mediero; +Cc: Jessica Yu, Miroslav Benes, linux-kernel

On Thu 2021-05-20 14:23:26, Jon Mediero wrote:
> Commit 013c1667cf78 ("kallsyms: refactor
> {,module_}kallsyms_on_each_symbol") replaced the return inside the
> nested loop with a break, changing the semantics of the function: the
> break only exits the innermost loop, so the code continues iterating the
> symbols of the next module instead of exiting.
> 
> Fixes: 013c1667cf78 ("kallsyms: refactor {,module_}kallsyms_on_each_symbol")
> Signed-off-by: Jon Mediero <jmdr@disroot.org>

Great catch!

Reviewed-by: Petr Mladek <pmladek@suse.com>

> ---
> As far as I can tell the incorrect behaviour is not causing problems at
> the moment: module_kallsyms_on_each_symbol is no longer exported and the
> only existing caller (klp_find_object_symbol) does not care about the
> return value nor the extra iterations.

It would actually break livepatching a very subtle way.

klp_find_callback() must not longer get called when there are more
symbols of the same name and args->count matches the requested
args->pos. The buggy version will always find only the last
occurence of such a symbol name.

Best Regards,
Petr

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] module: correctly exit module_kallsyms_on_each_symbol when fn() != 0
       [not found] <20210520122326.18563-1-jmdr@disroot.org>
  2021-05-20 14:23 ` [PATCH] module: correctly exit module_kallsyms_on_each_symbol when fn() != 0 Petr Mladek
@ 2021-05-20 14:39 ` Miroslav Benes
  2021-05-26 12:58 ` Jessica Yu
  2 siblings, 0 replies; 3+ messages in thread
From: Miroslav Benes @ 2021-05-20 14:39 UTC (permalink / raw)
  To: Jon Mediero; +Cc: Jessica Yu, Petr Mladek, linux-kernel

On Thu, 20 May 2021, Jon Mediero wrote:

> Commit 013c1667cf78 ("kallsyms: refactor
> {,module_}kallsyms_on_each_symbol") replaced the return inside the
> nested loop with a break, changing the semantics of the function: the
> break only exits the innermost loop, so the code continues iterating the
> symbols of the next module instead of exiting.
> 
> Fixes: 013c1667cf78 ("kallsyms: refactor {,module_}kallsyms_on_each_symbol")
> Signed-off-by: Jon Mediero <jmdr@disroot.org>

Reviewed-by: Miroslav Benes <mbenes@suse.cz>

M

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] module: correctly exit module_kallsyms_on_each_symbol when fn() != 0
       [not found] <20210520122326.18563-1-jmdr@disroot.org>
  2021-05-20 14:23 ` [PATCH] module: correctly exit module_kallsyms_on_each_symbol when fn() != 0 Petr Mladek
  2021-05-20 14:39 ` Miroslav Benes
@ 2021-05-26 12:58 ` Jessica Yu
  2 siblings, 0 replies; 3+ messages in thread
From: Jessica Yu @ 2021-05-26 12:58 UTC (permalink / raw)
  To: Jon Mediero; +Cc: Petr Mladek, Miroslav Benes, linux-kernel

+++ Jon Mediero [20/05/21 14:23 +0200]:
>Commit 013c1667cf78 ("kallsyms: refactor
>{,module_}kallsyms_on_each_symbol") replaced the return inside the
>nested loop with a break, changing the semantics of the function: the
>break only exits the innermost loop, so the code continues iterating the
>symbols of the next module instead of exiting.
>
>Fixes: 013c1667cf78 ("kallsyms: refactor {,module_}kallsyms_on_each_symbol")
>Signed-off-by: Jon Mediero <jmdr@disroot.org>

Good catch, thanks a lot for the fix! Applied to modules-next.

Jessica

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2021-05-26 12:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <20210520122326.18563-1-jmdr@disroot.org>
2021-05-20 14:23 ` [PATCH] module: correctly exit module_kallsyms_on_each_symbol when fn() != 0 Petr Mladek
2021-05-20 14:39 ` Miroslav Benes
2021-05-26 12:58 ` Jessica Yu

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).