Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1582781lqe; Mon, 8 Apr 2024 13:20:43 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCW+l/BQICRDWtb+6ERKlIwTMasQzE8pfyq38V9h7x6RxqBrLhpZ/Oa3ORiLSBeVFesgiLVW9d/NgR0cKFdWYmL7JDQYeO0ZnQIBYOjxYg== X-Google-Smtp-Source: AGHT+IEC60K85+rTve3pKrQxKY2SbLJZlUpK+lzpxfiKLvPZ46JxziuG95NShjrW2Moi5zDVz5HY X-Received: by 2002:a05:6871:3790:b0:22f:70da:1f26 with SMTP id nq16-20020a056871379000b0022f70da1f26mr2463188oac.27.1712607643125; Mon, 08 Apr 2024 13:20:43 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712607643; cv=pass; d=google.com; s=arc-20160816; b=LSoxs2UVn3meYGy2I47Q0F7y1PPZ2n5ZevEsLGcMnYs+7GLOWnkrpJKELMPChJtiFh mR6JG+OyFtgVwd44UiG8uP508qVmsMsPuTettyh9fPXuPsCAeYXvbRhbxBusVe4iADoC 9134cnf22hn2EUu88Xn3WlkAZtkAMej8xLTVauNRf8P1W2njR9LrYyMet+XKTtcBsS5p 5EOfTphVqvGMonudmOY1tZvod92GNszWr2ASwTVb5K8aeU53tzndZr/FgXP2UA6jSwvG cGHkrV90GybPFPdmtV1vYeKS6+6NWKgrF/UKOZA2n9kFa2f0FvVBrkLL/sSdkuGTjfwr gMOQ== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=in-reply-to:content-transfer-encoding:content-disposition :mime-version:list-unsubscribe:list-subscribe:list-id:precedence :references:message-id:subject:cc:to:from:date:dkim-signature; bh=cEvt4mmcsY5BXxXrOj1hMlx/vNQBq8mGfAs3pR8XVmg=; fh=9SDla3RpruwNVv1+rs5E+pkOgjPayvhK6E0Hv3ENb0M=; b=t4TQ284JMLcuR/tuHBBbUiWjNseo+HssTDb8plsYZ5c4Mkd1x7TmodoqnLtV7TT24r GllcX8+Q9Rxsz1Oph/nN8r0IaFDnOXZbycW7EEoB5fhliemuUBCJy/GPTo3tn75OmmT/ nCWD2OcfHi+Aof9PYdoe26fAwL2dA+1tNxlCTLeTL/7lkdt7rewdHUtfLYs4fKL3ee0b w+1/T7Vl54v1kfCQkRKbiqUPVeqkYic+Tmb/SLtIDV2G1IxKpjIcrQUMrgABVM16SzRV zd2AkkYkIgCgu31mErk7qyq/PnqYWNP+gPDwbbXsvmEFi4hmtOY6l7tO/DJAkslXq81d PWSQ==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IKhoxQPo; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-135903-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135903-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [2604:1380:40f1:3f00::1]) by mx.google.com with ESMTPS id h6-20020a654046000000b005cee9117ef6si6935511pgp.810.2024.04.08.13.20.42 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 13:20:43 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135903-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) client-ip=2604:1380:40f1:3f00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=IKhoxQPo; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-135903-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:40f1:3f00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135903-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Received: from smtp.subspace.kernel.org (wormhole.subspace.kernel.org [52.25.139.140]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by sy.mirrors.kernel.org (Postfix) with ESMTPS id AB8F7B2260E for ; Mon, 8 Apr 2024 20:20:39 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 53479146A8D; Mon, 8 Apr 2024 20:20:32 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="IKhoxQPo" 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 738F7146596; Mon, 8 Apr 2024 20:20:31 +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=1712607631; cv=none; b=c6Juh6Em/Kw/6PqWmLvMzjH4BxqxBF5aSp2gcYkyClsQ8qeJWXmrpdKYur/B2u8HNWqTgEvbMsV/CQY82Ac2zh0PZgXt2lG1oTo6tC3JRl2GepbZdghV3TyHHMYIvRcSgLfCAiybNDj4KFX4TQ5VXkfQCRj1aZAIV6qeDFUvqN4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712607631; c=relaxed/simple; bh=fMWbEIfqpElLex0+WVwRKS2fcQkne1Z6iZmaYL1f1Pk=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=V2nV1S/guPX7oex+4nVeqMF3Py7VmZ4lGmrX8Xtzde//0ZFyQnUQ/l9QhszdOxQUBpL7mb/qDPx5j03d33FNvCrR/5A/ADHyt+blHo3ZOCWT3p9c72/tIU/ZQApgO/c2ab9QXE68N1vu8T5/qzX8tvNQD3g0sgi5S8Cj9oiZyvw= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=IKhoxQPo; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 9E554C433C7; Mon, 8 Apr 2024 20:20:30 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712607631; bh=fMWbEIfqpElLex0+WVwRKS2fcQkne1Z6iZmaYL1f1Pk=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=IKhoxQPo21g0SByjZ2E69k0VeN1f5f7D8eGYt64qmcAAmgl3Aqgo0mSEWeWNkt45p r85T2jr0G0yfSKV6JkYwwRXeN3RO/C+MeksNAfG8xy2lNpyWPLzG8ytNw/R7fNw8wT /TdWHE4YEJWI6/zj95JBGq76XK964L+aGWw41XkpgJJQrmNa7RlW5dY3PA8k78zxgX rHDVQttScyVhyorlf/9qEPeIPUZp2e7vVhPR+sM+6LL/n9guBLrbv7E91YyimuPcCo 6dqDA++QnEw/Ci827q+U1vFPBqqzWOhNr6aOOQ8aYP7gRHqtWrLZCM8HEHIJaxthMT GEgPu6R5w/jog== Date: Mon, 8 Apr 2024 17:20:27 -0300 From: Arnaldo Carvalho de Melo To: Frederic Weisbecker , Sebastian Andrzej Siewior Cc: Ian Rogers , LKML , Peter Zijlstra , Ingo Molnar , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter , Thomas Gleixner , linux-perf-users@vger.kernel.org Subject: Re: [PATCH 0/4] perf: Fix leaked events when sigtrap = 1 Message-ID: References: <20240329235812.18917-1-frederic@kernel.org> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: On Mon, Apr 08, 2024 at 09:43:41PM +0200, Frederic Weisbecker wrote: > Le Fri, Mar 29, 2024 at 08:23:49PM -0700, Ian Rogers a écrit : > > On Fri, Mar 29, 2024 at 4:58 PM Frederic Weisbecker wrote: > > > > > > While looking at task_work users I just noticed that perf doesn't flush > > > its own upon event exiting. This looks especially problematic with child > > > events. Please have a thourough look at the last patch, I may easily > > > have missed something within the maze. > > > > > > Frederic Weisbecker (4): > > > task_work: s/task_work_cancel()/task_work_cancel_func()/ > > > task_work: Introduce task_work_cancel() again > > > perf: Fix event leak upon exit > > > perf: Fix event leak upon exec and file release > > > > > > include/linux/perf_event.h | 1 + > > > include/linux/task_work.h | 3 ++- > > > kernel/events/core.c | 40 +++++++++++++++++++++++++++++++------- > > > kernel/irq/manage.c | 2 +- > > > kernel/task_work.c | 34 +++++++++++++++++++++++++++----- > > > security/keys/keyctl.c | 2 +- > > > 6 files changed, 67 insertions(+), 15 deletions(-) > > > > Thanks for this! I wonder if this relates to fuzzing failures like: > > https://lore.kernel.org/linux-perf-users/CAP-5=fUa+-Tj2b_hxk96Qg5=Qu7jYHgHREbsmBa2ZmuF-X9QaA@mail.gmail.com/ > > "[ 2519.138665] unexpected event refcount: 2; ptr=000000009c56b097" > > Probably not since those seem to happen on perf_event_open() failures. This > looks different. Probably clashes with this one? "[PATCH v3 0/4] perf: Make SIGTRAP and __perf_pending_irq() work on RT." https://lore.kernel.org/all/20240322065208.60456-1-bigeasy@linutronix.de/T/#u - Arnaldo