[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20170614131744.43izgxdl4qvwmgbj@treble>
Date: Wed, 14 Jun 2017 08:17:44 -0500
From: Josh Poimboeuf <jpoimboe@...hat.com>
To: Petr Mladek <pmladek@...e.com>
Cc: Joe Lawrence <joe.lawrence@...hat.com>,
live-patching@...r.kernel.org, linux-kernel@...r.kernel.org,
Jessica Yu <jeyu@...hat.com>, Jiri Kosina <jikos@...nel.org>,
Miroslav Benes <mbenes@...e.cz>
Subject: Re: [PATCH 1/3] livepatch: introduce shadow variable API
On Wed, Jun 14, 2017 at 02:59:13PM +0200, Petr Mladek wrote:
> > +}
> > +
> > +void klp_shadow_detach(void *obj, char *var)
> > +{
> > + unsigned long flags;
> > + struct klp_shadow *shadow;
> > +
> > + spin_lock_irqsave(&klp_shadow_lock, flags);
> > +
> > + hash_for_each_possible(klp_shadow_hash, shadow, node,
> > + (unsigned long)obj) {
> > + if (shadow->obj == obj && !strcmp(shadow->var, var)) {
>
> Do we need to test "shadow->obj == obj" here? If it is not true,
> there would be a bug in the hashtable implementation or in
> klp_shadow_attach().
>
> Well, it might make sense to add a consistency check:
>
> WARN_ON(shadow->obj != obj);
>
It would make sense if hash_for_each_possible() worked that way, but for
some reason it doesn't. :-/ It gives you all the hash collisions.
--
Josh
Powered by blists - more mailing lists