Received: by 2002:a05:6358:3188:b0:123:57c1:9b43 with SMTP id q8csp16533202rwd; Mon, 26 Jun 2023 11:14:37 -0700 (PDT) X-Google-Smtp-Source: ACHHUZ4WuPPV1fIqbsqt/z4r7bKanThpJDGV/WnjbdooRQ3ozobSQpDsSS93IcBtD0ABh2r7nvsp X-Received: by 2002:a05:6a21:6d87:b0:127:1658:33ea with SMTP id wl7-20020a056a216d8700b00127165833eamr5088049pzb.62.1687803277130; Mon, 26 Jun 2023 11:14:37 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1687803277; cv=none; d=google.com; s=arc-20160816; b=DFVCDL8JySrItznCnKlrzJJuEpBIDolp0LHAjf8lJ/MnFEflCQz0j1UP4gT1U8RzYH 8LN38btsMqNYWH/36oMMBuQ51/A9bre2b0ui9IgWPDBfkzXYuZtGjtmxqmNJK59qUWD2 DO+JiyjgZ2lV1wrF9NHgLmbDuiXtbulwUuxfmOhkQytf9ZpNQTPzv4rzAAh5prLjxRjb gxNEZnQvRv3/wR37/kq8ouI3gJ7LtklUJo+GJ1L+dkqaApJsUHjlIYcVjReTZa+UUdes yVH7iDPcW0ez7GvcDRICeWUpdeRvwhB4V7KqrBc7VMP34GNZQKYkHxoeLtsebjq6yVi9 PbSw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:cc:to:subject :message-id:date:from:in-reply-to:references:mime-version :dkim-signature; bh=jJkVz7XfPaiiXBKEk1U5bzLHSYhr7kzJhkshlyUDZB8=; fh=jlWaj7J3CFoFNlmE1SXnZuXEHJHGG1l5TaqLGzoBSbc=; b=qR5FQLF0Iute7rU+RZVchym+jSSN2DSRgl0hTr/Ua+FDtLQYeZjP3jaRLRPbwVAkTX V+QI7yKfVI3u+L5AeoXwyzBGgJhQ+pdCcgC0m2mTOiORZ8IQRF96778204RnU91EGARn oyI96/gWgLH3IeiQfej4oqteaYifPgIJJRYSfQchzOrA8UQfMeMDSbND3dOfM2na4w+3 Seq2Mkt76gLBpR4Z2uKNHETO+gRtB9/sefAdAAQl6yTYGupiA+v1m65tmAcdG9XzXtcm LLkqXpsFe3CYRSduMu7Ui7yAE11j/aqXYKj1glfxP78X6LVtsgyWt6PanczsRlZAWde+ TcOg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=6IP+GRZj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id q17-20020a056a00085100b00654355ac8a5si5538737pfk.56.2023.06.26.11.14.21; Mon, 26 Jun 2023 11:14:37 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@google.com header.s=20221208 header.b=6IP+GRZj; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=REJECT sp=REJECT dis=NONE) header.from=google.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S230454AbjFZRkt (ORCPT + 99 others); Mon, 26 Jun 2023 13:40:49 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36814 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230487AbjFZRk3 (ORCPT ); Mon, 26 Jun 2023 13:40:29 -0400 Received: from mail-pl1-x630.google.com (mail-pl1-x630.google.com [IPv6:2607:f8b0:4864:20::630]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id C02CA30FB for ; Mon, 26 Jun 2023 10:39:19 -0700 (PDT) Received: by mail-pl1-x630.google.com with SMTP id d9443c01a7336-1b5520cf4adso16915ad.0 for ; Mon, 26 Jun 2023 10:39:19 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20221208; t=1687801100; x=1690393100; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:from:to:cc:subject:date :message-id:reply-to; bh=jJkVz7XfPaiiXBKEk1U5bzLHSYhr7kzJhkshlyUDZB8=; b=6IP+GRZjZygbvUl7rwhvTT9JaO1TZ13SneUgmoT/ueQsST6HjJhIV9RNHrL5Ivsa6Y XZfc5Prb1WSen3uDoGb4WdXVlDF9Hojz9khjfB0WtvgyWUByJVxXQqxOfwWMOIT44H3l lYIClHfDbgN58iUcol4oPfRX1Yhh5URoquP29uQAqKyiudehb7m13JoSj/E+hDLEKFKC MWNsDUP0dDUjRWnjJ14aySwSCQ/GNI1FKDX6PXuBlgQ1SweBzxJ9/22PySX9ZSFKlB5v +fsPnR7Ly3LfWHO0UL7q4iK1g6rO788kWSYWdkHcGIIFS9rabdCNZaRct7aDJowft3+9 AbEw== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20221208; t=1687801100; x=1690393100; h=content-transfer-encoding:cc:to:subject:message-id:date:from :in-reply-to:references:mime-version:x-gm-message-state:from:to:cc :subject:date:message-id:reply-to; bh=jJkVz7XfPaiiXBKEk1U5bzLHSYhr7kzJhkshlyUDZB8=; b=HHvRJccCHuawxxHrxbMlTuO0Kd7uqbur3DOwYKd4a2BbNcpWmi6J0NldEzQEh6rCea mtG4zezPDB7BUfc3EY5U/qHgtwvrB2qzVIV0pjo2UWhZ+41aFOByID12KJW6L73pnGTM BSJGaGTnniOH96PbNu7ehGirVwKTZy14Qwf3LKJYicswbW2SDacULp8djwHBjAau3gHi lnJV+JrblXSIPCS1gI7LPL5Z5HAUmfJ6rmsO74nRtLOjaGOY5O/xPDEZOKAcHcLt0JsU rpamd4TOwW9PiauCuhUIJlD37uuz8STUifqRCvhfJeCo42Nzj3u/xRuOQD+nM0VS/L1x QG2g== X-Gm-Message-State: AC+VfDz6nsc02914QH4qUZn9D7+FDxon1vKeYBzcT+jUidZXMl1+6WLB VEN8oA2yPlrWsePn3QPOygjxW50heO+EptqEZBHsYA== X-Received: by 2002:a17:903:2301:b0:1af:e5e0:a33e with SMTP id d1-20020a170903230100b001afe5e0a33emr1581037plh.7.1687801099715; Mon, 26 Jun 2023 10:38:19 -0700 (PDT) MIME-Version: 1.0 References: <20230623043107.4077510-1-irogers@google.com> <64741e8e-e81a-afb9-9ce3-9c2d6baab44a@web.de> <35569055-0873-4d5d-8c9c-78c818e9aa26@moroto.mountain> In-Reply-To: <35569055-0873-4d5d-8c9c-78c818e9aa26@moroto.mountain> From: Ian Rogers Date: Mon, 26 Jun 2023 10:38:07 -0700 Message-ID: Subject: Re: [PATCH v2] perf unwind: Fix map reference counts To: Dan Carpenter Cc: Sasha Levin , Markus Elfring , linux-perf-users@vger.kernel.org, kernel-janitors@vger.kernel.org, Adrian Hunter , Alexander Shishkin , Arnaldo Carvalho de Melo , Ingo Molnar , Ivan Babrou , Jiri Olsa , Mark Rutland , Namhyung Kim , Peter Zijlstra , LKML , cocci@inria.fr Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Spam-Status: No, score=-17.6 required=5.0 tests=BAYES_00,DKIMWL_WL_MED, DKIM_SIGNED,DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF, ENV_AND_HDR_SPF_MATCH,RCVD_IN_DNSWL_NONE,SPF_HELO_NONE,SPF_PASS, T_SCC_BODY_TEXT_LINE,USER_IN_DEF_DKIM_WL,USER_IN_DEF_SPF_WL autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Mon, Jun 26, 2023 at 5:42=E2=80=AFAM Dan Carpenter wrote: > > On Fri, Jun 23, 2023 at 10:49:36AM -0700, Ian Rogers wrote: > > > > > > How do you think about to add the tag =E2=80=9CFixes=E2=80=9D? > > > > In general we've not been adding Fixes as there is a danger a backport > > will introduce a use-after-free. > > I feel like we have been discussing issues around Perf backports > recently. Wasn't there some build breakage that wasn't detected? Why > not just ask Sasha to leave perf out of the -stable tree? > > Also Sasha has a tag to explain that patch AAA is included because > patch BBB depends on it. I feel like maybe those tags are backwards, > it would be nicer to tag AAA as depending on BBB. That way we could > add the dependency tags here. > > I think at Linaro we have recently been testing taking the latest Perf > tools and using them on older kernels. I don't know the details around > why we can't just use the perf that ships with the kernel... Using the perf tool that ships with the kernel should be fine but the perf tool is backward compatible with older kernels. There are new features, such as using BPF for kernel lock analysis, that are available in the latest perf tool and so it could be nice to have these available/tested on older kernels. > To tell the truth, I also don't really understand the problem for this > patch specifically. From what I can see, the Fixes tag would have been: > > Fixes: 0dd5041c9a0e ("perf addr_location: Add init/exit/copy functions") No, the issue is fixing a long standing problem in the perf tool where reference counting has been broken. We have implemented a poor man's RAII using leak analysis and these patches stem from that, but the errant code pre-dates it. Fwiw, more details on the reference count checker is here: https://perf.wiki.kernel.org/index.php/Reference_Count_Checking > 1) Adding a Fixes tag would have automatically prevented any backports. > 2) I don't see any possible use after frees. That probably means I have > identified the wrong Fixes tag? You'd need tests that stress libunwind unwinding, such as "perf top -g". Prior to the reference count checker work the code contained unnecessary gets to avoid lowering reference counts and causing use-after-free (a memory leak considered less bad than crashing). By backporting the code you are taking part of the fix and potentially creating a new problem. Thanks, Ian > I'm not going to dig further than that because I don't care. I'm just > looking at it because Markus added kernel-janitors to the CC list. But > for subsystems where I'm more involved then I always look at how a bug > is introduced. That information is essential to me as a reviewer. So > if I'm writing a patch and even if it's not a bug fix but let's say it > deletes dead code then I often include include the information under the > --- cut off line. > > --- > This dead code was introduced by commit 23423423 ("blah blah blah"). > > regards, > dan carpenter