lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Fri, 9 Jun 2017 13:38:19 -0500
From:   Josh Poimboeuf <jpoimboe@...hat.com>
To:     Joe Lawrence <joe.lawrence@...hat.com>
Cc:     live-patching@...r.kernel.org, linux-kernel@...r.kernel.org,
        Jessica Yu <jeyu@...hat.com>, Jiri Kosina <jikos@...nel.org>,
        Miroslav Benes <mbenes@...e.cz>, Petr Mladek <pmladek@...e.com>
Subject: Re: [PATCH 3/3] livepatch: add shadow variable sample program

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

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ