Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753520AbdFMR3e (ORCPT ); Tue, 13 Jun 2017 13:29:34 -0400 Received: from mx1.redhat.com ([209.132.183.28]:54318 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751826AbdFMR3d (ORCPT ); Tue, 13 Jun 2017 13:29:33 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com 6BB52796EB Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; dmarc=none (p=none dis=none) header.from=redhat.com Authentication-Results: ext-mx01.extmail.prod.ext.phx2.redhat.com; spf=pass smtp.mailfrom=joe.lawrence@redhat.com DKIM-Filter: OpenDKIM Filter v2.11.0 mx1.redhat.com 6BB52796EB Subject: Re: [PATCH 0/3] livepatch: add shadow variable API To: Miroslav Benes References: <1496341526-19061-1-git-send-email-joe.lawrence@redhat.com> Cc: Jiri Kosina , live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Josh Poimboeuf , Jessica Yu , Petr Mladek From: Joe Lawrence Organization: Red Hat Message-ID: <8a4711b9-9536-3843-c737-50fab2536aa5@redhat.com> Date: Tue, 13 Jun 2017 13:29:31 -0400 User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:45.0) Gecko/20100101 Thunderbird/45.8.0 MIME-Version: 1.0 In-Reply-To: Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: 7bit X-Greylist: Sender IP whitelisted, not delayed by milter-greylist-4.5.16 (mx1.redhat.com [10.5.110.25]); Tue, 13 Jun 2017 17:29:32 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1343 Lines: 28 On 06/13/2017 06:19 AM, Miroslav Benes wrote: >> If you are referring to stacking livepatches ... to be honest I hadn't >> thought of that scenario. In that case, we might be able to get away >> with pushing something like this into the hash: >> >> klp #1: klp_shadow_attach(ptr, "shadow_var", ...) >> klp #2: klp_shadow_attach(ptr, "shadow_var_v2", ...) > > I thought this was the reason to have a string there. Otherwise, a > pointer to original data would be enough, wouldn't it? Well, one could attach multiple shadow variables to the same data structure, ie, one for each new data element. In the stacking case, you might add a spinlock in patch 1, then a linked-list in patch 2. Patched codepaths would then use klp_shadow_get(obj, "spinlock") or klp_shadow_get(obj, "list") as needed. Versioning shadow variables would be a bit more involved. You'd have to figure out if you A) convert existing shadow variables to the new format on livepatch module load, or B) convert on the fly, or C) handle none, v1, and v2 instances of the shadow variables. /head spins To be honest, I don't think we've never needed anything beyond basic shadow variables in kpatch, so I'm only speculating about their potential (ab)uses :) That said, since this patchset is introducing the API, it would be good to be reasonably flexible. -- Joe