Re: [RFC PATCH] livepatch/module: Do not patch modules that are not ready
From: Josh Poimboeuf
Date: Tue Mar 03 2015 - 14:36:19 EST
On Tue, Mar 03, 2015 at 01:31:28PM -0600, Josh Poimboeuf wrote:
> @@ -89,16 +89,29 @@ static bool klp_is_object_loaded(struct klp_object *obj)
> /* sets obj->mod if object is not vmlinux and module is found */
> static void klp_find_object_module(struct klp_object *obj)
> {
> - if (!klp_is_module(obj))
> + struct module *mod;
> +
> + if (!klp_is_module(obj) || obj->mod)
> return;
>
> mutex_lock(&module_mutex);
> +
> /*
> * We don't need to take a reference on the module here because we have
> * the klp_mutex, which is also taken by the module notifier. This
> * prevents any module from unloading until we release the klp_mutex.
> */
> - obj->mod = find_module(obj->name);
> + mod = find_module(obj->name);
> +
> + /*
> + * MODULE_STATE_COMING means we got to the module first before the
> + * notifier did. ftrace is already initialized, so it's fine to go
> + * ahead and start using it.
> + */
This comment should probably be improved to say:
"MODULE_STATE_COMING and !obj->mod means..."
--
Josh
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/