From nobody Sun Feb 8 15:28:34 2026 Received: from mail-dl1-f73.google.com (mail-dl1-f73.google.com [74.125.82.73]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id DA26122157B for ; Sun, 11 Jan 2026 04:13:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=74.125.82.73 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768104828; cv=none; b=osryVUt8oDWeGiExDfAKCwwl6Me53dhf9ASBe5iOzgR3mcIzu+YAe9TfYXjdHq0JVfJZ1tFtfNByd95cTFq8wERn69UtKmhiO1s4puWXeDb575LyVP8k7Q4czo44O2eyZYQGXKRux0nRsrMYSd3wJ8B8cHvq3tHrjA+s/BLd9pg= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1768104828; c=relaxed/simple; bh=LiM4wPnnfXt1IrKia0iYPEU/QsY83NzXUE/8uw4ggh4=; h=Date:In-Reply-To:Mime-Version:References:Message-ID:Subject:From: To:Content-Type; b=sobmfYTSRNW+TLSs146r4ovwk7BiCqbl32PXsj/P9x7uzNNJCJHQlAUhorRuC+6PijDKjGMogcYX35gJZWw5MXnxIQcqst8U3qoxfEnkf0DUTiHiDIx6yb+LL0VJ51iJpuxtgk8PeZ6ysfUd3g/qleq5e1KD8EqXw5UPxZ8E9aE= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b=14NzTJmJ; arc=none smtp.client-ip=74.125.82.73 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=reject dis=none) header.from=google.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=flex--irogers.bounces.google.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=google.com header.i=@google.com header.b="14NzTJmJ" Received: by mail-dl1-f73.google.com with SMTP id a92af1059eb24-121b1cb8377so7897468c88.0 for ; Sat, 10 Jan 2026 20:13:46 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20230601; t=1768104826; x=1768709626; darn=vger.kernel.org; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :from:to:cc:subject:date:message-id:reply-to; bh=7WlJfatNqFviEdPO7ixNChUO369/E+qRmLtBoNvsLZg=; b=14NzTJmJItv9kX7LipISbRIaBlz+wnMuh/l7GoJsoWrD7CeCiZUADq7RudojUiUEX1 Hic2V1PysOQOFXa0HXdtkfcnR8/BgphbzfPygZ0APvSLSaS59HW4ln8fKEcVizjLuWk7 HE25OnmSWAIY6qlmYuwk/ZKioRsXW7Z6dgRbH1j++gAseGhE2NmpTaCCruqcW6Oqrsmp 74Q3WEGZ0u+I/jCY0czr0ydIGaOdMTLE0uTOgaUndj6ppiLc2/GSTPWP0twNeXVzbQp+ vmmQX2bt7B/seY67IqP/zBhDmJ4e3lGOfl7I03hOsDQM3YCdAW5z8m2ZZQS4nFHsPCyY Xmmg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20230601; t=1768104826; x=1768709626; h=to:from:subject:message-id:references:mime-version:in-reply-to:date :x-gm-message-state:from:to:cc:subject:date:message-id:reply-to; bh=7WlJfatNqFviEdPO7ixNChUO369/E+qRmLtBoNvsLZg=; b=tNHzTps/kvdkcks11jn+EzB15icNeeMQz5O8qg2A9Bap6fp0k7Iv+COSRxFmKMaXDV jn2+Cl8MMpyHbmPh8+fOeCXJk1o5mpfyrLpNVeEQoZElc/h3nXS3TASZrJs/a7wjYmlf yKWvYhyDXiENXgLRaM+N7/olG3F+8KxESV2udbBFSTXGbL6pEVo9QAMdV2nvwN+iVj4O 2PnmFS428bJuGznwv8PVVJr62P5qHy3tuVL3zgczTzxs1KcmUyIwO+nSgyfykO1DKENl 7EgvYRKhBOa6cMPOluHYuynpQ91MiX3o6K28NLiWW/qbQCCJo2ip5NiNUfAEQ7tLfr5b qklg== X-Forwarded-Encrypted: i=1; AJvYcCW+hQEAhonVWaBnPj5Su+Tut88eHwlT2YcEyQXCewbscWRISHv4tbArlAtMG+J8LsNtHm17Gvj19J7bdc0=@vger.kernel.org X-Gm-Message-State: AOJu0Yy9eEXQEqIcFYe5ijT3lB1DXGheaeODGkST2AlkBk4AXqMfNPf2 TAdSgEdZkzuyWh0oCitaZ54Xz/kdMfgtXeh/9TH/8EEGp7WtDuLjs/jC3p0YQQ6WzgXj1QFpib3 nIdkYO8qF9A== X-Google-Smtp-Source: AGHT+IEpwPdXc4Q3lwXPOPSrlts+LFdhUOl0o1F42tMjY39XaGnLW0K8ZwodeKhZ9IPGKj2hKxeB+uK2/M51 X-Received: from dlbeq5.prod.google.com ([2002:a05:7022:2605:b0:123:171f:e390]) (user=irogers job=prod-delivery.src-stubby-dispatcher) by 2002:a05:7022:62a0:b0:11f:3483:bbb2 with SMTP id a92af1059eb24-121f8b160a4mr14112685c88.12.1768104825871; Sat, 10 Jan 2026 20:13:45 -0800 (PST) Date: Sat, 10 Jan 2026 20:13:32 -0800 In-Reply-To: <20260111041338.1817056-1-irogers@google.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: Mime-Version: 1.0 References: <20260111041338.1817056-1-irogers@google.com> X-Mailer: git-send-email 2.52.0.457.g6b5491de43-goog Message-ID: <20260111041338.1817056-2-irogers@google.com> Subject: [PATCH v3 1/7] perf unwind-libdw: Fix invalid reference counts From: Ian Rogers To: Tony Jones , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Alexander Shishkin , Jiri Olsa , Ian Rogers , Adrian Hunter , James Clark , Howard Chu , Stephen Brennan , linux-kernel@vger.kernel.org, linux-perf-users@vger.kernel.org Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" The addition of addr_location__exit causes use-after put on the maps and map references in the unwind info. Add the gets and then add the map_symbol__exits. Fixes: 0dd5041c9a0e ("perf addr_location: Add init/exit/copy functions") Signed-off-by: Ian Rogers --- tools/perf/util/unwind-libdw.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/tools/perf/util/unwind-libdw.c b/tools/perf/util/unwind-libdw.c index ae70fb56a057..3ff427a49e4c 100644 --- a/tools/perf/util/unwind-libdw.c +++ b/tools/perf/util/unwind-libdw.c @@ -136,8 +136,8 @@ static int entry(u64 ip, struct unwind_info *ui) } =20 e->ip =3D ip; - e->ms.maps =3D al.maps; - e->ms.map =3D al.map; + e->ms.maps =3D maps__get(al.maps); + e->ms.map =3D map__get(al.map); e->ms.sym =3D al.sym; =20 pr_debug("unwind: %s:ip =3D 0x%" PRIx64 " (0x%" PRIx64 ")\n", @@ -325,6 +325,9 @@ int unwind__get_entries(unwind_entry_cb_t cb, void *arg, if (err) pr_debug("unwind: failed with '%s'\n", dwfl_errmsg(-1)); =20 + for (i =3D 0; i < ui->idx; i++) + map_symbol__exit(&ui->entries[i].ms); + dwfl_end(ui->dwfl); free(ui); return 0; --=20 2.52.0.457.g6b5491de43-goog