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]
Message-ID: <87ob70kz85.fsf@sejong.aot.lge.com>
Date:	Tue, 08 Oct 2013 16:18:02 +0900
From:	Namhyung Kim <namhyung@...nel.org>
To:	Adrian Hunter <adrian.hunter@...el.com>
Cc:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>,
	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	linux-kernel@...r.kernel.org, David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Jiri Olsa <jolsa@...hat.com>, Mike Galbraith <efault@....de>,
	Paul Mackerras <paulus@...ba.org>,
	Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH V4 2/9] perf tools: validate kcore module addresses

Hi Adrian,

On Mon,  7 Oct 2013 09:50:11 +0300, Adrian Hunter wrote:
> Before using kcore we need to check that modules are
> in memory at the same addresses that they were when
> data was recorded.
>
> This is done because, while we could remap symbols
> to different addresses, the object code linkages
> would still be different which would provide an
> erroneous view of the object code.

[SNIP]
>  
> -static int kcore_mapfn(u64 start, u64 len, u64 pgoff, void *data)
> +static void add_module(struct module_info *mi, struct rb_root *modules)
>  {
> -	struct kcore_mapfn_data *md = data;
> -	struct map *map;
> +	struct rb_node **p = &modules->rb_node;
> +	struct rb_node *parent = NULL;
> +	struct module_info *m;
>  
> -	map = map__new2(start, md->dso, md->type);
> -	if (map == NULL)
> +	while (*p != NULL) {
> +		parent = *p;
> +		m = rb_entry(parent, struct module_info, rb_node);
> +		if (strcmp(mi->name, m->name) < 0)
> +			p = &(*p)->rb_left;
> +		else
> +			p = &(*p)->rb_right;
> +	}
> +	rb_link_node(&mi->rb_node, parent, p);
> +	rb_insert_color(&mi->rb_node, modules);
> +}

[SNIP]

> +static int __read_proc_modules(void *arg, const char *name, u64 start)
> +{
> +	struct rb_root *modules = arg;
> +	struct module_info *mi;
> +
> +	mi = zalloc(sizeof(struct module_info));
> +	if (!mi)
>  		return -ENOMEM;
>  
> -	map->end = map->start + len;
> -	map->pgoff = pgoff;
> +	mi->name = strdup(name);
> +	mi->start = start;
>  
> -	list_add(&map->node, &md->maps);
> +	add_module(mi, modules);
> +
> +	if (!mi->name)
> +		return -ENOMEM;

Why did you add the mi if it failed to allocate name?  I guess it'd
crash since the add_module() uses mi->name for strcmp().

Thanks,
Namhyung

> +
> +	return 0;
> +}
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ