Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751754AbdFISiZ (ORCPT ); Fri, 9 Jun 2017 14:38:25 -0400 Received: from mx1.redhat.com ([209.132.183.28]:50206 "EHLO mx1.redhat.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751601AbdFISiY (ORCPT ); Fri, 9 Jun 2017 14:38:24 -0400 DMARC-Filter: OpenDMARC Filter v1.3.2 mx1.redhat.com AA7EFC057FA7 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 AA7EFC057FA7 Date: Fri, 9 Jun 2017 13:38:19 -0500 From: Josh Poimboeuf To: Joe Lawrence Cc: live-patching@vger.kernel.org, linux-kernel@vger.kernel.org, Jessica Yu , Jiri Kosina , Miroslav Benes , Petr Mladek Subject: Re: [PATCH 3/3] livepatch: add shadow variable sample program Message-ID: <20170609183819.eqehzh72p7qy3wfc@treble> References: <1496341526-19061-1-git-send-email-joe.lawrence@redhat.com> <1496341526-19061-4-git-send-email-joe.lawrence@redhat.com> MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <1496341526-19061-4-git-send-email-joe.lawrence@redhat.com> 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]); Fri, 09 Jun 2017 18:38:23 +0000 (UTC) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1028 Lines: 43 On Thu, Jun 01, 2017 at 02:25:26PM -0400, Joe Lawrence wrote: > #include > +#include > static int livepatch_cmdline_proc_show(struct seq_file *m, void *v) > { > + struct task_ctr *nd; > + > + nd = klp_shadow_get(current, "task_ctr"); > + if (!nd) { > + nd = kzalloc(sizeof(*nd), GFP_KERNEL); > + if (nd) { > + list_add(&nd->list, &shadow_list); > + klp_shadow_attach(current, "task_ctr", GFP_KERNEL, nd); > + } > + } > + > seq_printf(m, "%s\n", "this has been live patched"); > + > + if (nd) { > + nd->count++; > + seq_printf(m, "current=%p count=%d\n", current, nd->count); > + } > + > return 0; > } > > @@ -99,6 +130,12 @@ static int livepatch_init(void) > > static void livepatch_exit(void) > { > + struct task_ctr *nd, *tmp; > + > + list_for_each_entry_safe(nd, tmp, &shadow_list, list) { > + list_del(&nd->list); > + kfree(nd); > + } > WARN_ON(klp_unregister_patch(&patch)); > } What does 'nd' stand for? I think a name like 'ctr' would be clearer. -- Josh