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: <52E9FD31.108@intel.com>
Date:	Thu, 30 Jan 2014 09:20:17 +0200
From:	Adrian Hunter <adrian.hunter@...el.com>
To:	Arnaldo Carvalho de Melo <acme@...stprotocols.net>
CC:	Peter Zijlstra <a.p.zijlstra@...llo.nl>,
	Ingo Molnar <mingo@...hat.com>, linux-kernel@...r.kernel.org,
	David Ahern <dsahern@...il.com>,
	Frederic Weisbecker <fweisbec@...il.com>,
	Jiri Olsa <jolsa@...hat.com>, Mike Galbraith <efault@....de>,
	Namhyung Kim <namhyung@...il.com>,
	Paul Mackerras <paulus@...ba.org>,
	Stephane Eranian <eranian@...gle.com>
Subject: Re: [PATCH V2 1/9] perf tools: Fix symbol annotation for relocated
 kernel

On 29/01/14 20:57, Arnaldo Carvalho de Melo wrote:
> Em Wed, Jan 29, 2014 at 04:14:36PM +0200, Adrian Hunter escreveu:
>> Kernel maps map memory addresses to file offsets.
>> For symbol annotation, objdump needs the object VMA
>> addresses.  For an unrelocated kernel, that is the
>> same as the memory address.
>>
>> The addresses passed to objdump for symbol annotation
>> did not take into account kernel relocation.  This
>> patch fixes that.
> 
> Question: To fix the problem reported by Linus, i.e. the very minimal
> fix, we only need this patch, right?

Yes but the other fixes are needed too.

> 
> Reading the other patches now.
> 
> - Arnaldo
>  
>> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
>> ---
>>  tools/perf/util/map.c        | 5 +++--
>>  tools/perf/util/map.h        | 1 +
>>  tools/perf/util/symbol-elf.c | 2 ++
>>  3 files changed, 6 insertions(+), 2 deletions(-)
>>
>> diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
>> index ee1dd68..b46f527 100644
>> --- a/tools/perf/util/map.c
>> +++ b/tools/perf/util/map.c
>> @@ -39,6 +39,7 @@ void map__init(struct map *map, enum map_type type,
>>  	map->start    = start;
>>  	map->end      = end;
>>  	map->pgoff    = pgoff;
>> +	map->reloc    = 0;
>>  	map->dso      = dso;
>>  	map->map_ip   = map__map_ip;
>>  	map->unmap_ip = map__unmap_ip;
>> @@ -288,7 +289,7 @@ u64 map__rip_2objdump(struct map *map, u64 rip)
>>  	if (map->dso->rel)
>>  		return rip - map->pgoff;
>>  
>> -	return map->unmap_ip(map, rip);
>> +	return map->unmap_ip(map, rip) - map->reloc;
>>  }
>>  
>>  /**
>> @@ -311,7 +312,7 @@ u64 map__objdump_2mem(struct map *map, u64 ip)
>>  	if (map->dso->rel)
>>  		return map->unmap_ip(map, ip + map->pgoff);
>>  
>> -	return ip;
>> +	return ip + map->reloc;
>>  }
>>  
>>  void map_groups__init(struct map_groups *mg)
>> diff --git a/tools/perf/util/map.h b/tools/perf/util/map.h
>> index 18068c6..257e513 100644
>> --- a/tools/perf/util/map.h
>> +++ b/tools/perf/util/map.h
>> @@ -36,6 +36,7 @@ struct map {
>>  	bool			erange_warned;
>>  	u32			priv;
>>  	u64			pgoff;
>> +	u64			reloc;
>>  	u32			maj, min; /* only valid for MMAP2 record */
>>  	u64			ino;      /* only valid for MMAP2 record */
>>  	u64			ino_generation;/* only valid for MMAP2 record */
>> diff --git a/tools/perf/util/symbol-elf.c b/tools/perf/util/symbol-elf.c
>> index 7594567..8ce52da 100644
>> --- a/tools/perf/util/symbol-elf.c
>> +++ b/tools/perf/util/symbol-elf.c
>> @@ -751,6 +751,8 @@ int dso__load_sym(struct dso *dso, struct map *map,
>>  			if (strcmp(elf_name, kmap->ref_reloc_sym->name))
>>  				continue;
>>  			kmap->ref_reloc_sym->unrelocated_addr = sym.st_value;
>> +			map->reloc = kmap->ref_reloc_sym->addr -
>> +				     kmap->ref_reloc_sym->unrelocated_addr;
>>  			break;
>>  		}
>>  	}
>> -- 
>> 1.7.11.7
> 
> 

--
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