Re: module: preserve Elf information for livepatch modules

From
Jessica Yu <hidden>
Date
2015-12-17 01:01:33
Also in
linux-s390, lkml
Reply to
Miroslav Benes, 2015-12-16
+++ Miroslav Benes [16/12/15 11:58 +0100]:
On Mon, 30 Nov 2015, Jessica Yu wrote:
quoted
@@ -3530,6 +3614,16 @@ static int load_module(struct load_info *info, const char __user *uargs,
 	if (err < 0)
 		goto bug_cleanup;

+	/*
+	 * Save sechdrs, indices, and other data from info
+	 * in order to patch to-be-loaded modules.
+	 * Do not call free_copy() for livepatch modules.
+	 */
+	if (mod->klp)
+		err = copy_module_elf(mod, info);
+	if (err < 0)
+		goto bug_cleanup;
+
I think goto bug_cleanup is not sufficient. Just before this hunk sysfs is
created. So in case of error here we should call mod_sysfs_teardown() or
something before going to bug_cleanup. That is new error label is needed
before bug_cleanup. Correct?
Yes I think you're right. So before bug_cleanup, we'll just need a new
label (maybe called sysfs_cleanup) that calls mod_sysfs_teardown(). In
addition, the if (err < 0) check should have been enclosed in the if
(mod->klp) block.

Jessica
Thread (37 messages) 37 messages, 6 authors, last reply 2015-12-21
Keyboard shortcuts
hback out one level
jnext message in thread / next series-diff position
kprevious message in thread / previous series-diff position
ldrill in
Escclose help / fold thread tree
?toggle this help