Received: by 10.223.164.221 with SMTP id h29csp3084121wrb; Fri, 3 Nov 2017 01:07:55 -0700 (PDT) X-Google-Smtp-Source: ABhQp+S1q6zEBzYUACiZ7S4iILlftU4GJ1FBvk3PeqXchzpLjsrWxkrssvsXw7br5DwLIlwSbgio X-Received: by 10.159.247.199 with SMTP id v7mr5876431plz.321.1509696475476; Fri, 03 Nov 2017 01:07:55 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1509696475; cv=none; d=google.com; s=arc-20160816; b=McDcE5f1sHDiLO03ROD+hMG9xzgVM6LV8FmJUF0NFSrwNfp5xBGmO6TplSAhGgxDIF W1KP13CQeXyyp+YETC8dA2BSWUw85rDbInx+/KPo0xXFoOFaqchvdGPADLZMHhp2sW9V psBPTq7svV6UNvttzCwDK9klVZRs03sg/jEufocfKOJvIAy0a1O02V5x98tadvrxFci/ UK+WZrMq0IQTGsPPSkLuGI40Y2e1heriqQPp9hFT77hSjz0PbE/euy90LhDifNan2Dbb QKc97HXSHwevfuTuC5H19rxHdjHs6zcxZvRwn1Xwt73Jw/4YoitnyScK8cLbzls7T6mK fWlQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:mime-version:user-agent:references :message-id:in-reply-to:subject:cc:to:from:date :arc-authentication-results; bh=iiP9ByYaoxHsDwnbFD9S7cQgpFpdu9HbEldT2msD4Mc=; b=XJ1+E1+L2IW8n6YQSSN4co74/5qQA1tfsNBAyJZpoHhS3JK3DV0IYG4VYY3oKJgeZX uP4RvbcVBRjsJqUleGvzbxQ5aNsi4TMXxnrt27HGt1xIkW/wZ+znrU4fbbfRlI2iulqv fqHohW/6tYINVA3JuyzwW2lGGri+kogCqJ7wxw/tBKTttrbu/jkjExdamxR3JfNAaNGC mcmAEtLIGYQ4MFRnpO6BBfqYrUiTl5SjEZ+VpsrKszbwCEqMzNxUYIL9T/SflejnI9QU 2b63QlN++UQ6SQcHyAzuIir+SadDSAGravVG95xOFMxfTN6jBgCzew2PBEjjPictFBSY hchQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id ay4si4341368plb.478.2017.11.03.01.07.42; Fri, 03 Nov 2017 01:07:55 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754520AbdKCIHA (ORCPT + 96 others); Fri, 3 Nov 2017 04:07:00 -0400 Received: from mx2.suse.de ([195.135.220.15]:48573 "EHLO mx2.suse.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752105AbdKCIG6 (ORCPT ); Fri, 3 Nov 2017 04:06:58 -0400 X-Virus-Scanned: by amavisd-new at test-mx.suse.de Received: from relay1.suse.de (charybdis-ext.suse.de [195.135.220.254]) by mx2.suse.de (Postfix) with ESMTP id 984EDAD2C; Fri, 3 Nov 2017 08:06:56 +0000 (UTC) Date: Fri, 3 Nov 2017 09:06:55 +0100 (CET) From: Miroslav Benes To: Josh Poimboeuf cc: jeyu@kernel.org, jikos@kernel.org, pmladek@suse.com, lpechacek@suse.cz, pavel@ucw.cz, live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Oleg Nesterov , Michael Ellerman , Thomas Gleixner , Ingo Molnar , "H. Peter Anvin" , Andy Lutomirski , linuxppc-dev@lists.ozlabs.org, x86@kernel.org Subject: Re: [PATCH v3 1/2] livepatch: send a fake signal to all blocking tasks In-Reply-To: <20171102133200.abwvepjx3ytufsc4@treble> Message-ID: References: <20171031114853.841-1-mbenes@suse.cz> <20171031114853.841-2-mbenes@suse.cz> <20171102133200.abwvepjx3ytufsc4@treble> User-Agent: Alpine 2.21 (LSU 202 2017-01-01) MIME-Version: 1.0 Content-Type: text/plain; charset=US-ASCII Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, 2 Nov 2017, Josh Poimboeuf wrote: > On Tue, Oct 31, 2017 at 12:48:52PM +0100, Miroslav Benes wrote: > > diff --git a/kernel/livepatch/core.c b/kernel/livepatch/core.c > > index bf8c8fd72589..b7c60662baf3 100644 > > --- a/kernel/livepatch/core.c > > +++ b/kernel/livepatch/core.c > > @@ -440,6 +440,7 @@ EXPORT_SYMBOL_GPL(klp_enable_patch); > > * /sys/kernel/livepatch/ > > * /sys/kernel/livepatch//enabled > > * /sys/kernel/livepatch//transition > > + * /sys/kernel/livepatch//signal > > * /sys/kernel/livepatch// > > * /sys/kernel/livepatch/// > > */ > > @@ -514,11 +515,37 @@ static ssize_t transition_show(struct kobject *kobj, > > patch == klp_transition_patch); > > } > > > > +static ssize_t signal_store(struct kobject *kobj, struct kobj_attribute *attr, > > + const char *buf, size_t count) > > +{ > > + int ret; > > + bool val; > > + > > + /* > > + * klp_mutex lock is not grabbed here intentionally. It is not really > > + * needed. The race window is harmless and grabbing the lock would only > > + * hold the action back. > > + */ > > + if (!klp_transition_patch) > > + return -EINVAL; > > + > > + ret = kstrtobool(buf, &val); > > + if (ret) > > + return ret; > > + > > + if (val) > > + klp_force_signals(); > > + > > + return count; > > +} > > The function still has global functionality even though the sysfs entry > is now per-patch. So if you do > > echo 1 > /sys/kernel/livepatch/patch1/signal > > But patch2 is in transition, then it will send signals based on patch2. > Instead it should probably return an error. > > There's a similar issue with force_store(). Bah. I still find having "signal" and "force" in /sys/kernel/livepatch// a bit odd, but I'll add struct klp_patch *patch; patch = container_of(kobj, struct klp_patch, kobj); /* ... */ if (patch != klp_transition_patch) return -EINVAL; That should solve it for all cases. Thanks, Miroslav From 1583031240236197526@xxx Fri Nov 03 08:03:55 +0000 2017 X-GM-THRID: 1582773844473281428 X-Gmail-Labels: Inbox,Category Forums,HistoricalUnread