From: Miroslav Benes <mbenes@suse.cz>
To: jikos@kernel.org, jpoimboe@redhat.com, jeyu@kernel.org
Cc: pmladek@suse.com, live-patching@vger.kernel.org,
linux-kernel@vger.kernel.org, Miroslav Benes <mbenes@suse.cz>
Subject: [PATCH 1/3] livepatch: Nullify obj->mod in klp_module_coming()'s error path
Date: Thu, 7 Jun 2018 11:29:47 +0200 [thread overview]
Message-ID: <20180607092949.1706-2-mbenes@suse.cz> (raw)
In-Reply-To: <20180607092949.1706-1-mbenes@suse.cz>
klp_module_coming() is called for every module appearing in the system.
It sets obj->mod to a patched module for klp_object obj. Unfortunately
it leaves it set even if an error happens later in the function and the
patched module is not allowed to be loaded.
klp_is_object_loaded() uses obj->mod variable and could currently give a
wrong return value. The bug is probably harmless as of now, but we're
gonna rely on klp_is_object_loaded() and correct obj->mod much more and
the bug would be visible then.
Signed-off-by: Miroslav Benes <mbenes@suse.cz>
---
kernel/livepatch/core.c | 1 +
1 file changed, 1 insertion(+)
diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c
index 3a4656fb7047..36eb5cf38766 100644
--- a/kernel/livepatch/core.c
+++ b/kernel/livepatch/core.c
@@ -1015,6 +1015,7 @@ int klp_module_coming(struct module *mod)
pr_warn("patch '%s' failed for module '%s', refusing to load module '%s'\n",
patch->mod->name, obj->mod->name, obj->mod->name);
mod->klp_alive = false;
+ obj->mod = NULL;
klp_cleanup_module_patches_limited(mod, patch);
mutex_unlock(&klp_mutex);
--
2.17.0
next prev parent reply other threads:[~2018-06-07 9:29 UTC|newest]
Thread overview: 8+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-07 9:29 [PATCH 0/3] Deny the patched modules to be removed Miroslav Benes
2018-06-07 9:29 ` Miroslav Benes [this message]
2018-06-11 9:03 ` [PATCH 1/3] livepatch: Nullify obj->mod in klp_module_coming()'s error path Petr Mladek
2018-06-07 9:29 ` [PATCH 2/3] livepatch: Deny the patched modules to be removed Miroslav Benes
2018-06-11 11:41 ` Petr Mladek
2018-06-11 12:43 ` Miroslav Benes
2018-06-07 9:29 ` [PATCH 3/3] module: Remove superfluous call to klp_module_going() Miroslav Benes
2018-06-11 9:38 ` 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=20180607092949.1706-2-mbenes@suse.cz \
--to=mbenes@suse.cz \
--cc=jeyu@kernel.org \
--cc=jikos@kernel.org \
--cc=jpoimboe@redhat.com \
--cc=linux-kernel@vger.kernel.org \
--cc=live-patching@vger.kernel.org \
--cc=pmladek@suse.com \
/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®