[<prev] [next>] [day] [month] [year] [list]
Message-ID: <YKZwzbkh2/qhLk+d@alley>
Date: Thu, 20 May 2021 16:23:09 +0200
From: Petr Mladek <pmladek@...e.com>
To: Jon Mediero <jmdr@...root.org>
Cc: Jessica Yu <jeyu@...nel.org>, Miroslav Benes <mbenes@...e.cz>,
linux-kernel@...r.kernel.org
Subject: Re: [PATCH] module: correctly exit module_kallsyms_on_each_symbol
when fn() != 0
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@...root.org>
Great catch!
Reviewed-by: Petr Mladek <pmladek@...e.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
Powered by blists - more mailing lists