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:   Tue, 11 Sep 2018 09:30:37 +0300
From:   Adrian Hunter <adrian.hunter@...el.com>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Jiri Olsa <jolsa@...hat.com>,
        Björn Töpel <bjorn.topel@...el.com>,
        linux-kernel@...r.kernel.org
Subject: Re: [PATCH V2] perf tools: Fix maps__find_symbol_by_name()

On 10/09/18 17:34, Arnaldo Carvalho de Melo wrote:
> Em Fri, Sep 07, 2018 at 11:51:16AM +0300, Adrian Hunter escreveu:
>> Commit 1c5aae7710bb ("perf machine: Create maps for x86 PTI entry
>> trampolines") revealed a problem with maps__find_symbol_by_name() that
> 
> Can we have this with a Fixes: 1c5aae7710bb?
> 
> So that that, combined with the CC: stable, tells which stable kernels
> should get that fix, I think there are scripts harvesting Fixes: tags to
> help stable maintainers :-)

It seemed like potentially an existing issue so I did not want to limit how
far back it got applied.

> 
> - Arnaldo
> 
>> resulted in probes not being found e.g.
>>
>> 	$ sudo perf probe xsk_mmap
>> 	xsk_mmap is out of .text, skip it.
>> 	Probe point 'xsk_mmap' not found.
>> 	   Error: Failed to add events.
>>
>> maps__find_symbol_by_name() can optionally return the map of the found
>> symbol. It can get the map wrong because, in fact, the symbol is found
>> on the map's dso, not allowing for the possibility that the dso has more
>> than one map. Fix by always checking the map contains the symbol.
>>
>> Reported-by: Björn Töpel <bjorn.topel@...el.com>
>> Tested-by: Björn Töpel <bjorn.topel@...el.com>
>> Cc: stable@...r.kernel.org
>> Signed-off-by: Adrian Hunter <adrian.hunter@...el.com>
>> ---
>>
>>
>> Changes in V2:
>>
>> 	Expanded commit message
>> 	Corrected email address
>>
>>
>>  tools/perf/util/map.c | 11 +++++++++++
>>  1 file changed, 11 insertions(+)
>>
>> diff --git a/tools/perf/util/map.c b/tools/perf/util/map.c
>> index 3f07a587c8e6..354e54550d2b 100644
>> --- a/tools/perf/util/map.c
>> +++ b/tools/perf/util/map.c
>> @@ -574,6 +574,13 @@ struct symbol *map_groups__find_symbol(struct map_groups *mg,
>>  	return NULL;
>>  }
>>  
>> +static bool map__contains_symbol(struct map *map, struct symbol *sym)
>> +{
>> +	u64 ip = map->unmap_ip(map, sym->start);
>> +
>> +	return ip >= map->start && ip < map->end;
>> +}
>> +
>>  struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name,
>>  					 struct map **mapp)
>>  {
>> @@ -589,6 +596,10 @@ struct symbol *maps__find_symbol_by_name(struct maps *maps, const char *name,
>>  
>>  		if (sym == NULL)
>>  			continue;
>> +		if (!map__contains_symbol(pos, sym)) {
>> +			sym = NULL;
>> +			continue;
>> +		}
>>  		if (mapp != NULL)
>>  			*mapp = pos;
>>  		goto out;
>> -- 
>> 2.17.1
> 

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ