[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <565DAE83.9020205@suse.cz>
Date: Tue, 1 Dec 2015 15:28:19 +0100
From: Jiri Slaby <jslaby@...e.cz>
To: Petr Mladek <pmladek@...e.com>
Cc: Josh Poimboeuf <jpoimboe@...hat.com>,
Li Bin <huawei.libin@...wei.com>, sjenning@...hat.com,
jikos@...nel.org, vojtech@...e.com, live-patching@...r.kernel.org,
linux-kernel@...r.kernel.org, guohanjun@...wei.com,
dingtianhong@...wei.com, xiexiuqi@...wei.com,
zhouchengming1@...wei.com, Miroslav Benes <mbenes@...e.cz>
Subject: Re: [PATCH] livepatch: fix race between enabled_store() and
klp_unregister_patch()
On 12/01/2015, 03:13 PM, Petr Mladek wrote:
> --- a/kernel/livepatch/core.c
> +++ b/kernel/livepatch/core.c
> @@ -612,7 +612,19 @@ static ssize_t enabled_store(struct kobject *kobj, struct kobj_attribute *attr,
>
> patch = container_of(kobj, struct klp_patch, kobj);
>
> - mutex_lock(&klp_mutex);
> + /*
> + * Avoid a deadlock with kobject_put(&patch->kobj) that is
> + * called under klp_mutex. Bail out when the patch is not
> + * longer registered.
> + */
> + if (!mutex_trylock(&klp_mutex)) {
This introduces false positives.
Deleting/enabling/disabling/other_op_under_klp_mutex of an unrelated
patch may now cause enabled_store to fail. Hence I don't like this
approach at all.
thanks,
--
js
suse labs
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists