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


Groups > linux.kernel > #1662673 > unrolled thread

Re: [PATCH 3/3] livepatch: add shadow variable sample program

Started byJosh Poimboeuf <jpoimboe@redhat.com>
First post2017-06-09 20:40 +0200
Last post2017-06-09 21:10 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: [PATCH 3/3] livepatch: add shadow variable sample program Josh Poimboeuf <jpoimboe@redhat.com> - 2017-06-09 20:40 +0200
    Re: [PATCH 3/3] livepatch: add shadow variable sample program Joe Lawrence <joe.lawrence@redhat.com> - 2017-06-09 21:10 +0200

#1662673 — Re: [PATCH 3/3] livepatch: add shadow variable sample program

FromJosh Poimboeuf <jpoimboe@redhat.com>
Date2017-06-09 20:40 +0200
SubjectRe: [PATCH 3/3] livepatch: add shadow variable sample program
Message-ID<tQwZd-52A-35@gated-at.bofh.it>
On Thu, Jun 01, 2017 at 02:25:26PM -0400, Joe Lawrence wrote:
>  #include <linux/seq_file.h>
> +#include <linux/slab.h>
>  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

[toc] | [next] | [standalone]


#1662696

FromJoe Lawrence <joe.lawrence@redhat.com>
Date2017-06-09 21:10 +0200
Message-ID<tQxsd-5ru-3@gated-at.bofh.it>
In reply to#1662673
On 06/09/2017 02:38 PM, Josh Poimboeuf wrote:
> On Thu, Jun 01, 2017 at 02:25:26PM -0400, Joe Lawrence wrote:
>> [ ... snip ... ]  
>> @@ -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.
> 

Ah, in an earlier draft (pre-post) that data structure was called
"new_data", so "nd" was simply a short hand abbreviation.  I'll update
for v2, thanks.

-- Joe

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web