Linux Perf Users
 help / color / mirror / Atom feed
From: sashiko-bot@kernel.org
To: "Ian Rogers" <irogers@google.com>
Cc: linux-perf-users@vger.kernel.org, kvm@vger.kernel.org,
	bpf@vger.kernel.org
Subject: Re: [RFC PATCH 16/16] perf test: Add PERF_SAMPLE_HOST_IP symbolization, sorting, and ASLR tests
Date: Tue, 01 Dec 2026 23:40:14 +0000	[thread overview]
Message-ID: <sashiko-outbox-244425@kernel.org> (raw)
In-Reply-To: <20261201232116.1988791-17-irogers@google.com>

Thank you for your contribution! Sashiko AI review found 1 potential
issue to consider:
- [Low] perf test: missing reset_output_field() on setup_sorting() error
  path
--

commit 27b0696436e8693a733c90ea5666e742b5cfaa44
Author: Ian Rogers <irogers@google.com>

perf test: Add PERF_SAMPLE_HOST_IP symbolization, sorting, and ASLR tests

This commit adds a C test suite for PERF_SAMPLE_HOST_IP covering guest-to-host
symbolization fallback, histogram sorting and formatting for host sort keys,
and ASLR anonymization of sampled host_ip values.

> diff --git a/tools/perf/tests/host-ip-sym.c b/tools/perf/tests/host-ip-sym.c
> new file mode 100644
> index 0000000000000..b2acf08446e94
> --- /dev/null
> +++ b/tools/perf/tests/host-ip-sym.c
> @@ -0,0 +1,691 @@

[ ... ]

> +static int test__host_ip_hist_sort(struct test_suite *test __maybe_unused,
> +				   int subtest __maybe_unused)
> +{

[ ... ]

> +	field_order = NULL;
> +	sort_order = "host_dso,host_sym,host_ip";
> +	if (setup_sorting(/*evlist=*/NULL, machines.host.env) < 0)
> +		goto out_machines;
> +	perf_hpp__init();

[ ... ]

> +	/*
> +	 * Verify collapsing a sample with host_ip == 0 into an existing
> +	 * comm-sorted entry preserves valid host_ms.map/sym references.
> +	 */
> +	delete_all_hist_entries(hists);
> +	reset_output_field();
> +	sort_order = "comm";
> +	if (setup_sorting(/*evlist=*/NULL, machines.host.env) < 0)
> +		goto out_machines;
> +	perf_hpp__init();
> +
> +	if (add_guest_hist_sample(evsel, guest_machine, TEST_GUEST_IP, TEST_HOST_IP1) ||
> +	    add_guest_hist_sample(evsel, guest_machine, TEST_GUEST_IP + 4, 0))
> +		goto out_hists;
> +
> +	hists__collapse_resort(hists, NULL);
> +	evsel__output_resort(evsel, NULL);
> +	node = rb_first_cached(&hists->entries);
> +	if (!node)
> +		goto out_hists;
> +	he = rb_entry(node, struct hist_entry, rb_node);
> +	if (he->stat.period != 200 || !he->host_ms.map || !he->host_ms.sym ||
> +	    strcmp(he->host_ms.sym->name, "dax_guest_hot_fn") != 0) {
> +		pr_debug("Collapsing sample with host_ip=0 corrupted host_ms\n");
> +		goto out_hists;
> +	}
> +
> +	ret = TEST_OK;
> +out_hists:
> +	delete_all_hist_entries(hists);
> +	reset_output_field();
> +	sort_order = NULL;
> +out_machines:

[Severity: Low]
Should both setup_sorting() failure paths jump to out_hists (or a label that
calls reset_output_field() and clears sort_order) instead of out_machines?
If setup_sorting() fails part-way through, jumping to out_machines leaks any
perf_hpp_fmt and hpp_sort_entry objects already linked onto perf_hpp_list and
leaves global sort_order and dimension state dirty for subsequent tests in
the same process.

-- 
Sashiko AI review · https://sashiko.dev/#/patchset/20261201232116.1988791-1-irogers@google.com?part=16

  reply	other threads:[~2026-12-01 23:40 UTC|newest]

Thread overview: 24+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-01 23:21 [RFC PATCH 00/16] perf, kvm: Add PERF_SAMPLE_HOST_IP for host-side guest symbolization Ian Rogers
2026-12-01 23:21 ` [RFC PATCH 01/16] perf/core: Add PERF_SAMPLE_HOST_IP sample format Ian Rogers
2026-12-01 23:21 ` [RFC PATCH 02/16] perf/core, bpf: Support BPF filtering of mmap_data events Ian Rogers
2026-12-01 23:21 ` [RFC PATCH 03/16] KVM: Add NMI-safe guest-to-host IP translation infrastructure Ian Rogers
2026-12-01 23:40   ` sashiko-bot
2026-12-01 23:21 ` [RFC PATCH 04/16] KVM: x86: Implement kvm_arch_vcpu_get_ip_gpa() Ian Rogers
2026-12-01 23:21 ` [RFC PATCH 05/16] KVM: arm64: " Ian Rogers
2026-12-01 23:41   ` sashiko-bot
2026-12-01 23:21 ` [RFC PATCH 06/16] KVM: riscv: " Ian Rogers
2026-12-01 23:21 ` [RFC PATCH 07/16] KVM: loongarch: " Ian Rogers
2026-12-01 23:21 ` [RFC PATCH 08/16] tools headers UAPI: Sync linux/perf_event.h with the kernel sources Ian Rogers
2026-12-01 23:21 ` [RFC PATCH 09/16] perf tools: Add PERF_SAMPLE_HOST_IP parsing, synthesis, and record --host-ip Ian Rogers
2026-12-01 23:36   ` sashiko-bot
2026-12-01 23:21 ` [RFC PATCH 10/16] perf symbol: Support host IP resolution and guest fallback symbolization Ian Rogers
2026-12-01 23:21 ` [RFC PATCH 11/16] perf report, script: Add host_ip, host_dso, and host_sym fields Ian Rogers
2026-12-01 23:41   ` sashiko-bot
2026-12-01 23:21 ` [RFC PATCH 12/16] perf record: Synthesize hypervisor file-backed data mappings for --host-ip Ian Rogers
2026-12-01 23:21 ` [RFC PATCH 13/16] perf record: Filter runtime hypervisor data mmaps with BPF " Ian Rogers
2026-12-01 23:43   ` sashiko-bot
2026-12-01 23:21 ` [RFC PATCH 14/16] perf bpf-filter: Support host_ip in BPF sample filters Ian Rogers
2026-12-01 23:21 ` [RFC PATCH 15/16] perf aslr: Anonymize sampled host_ip values Ian Rogers
2026-12-01 23:21 ` [RFC PATCH 16/16] perf test: Add PERF_SAMPLE_HOST_IP symbolization, sorting, and ASLR tests Ian Rogers
2026-12-01 23:40   ` sashiko-bot [this message]
2026-12-01 23:43 ` [RFC PATCH 00/16] perf, kvm: Add PERF_SAMPLE_HOST_IP for host-side guest symbolization sashiko-bot

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=sashiko-outbox-244425@kernel.org \
    --to=sashiko-bot@kernel.org \
    --cc=bpf@vger.kernel.org \
    --cc=irogers@google.com \
    --cc=kvm@vger.kernel.org \
    --cc=linux-perf-users@vger.kernel.org \
    --cc=sashiko-reviews@lists.linux.dev \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox