perf tools fixes for v5.12: 3rd batch

- Fix wrong LBR block sorting in 'perf report'.
 
 - Fix 'perf inject' repipe usage when consuming perf.data files.
 
 - Avoid potential buffer overrun when decoding ARM SPE hardware tracing
   packets, bug found using a fuzzer.
 
 Signed-off-by: Arnaldo Carvalho de Melo <acme@redhat.com>
 -----BEGIN PGP SIGNATURE-----
 
 iHUEABYIAB0WIQR2GiIUctdOfX2qHhGyPKLppCJ+JwUCYHCd+AAKCRCyPKLppCJ+
 J2FjAP9m+5RUppmssRK3CCEmcsvxhbtfpKnGMQJzRdR8A+fIKgEA+DN7UBqSUexW
 oTUqu51DkYwYMr/6FS3zea2ELoHI0wI=
 =xUDW
 -----END PGP SIGNATURE-----

Merge tag 'perf-tools-fixes-for-v5.12-2020-04-09' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux

Pull perf tool fixes from Arnaldo Carvalho de Melo:

 - Fix wrong LBR block sorting in 'perf report'

 - Fix 'perf inject' repipe usage when consuming perf.data files

 - Avoid potential buffer overrun when decoding ARM SPE hardware tracing
   packets, bug found using a fuzzer

* tag 'perf-tools-fixes-for-v5.12-2020-04-09' of git://git.kernel.org/pub/scm/linux/kernel/git/acme/linux:
  perf arm-spe: Avoid potential buffer overrun
  perf report: Fix wrong LBR block sorting
  perf inject: Fix repipe usage
This commit is contained in:
Linus Torvalds 2021-04-09 17:12:31 -07:00
Родитель adb2c4174f 92f1e8adf7
Коммит 9288e1f7d3
3 изменённых файлов: 7 добавлений и 5 удалений

Просмотреть файл

@ -906,7 +906,7 @@ int cmd_inject(int argc, const char **argv)
}
data.path = inject.input_name;
inject.session = perf_session__new(&data, true, &inject.tool);
inject.session = perf_session__new(&data, inject.output.is_pipe, &inject.tool);
if (IS_ERR(inject.session))
return PTR_ERR(inject.session);

Просмотреть файл

@ -210,8 +210,10 @@ static int arm_spe_do_get_packet(const unsigned char *buf, size_t len,
if ((hdr & SPE_HEADER0_MASK2) == SPE_HEADER0_EXTENDED) {
/* 16-bit extended format header */
ext_hdr = 1;
if (len == 1)
return ARM_SPE_BAD_PACKET;
ext_hdr = 1;
hdr = buf[1];
if (hdr == SPE_HEADER1_ALIGNMENT)
return arm_spe_get_alignment(buf, len, packet);

Просмотреть файл

@ -201,7 +201,7 @@ static int block_total_cycles_pct_entry(struct perf_hpp_fmt *fmt,
double ratio = 0.0;
if (block_fmt->total_cycles)
ratio = (double)bi->cycles / (double)block_fmt->total_cycles;
ratio = (double)bi->cycles_aggr / (double)block_fmt->total_cycles;
return color_pct(hpp, block_fmt->width, 100.0 * ratio);
}
@ -216,9 +216,9 @@ static int64_t block_total_cycles_pct_sort(struct perf_hpp_fmt *fmt,
double l, r;
if (block_fmt->total_cycles) {
l = ((double)bi_l->cycles /
l = ((double)bi_l->cycles_aggr /
(double)block_fmt->total_cycles) * 100000.0;
r = ((double)bi_r->cycles /
r = ((double)bi_r->cycles_aggr /
(double)block_fmt->total_cycles) * 100000.0;
return (int64_t)l - (int64_t)r;
}