Now that the livepatch code no longer needs the text_mutex for changing
module permissions, move its usage down to apply_relocate_add().
Note the s390 version of apply_relocate_add() doesn't need to use the
text_mutex because it already uses s390_kernel_write_lock, which
accomplishes the same task.
Signed-off-by: Josh Poimboeuf <jpoimboe@redhat.com>
Acked-by: Joe Lawrence <joe.lawrence@redhat.com>
Acked-by: Miroslav Benes <mbenes@suse.cz>
Signed-off-by: Jiri Kosina <jkosina@suse.cz>
#include <linux/gfp.h>
#include <linux/jump_label.h>
#include <linux/random.h>
+#include <linux/memory.h>
#include <asm/text-patching.h>
#include <asm/page.h>
bool early = me->state == MODULE_STATE_UNFORMED;
void *(*write)(void *, const void *, size_t) = memcpy;
- if (!early)
+ if (!early) {
write = text_poke;
+ mutex_lock(&text_mutex);
+ }
ret = __apply_relocate_add(sechdrs, strtab, symindex, relsec, me,
write);
- if (!early)
+ if (!early) {
text_poke_sync();
+ mutex_unlock(&text_mutex);
+ }
return ret;
}
int ret;
if (klp_is_module(obj)) {
-
- mutex_lock(&text_mutex);
-
/*
* Only write module-specific relocations here
* (.klp.rela.{module}.*). vmlinux-specific relocations were
* itself.
*/
ret = klp_apply_object_relocs(patch, obj);
-
- mutex_unlock(&text_mutex);
-
if (ret)
return ret;
}