From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id B7CE934250D; Sat, 28 Feb 2026 17:32:57 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772299977; cv=none; b=V6KFZfo08Psh6tkJtle0x0nZGqD6JSG+GyrqhTBwZtahRkjbenLOT4Z0eInwnkCL5WQ8QCX4PIgyHU+iYj1x3x9BYFpR2Tapw7I99t1ZzDYIH1rtBBtX9jCL/v5peDjAP8uZ3dYUKtWubEd/jekhlKoJmnKf0P7Ys9I0XmsZiF4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1772299977; c=relaxed/simple; bh=krid9cOIMHTsvZ7Qjdu//AWrJ+QyM9fIZuFb2ch7s6o=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version; b=SBlb20Y6dDZQ6tEZBa1tchVkO/hYL5ps02vvAzjU7x31y1/ozUegkZh5n+6gWRc2Mgm/VXg5o6dpYK7vf3/xCcCd5zvSnF5lyjmuMPgtSp7xnnlCB7nGWdZMZ09VcnVDyfM2Msr+79NEXf/Pm1UL3dyHF4YFYJH0DWbOqveFFag= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=XKB5ykSG; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="XKB5ykSG" Received: by smtp.kernel.org (Postfix) with ESMTPSA id ED57FC19423; Sat, 28 Feb 2026 17:32:55 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1772299977; bh=krid9cOIMHTsvZ7Qjdu//AWrJ+QyM9fIZuFb2ch7s6o=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=XKB5ykSGvHqRdhLsAf9ZlK63PHe0KCIXa2OF9xYsV+CCYIJb5/tIRZS3Oe7PRC453 YysnhuW0ps1KIEBPqVxcl/huMNZv7cxPIdw12RkuD9eFs6Os0EjRQfw3hAHqdv9uuw L8XXt7l3bEbvyStjdTY+02wVhxA3F8xMS1+MRQBvpMsHRSgCP0QoNDOzS8pQr+4JJg hjc9jL6dHEK8WtMfNqy8cP8wU6SQP0ZMhD1GutL33fjeSrmF98CDGVWks374Zx44M+ BoQed6j2GDG2KKMIELYmAPN06jLqm7ZBW751jeS/ubWZgnAh6H+hza2cMh7KvbjkQu f+oCkLu+jAAwQ== From: Sasha Levin To: linux-kernel@vger.kernel.org, stable@vger.kernel.org Cc: Ian Rogers , James Clark , Adrian Hunter , Alexander Shishkin , Howard Chu , Ingo Molnar , Jiri Olsa , Namhyung Kim , Peter Zijlstra , Stephen Brennan , Tony Jones , Arnaldo Carvalho de Melo , Sasha Levin Subject: [PATCH 6.19 007/844] perf unwind-libdw: Fix invalid reference counts Date: Sat, 28 Feb 2026 12:18:40 -0500 Message-ID: <20260228173244.1509663-8-sashal@kernel.org> X-Mailer: git-send-email 2.51.0 In-Reply-To: <20260228173244.1509663-1-sashal@kernel.org> References: <20260228173244.1509663-1-sashal@kernel.org> Precedence: bulk X-Mailing-List: stable@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 X-stable: review X-Patchwork-Hint: Ignore Content-Transfer-Encoding: 8bit From: Ian Rogers [ Upstream commit f815fc0c66e777c727689666cfb46b8d461c2f99 ] 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__exit() calls. Fixes: 0dd5041c9a0eaf8c ("perf addr_location: Add init/exit/copy functions") Reviewed-by: James Clark Signed-off-by: Ian Rogers Cc: Adrian Hunter Cc: Alexander Shishkin Cc: Howard Chu Cc: Ingo Molnar Cc: Jiri Olsa Cc: Namhyung Kim Cc: Peter Zijlstra Cc: Stephen Brennan Cc: Tony Jones Signed-off-by: Arnaldo Carvalho de Melo Signed-off-by: Sasha Levin --- 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 ae70fb56a0572..3ff427a49e4c5 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) } e->ip = ip; - e->ms.maps = al.maps; - e->ms.map = al.map; + e->ms.maps = maps__get(al.maps); + e->ms.map = map__get(al.map); e->ms.sym = al.sym; pr_debug("unwind: %s:ip = 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)); + for (i = 0; i < ui->idx; i++) + map_symbol__exit(&ui->entries[i].ms); + dwfl_end(ui->dwfl); free(ui); return 0; -- 2.51.0