Re: [PATCH v3 02/10] livepatch: Apply vmlinux-specific KLP relocations early

From: Miroslav Benes
Date: Tue Apr 28 2020 - 05:20:16 EST


> @@ -738,18 +765,23 @@ static int klp_init_object_loaded(struct klp_patch *patch,
> int ret;
>
> mutex_lock(&text_mutex);
> -
> module_disable_ro(patch->mod);
> - ret = klp_write_object_relocations(patch->mod, obj);
> - if (ret) {
> - module_enable_ro(patch->mod, true);
> - mutex_unlock(&text_mutex);
> - return ret;
> +
> + if (klp_is_module(obj)) {
> + /*
> + * Only write module-specific relocations here
> + * (.klp.rela.{module}.*). vmlinux-specific relocations were
> + * written earlier during the initialization of the klp module
> + * itself.
> + */
> + ret = klp_apply_object_relocs(patch, obj);
> + if (ret)

+ module_enable_ro(patch->mod, true);
+ mutex_unlock(&text_mutex);

is missing here, I think. Probably lost during rebase. It is fine after
the next patch.

> + return ret;
> }
>
> arch_klp_init_object_loaded(patch, obj);
> - module_enable_ro(patch->mod, true);
>
> + module_enable_ro(patch->mod, true);
> mutex_unlock(&text_mutex);

Miroslav