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:   Thu, 7 Jun 2018 09:00:25 +0800
From:   "Jin, Yao" <yao.jin@...ux.intel.com>
To:     Arnaldo Carvalho de Melo <acme@...nel.org>
Cc:     Jiri Olsa <jolsa@...nel.org>,
        Peter Zijlstra <peterz@...radead.org>,
        Ingo Molnar <mingo@...nel.org>,
        Alexander Shishkin <alexander.shishkin@...ux.intel.com>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Andi Kleen <andi@...stfloor.org>,
        Kan Liang <kan.liang@...el.com>
Subject: Re: [PATCH v2 2/3] perf script python: Add more PMU fields



On 6/7/2018 2:36 AM, Arnaldo Carvalho de Melo wrote:
> Em Fri, Jun 01, 2018 at 05:01:02PM +0800, Jin Yao escreveu:
> 
> <SNIP>
> 
>> +static int get_symoff(struct symbol *sym, struct addr_location *al,
>> +		      bool print_off, char *bf, int size)
>> +{
>> +	unsigned long offset;
>> +
>> +	if (!sym || !sym->name)
>> +		return scnprintf(bf, size, "%s", "[unknown]");
> 
>    52    54.22 ubuntu:17.04                  : FAIL gcc (Ubuntu 6.3.0-12ubuntu2) 6.3.0 20170406
> 
>    CC       /tmp/build/perf/util/scripting-engines/trace-event-python.o
> util/scripting-engines/trace-event-python.c:534:20: error: address of array 'sym->name' will always evaluate to 'true' [-Werror,-Wpointer-bool-conversion]
>          if (!sym || !sym->name)
>                      ~~~~~~^~~~
> 1 error generated.
> mv: cannot stat '/tmp/build/perf/util/scripting-engines/.trace-event-python.o.tmp': No such file or directory
> /git/linux/tools/build/Makefile.build:96: recipe for target '/tmp/build/perf/util/scripting-engines/trace-event-python.o' failed
> make[5]: *** [/tmp/build/perf/util/scripting-engines/trace-event-python.o] Error 1
> 
> Because:
> 
> struct symbol {
>          struct rb_node  rb_node;
>          u64             start;
>          u64             end;
>          u16             namelen;
> <SNIP>
>          char            name[0];
> };
> 
> It sym->name is not a pointer, in symbol's constructor we have:
> 
> struct symbol *symbol__new(u64 start, u64 len, u8 binding, u8 type, const char *name)
> {
>          size_t namelen = strlen(name) + 1;
>          struct symbol *sym = calloc(1, (symbol_conf.priv_size +
>                                          sizeof(*sym) + namelen));
>          if (sym == NULL)
>                  return NULL;
> <SNIP>
>          sym->namelen = namelen - 1;
>          memcpy(sym->name, name, namelen);
> 
>          return sym;
> }
> 
> So it is at least 1 char long, the test above should be:
> 
> 	if (!sym || !sym->name[0])
> 		return scnprintf(bf, size, "%s", "[unknown]");
> 
> I'm fixing this up here.
> 
> - Arnaldo
> 

Oh, yes, my mistake, very sorry about that.

Thanks for helping me to fix this.

Thanks
Jin Yao

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ