lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 3 Nov 2017 09:06:55 +0100 (CET)
From:   Miroslav Benes <mbenes@...e.cz>
To:     Josh Poimboeuf <jpoimboe@...hat.com>
cc:     jeyu@...nel.org, jikos@...nel.org, pmladek@...e.com,
        lpechacek@...e.cz, pavel@....cz, live-patching@...r.kernel.org,
        linux-kernel@...r.kernel.org, Oleg Nesterov <oleg@...hat.com>,
        Michael Ellerman <mpe@...erman.id.au>,
        Thomas Gleixner <tglx@...utronix.de>,
        Ingo Molnar <mingo@...hat.com>,
        "H. Peter Anvin" <hpa@...or.com>,
        Andy Lutomirski <luto@...nel.org>,
        linuxppc-dev@...ts.ozlabs.org, x86@...nel.org
Subject: Re: [PATCH v3 1/2] livepatch: send a fake signal to all blocking
 tasks

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/<patch>
> >   * /sys/kernel/livepatch/<patch>/enabled
> >   * /sys/kernel/livepatch/<patch>/transition
> > + * /sys/kernel/livepatch/<patch>/signal
> >   * /sys/kernel/livepatch/<patch>/<object>
> >   * /sys/kernel/livepatch/<patch>/<object>/<function,sympos>
> >   */
> > @@ -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/<patch>/ 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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ