Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1665876

Re: [PATCH 1/3] livepatch: introduce shadow variable API

From Petr Mladek <pmladek@suse.com>
Newsgroups linux.kernel
Subject Re: [PATCH 1/3] livepatch: introduce shadow variable API
Date 2017-06-14 16:30 +0200
Message-ID <tSht0-6j2-7@gated-at.bofh.it> (permalink)
References <tND17-68x-3@gated-at.bofh.it> <tND18-68x-11@gated-at.bofh.it> <tSg3U-5hv-21@gated-at.bofh.it> <tSgnh-5F5-29@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


On Wed 2017-06-14 08:17:44, Josh Poimboeuf wrote:
> 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.

I see. Shame on me. The original code makes perfect sense then.

Best Regards,
Petr

Back to linux.kernel | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Re: [PATCH 1/3] livepatch: introduce shadow variable API Petr Mladek <pmladek@suse.com> - 2017-06-14 15:00 +0200
  Re: [PATCH 1/3] livepatch: introduce shadow variable API Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-14 15:20 +0200
    Re: [PATCH 1/3] livepatch: introduce shadow variable API Petr Mladek <pmladek@suse.com> - 2017-06-14 16:30 +0200
  Re: [PATCH 1/3] livepatch: introduce shadow variable API Miroslav Benes <mbenes@suse.cz> - 2017-06-19 18:20 +0200

csiph-web