Re: [PATCH 00/12] Add the page size in the perf record (user tools)

Liang, Kan
2020-11-30T14:00:41Z

On 11/27/2020 3:22 PM, Jiri Olsa wrote:
> hi,
> I can't compile this on Fedora 32, check the log below
>

The patch set was compiled with GCC 9. I will install a GCC 10 and fix
all the warnings.

Thanks,
Kan

> jirka
>
>
> ---
> $ make JOBS=1
> BUILD: Doing 'make -j1' parallel build
> Warning: Kernel ABI header at 'tools/include/uapi/linux/perf_event.h' differs from latest version at 'include/uapi/linux/perf_event.h'
> diff -u tools/include/uapi/linux/perf_event.h include/uapi/linux/perf_event.h
> CC util/parse-events.o
> CC util/session.o
> util/session.c: In function ‘machines__deliver_event’:
> util/session.c:1278:37: error: ‘%lu’ directive output may be truncated writing between 1 and 20 bytes into a region of size 10 [-Werror=format-truncation=]
> 1278 | snprintf(str, PAGE_SIZE_NAME_LEN, "%lu%c", size, suffixes[i]);
> | ^~~
> util/session.c:1278:36: note: directive argument in the range [1, 18446744073709551615]
> 1278 | snprintf(str, PAGE_SIZE_NAME_LEN, "%lu%c", size, suffixes[i]);
> | ^~~~~~~
> In file included from /usr/include/stdio.h:867,
> from /home/jolsa/kernel/linux-perf/tools/lib/perf/include/perf/cpumap.h:6,
> from util/session.c:13:
> /usr/include/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output between 3 and 22 bytes into a destination of size 10
> 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 68 | __bos (__s), __fmt, __va_arg_pack ());
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> util/session.c:1278:37: error: ‘%lu’ directive output may be truncated writing between 1 and 20 bytes into a region of size 10 [-Werror=format-truncation=]
> 1278 | snprintf(str, PAGE_SIZE_NAME_LEN, "%lu%c", size, suffixes[i]);
> | ^~~
> util/session.c:1278:36: note: directive argument in the range [1, 18446744073709551615]
> 1278 | snprintf(str, PAGE_SIZE_NAME_LEN, "%lu%c", size, suffixes[i]);
> | ^~~~~~~
> In file included from /usr/include/stdio.h:867,
> from /home/jolsa/kernel/linux-perf/tools/lib/perf/include/perf/cpumap.h:6,
> from util/session.c:13:
> /usr/include/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output between 3 and 22 bytes into a destination of size 10
> 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 68 | __bos (__s), __fmt, __va_arg_pack ());
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> util/session.c: In function ‘get_page_size_name’:
> util/session.c:1278:37: error: ‘%lu’ directive output may be truncated writing between 1 and 20 bytes into a region of size 10 [-Werror=format-truncation=]
> 1278 | snprintf(str, PAGE_SIZE_NAME_LEN, "%lu%c", size, suffixes[i]);
> | ^~~
> util/session.c:1278:36: note: directive argument in the range [1, 18446744073709551615]
> 1278 | snprintf(str, PAGE_SIZE_NAME_LEN, "%lu%c", size, suffixes[i]);
> | ^~~~~~~
> In file included from /usr/include/stdio.h:867,
> from /home/jolsa/kernel/linux-perf/tools/lib/perf/include/perf/cpumap.h:6,
> from util/session.c:13:
> /usr/include/bits/stdio2.h:67:10: note: ‘__builtin___snprintf_chk’ output between 3 and 22 bytes into a destination of size 10
> 67 | return __builtin___snprintf_chk (__s, __n, __USE_FORTIFY_LEVEL - 1,
> | ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> 68 | __bos (__s), __fmt, __va_arg_pack ());
> | ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
> cc1: all warnings being treated as errors
> make[4]: *** [/home/jolsa/kernel/linux-perf/tools/build/Makefile.build:97: util/session.o] Error 1
> make[3]: *** [/home/jolsa/kernel/linux-perf/tools/build/Makefile.build:139: util] Error 2
> make[2]: *** [Makefile.perf:647: perf-in.o] Error 2
> make[1]: *** [Makefile.perf:233: sub-make] Error 2
> make: *** [Makefile:70: all] Error 2