perf c2c hardening
Status from this message: Applied to perf-tools-next, thanks!
Get series with b4
b4 am [email protected]Versions newest first · linked by author and title
- v8 Latest2 patches 6 repliesApplied
- v72 patches 0 repliesSuperseded
- v62 patches 0 repliesSuperseded
Earlier versions · 5
| Version | Posted | Patches | Replies | Status |
|---|---|---|---|---|
| v5 | 1 of 2 patches | 0 replies | Superseded | |
| v4 | 2 patches | 1 reply | Superseded | |
| v3 | 2 patches | 0 replies | Superseded | |
| v2 | 2 patches | 0 replies | Superseded | |
| v1 | 2 patches | 0 replies | Superseded |
Changes since v5 ([email protected]) from the cover letter
- The second v5 patch didn't go through, resending the same contents
Patches in v8 Applied
| # | Subject and files | Size | Replies | Applied |
|---|---|---|---|---|
| 1/2 | perf c2c: Fix error masking, OOM, and unchecked caller errors in hpp_list__parse()tools/ tools/ | +112 | 1 reply | |
| 2/2 | perf c2c: Clean up registered formats on c2c_hists__init() and c2c_hists__reinit() failuretools/ | +18 | 1 reply |
Reviews trailers per patch
All 2 patches have a Reviewed-by or Acked-by.
| Patch | Ian Rogers |
|---|---|
| 1/2 | R-b |
| 2/2 | R-b |
Trailers given in replies are filled; those carried in the patches from earlier versions are outlined with dashes.
Cover letter [PATCHES v8 0/2] perf c2c hardening
Hi,
Please consider merging,
Two hardening fixes for perf c2c found by the sashiko-bot AI reviewer.
Patch 1 fixes error masking, OOM, and unchecked caller errors in hpp_list__parse(): the strdup() return values are now checked, PARSE_LIST was turned into a function that bails out on any error returned by the parsing callbacks (including -ENOMEM), and the two callers bailing out with the newly propagated errors, setup_sort_list() and setup_output_list(), now break out of their token loops and propagate the error instead of silently overwriting it on the next iteration.
Patch 2 fixes a format list leak: when c2c_hists__[re]init() fails partway through, entries registered via perf_hpp_list__column_register() and perf_hpp_list__register_sort_field() are left on the hpp_list. The fix moves cleanup into c2c_hists__init()/c2c_hists__reinit() themselves so all callers are protected.
This series was developed with AI assistance (Claude:Sonnet 4.6 and Opencode:mimo-v2.5-free for the changes up to v7; the changes since v7, including the setup_sort_list()/setup_output_list() -ENOMEM propagation fix and the c2c_hists__reinit() cleanup amendment, with Opencode:DeepSeek-V4-Flash-free).
- Arnaldo
Changes since v7 ([email protected]):
Patch 1:
- Addressed sashiko-bot [Medium] finding: with sort_dimension__add() and output_field_add() now propagating -ENOMEM (and other errors), the callers setup_sort_list() and setup_output_list() only checked for -EINVAL and -ESRCH, so an allocation failure was silently overwritten when the next loop iteration ran. Both callers now break out of their token loops on any error and propagate it.
Changes since v6 ([email protected]):
Patch 2:
- c2c_hists__reinit() has the same leak: it clears the list then calls hpp_list__parse(), which can register formats before failing, and neither the function nor its callers clean up on failure. Add the same cleanup-on-failure pattern to close this gap.
Changes since v5 ([email protected]):
- The second v5 patch didn't go through, resending the same contents
as v5.
Changes since v4 ([email protected]):
- Replace %m with str_error_r(-ret) as suggested by sashiko.
Changes since v3 ([email protected]):
- Use 'goto out' to break out from both the switch and the for loop in __hpp_list__parse() as noticed by sashiko.
Changes since v2 ([email protected]):
- Added the string.h and stdlib.h missing headers.
- Addressed sashiko comment on PARSE_LIST, turning it into a function and handling all errors returned from _fn().
Changes since v1 ([email protected]):
- Addressed sashiko-bot [Medium] finding: the early exits added by v1 skip perf_hpp__setup_output_field(), making undetected errors in the callers consequential. Fixed by propagating the error through resort_cl_cb() and perf_c2c__report() (hists__iterate_cb() already propagated callback return values).
- Dismissed sashiko-bot [Low] finding (missing string.h/stdlib.h):
strdup() and free() were already used in this function before this patch; string2.h (included at the top of the file) pulls in string.h. No new library calls were introduced.
- Subject updated to reflect the additional caller fixes.
Arnaldo Carvalho de Melo (2):
perf c2c: Fix error masking, OOM, and unchecked caller errors in hpp_list__parse() perf c2c: Clean up registered formats on c2c_hists__init() and c2c_hists__reinit() failure
tools/perf/builtin-c2c.c | 105 ++++++++++++++++++++++++++++++---------- tools/perf/util/sort.c | 76 ++++++++++++++++++++++------- 2 files changed, 130 insertions(+), 52 deletions(-)
---
Arnaldo Carvalho de Melo (2):
perf c2c: Fix error masking, OOM, and unchecked caller errors in
hpp_list__parse()
perf c2c: Clean up registered formats on c2c_hists__init() and
c2c_hists__reinit() failure
tools/perf/builtin-c2c.c | 106 ++++++++++++++++++++++++++++----------- tools/perf/util/sort.c | 76 +++++++++++++++++++--------- 2 files changed, 130 insertions(+), 52 deletions(-)
Signature · 1 line
2.55.0