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]
Message-ID: <20181217155453.nr34ooxmriik2cln@pathway.suse.cz>
Date:   Mon, 17 Dec 2018 16:54:53 +0100
From:   Petr Mladek <pmladek@...e.com>
To:     Josh Poimboeuf <jpoimboe@...hat.com>
Cc:     Jiri Kosina <jikos@...nel.org>, Miroslav Benes <mbenes@...e.cz>,
        Jason Baron <jbaron@...mai.com>,
        Joe Lawrence <joe.lawrence@...hat.com>,
        Evgenii Shatokhin <eshatokhin@...tuozzo.com>,
        live-patching@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v14 08/11] livepatch: Remove Nop structures when unused

On Thu 2018-12-13 17:00:45, Josh Poimboeuf wrote:
> On Thu, Nov 29, 2018 at 10:44:28AM +0100, Petr Mladek wrote:
> > +static void __klp_free_funcs(struct klp_object *obj, bool free_all)
> >  {
> > -	struct klp_func *func;
> > +	struct klp_func *func, *tmp_func;
> > +
> > +	klp_for_each_func_safe(obj, func, tmp_func) {
> > +		if (!free_all && !func->nop)
> > +			continue;
> 
> I suspect that changing 'free_all" to 'nops_only' (and inverting the
> condition) would make the code more readable.
> 
> And a similar suggestion for __klp_free_objects().

I am not super happy with the negative check as well. The problem is
that in __klp_free_objects() it would look like:

		if (nops_only && !obj->dynamic)
			continue;

By other words, "free_all" works better with both "nops" and "dynamic".

That said, I do not mind about it. Tell me what you prefer and I'll
change it.


> > +
> > +		/*
> > +		 * Avoid double free. It would be tricky to wait for kobject
> > +		 * callbacks when only NOPs are handled.
> > +		 */
> > +		list_del(&func->node);
> 
> I've read this comment several times but I still have no idea how it
> relates to the code :-)

I wrote this comment when I was lost in thoughts how to make freeing
safe. Especially I wondered whether we would need to wait until
the structures are freed.

You are right that this is needed to remove the freed nops/dynamic
structures in general.

I will remove the comment.

Best Regards,
Petr

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ