Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752565AbdFNNRv (ORCPT ); Wed, 14 Jun 2017 09:17:51 -0400 Received: from mx1.redhat.com ([209.132.183.28]:35366 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752519AbdFNNRt (ORCPT ); Wed, 14 Jun 2017 09:17:49 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 523EAC057FA8 Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx08.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=jpoimboe@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 523EAC057FA8 Date: Wed, 14 Jun 2017 08:17:44 -0500 From: Josh Poimboeuf To: Petr Mladek Cc: Joe Lawrence , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Jessica Yu , Jiri Kosina , Miroslav Benes Subject: Re: [PATCH 1/3] livepatch: introduce shadow variable API Message-ID: <20170614131744.43izgxdl4qvwmgbj@treble> References: <1496341526-19061-1-git-send-email-joe.lawrence@redhat.com> <1496341526-19061-2-git-send-email-joe.lawrence@redhat.com> <20170614125913.GC15013@pathway.suse.cz> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20170614125913.GC15013@pathway.suse.cz> User-Agent: Mutt/1.6.0.1 (2016-04-01) X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.32]); Wed, 14 Jun 2017 13:17:49 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 819 Lines: 28 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