mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Petr Mladek <pmladek@suse.com>
To: Jon Mediero <jmdr@disroot.org>
Cc: Jessica Yu <jeyu@kernel.org>, Miroslav Benes <mbenes@suse.cz>,
	linux-kernel@vger.kernel.org
Subject: Re: [PATCH] module: correctly exit module_kallsyms_on_each_symbol when fn() != 0
Date: Thu, 20 May 2021 16:23:09 +0200	[thread overview]
Message-ID: <YKZwzbkh2/qhLk+d@alley> (raw)
In-Reply-To: <20210520122326.18563-1-jmdr@disroot.org>

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

       reply	other threads:[~2021-05-20 14:23 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20210520122326.18563-1-jmdr@disroot.org>
2021-05-20 14:23 ` Petr Mladek [this message]
2021-05-20 14:39 ` Miroslav Benes
2021-05-26 12:58 ` Jessica Yu

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=YKZwzbkh2/qhLk+d@alley \
    --to=pmladek@suse.com \
    --cc=jeyu@kernel.org \
    --cc=jmdr@disroot.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mbenes@suse.cz \
    /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

all inboxes | Powered by JetHome®