Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1565292lqe; Mon, 8 Apr 2024 12:43:52 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCV3X55VGT8Uv+sa0lSOTSmZfkBCmk+ivZGbE+3+zY6XrkBLl4ERHab6q/NTpsd15q2ogi72fgecJ3x7h8eksVbeZ4TRGkmH1wL1bcF7qQ== X-Google-Smtp-Source: AGHT+IFXLz+/YEKBAJmRNi3XhqaF7uBjAobPJk/tqZPAcHW/3W+GMU8LYH1YYahld0MK6zWDHnCo X-Received: by 2002:a05:6122:4496:b0:4d4:1e99:7c8f with SMTP id cz22-20020a056122449600b004d41e997c8fmr6723532vkb.6.1712605431900; Mon, 08 Apr 2024 12:43:51 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712605431; cv=pass; d=google.com; s=arc-20160816; b=08hR/TTVKG4vznzWmuLsiyVrSGjuPcvwEAC6AKWPkJ5DXpOzTDogkng5yZsdmWmCgP EGVUWnXi19Ou8j4RI/d5S95RggD8SuWkYs3KLk3CijxdfFLz8mEcgCyR2/Vt0Xg/01Ol o5x+ppiLiQMuomudsXQOQRGXzyV96QJylfjhcv/IXLYJDCMoWWJFO95WCfxwex8UTPUf S39HK0YX18wK6LR5gYj88mhRSmGKIXavoqNqRTxFtoz8FuKHSkUSISyjbyE0iWpc9KVc +I8N73SJxPs2+93MoZFAU7ZnCI5VK91JWJpEXZwMZs16keudPS2kIjFMVphybbk6/tpe MOXQ== 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=Hg0iM1vo1ZsAkkfHfQpqeSmYnxn1/XT60DFnMGK6CLU=; fh=v+N/Oq7Y+xxEY/agZ83bYkkjv4EtseprpiPyUdMNa5s=; b=UotvztaX7yskJrmeJ0sDYkty8XEn5Em1RNHltmFCAn9tvYG8vAk3ra8iXan1ziRSV+ NXA/kgGnGBPO+A4Gi0GWraMU5FhfmPuOX48m+XJy71dXL0Nvi5iajpVTDLHT1/bJjJeK GG6vwXsuN5MAcsqAvK1OimcfPhQf1F6oTUzVH51N7hUdVHdpkFhj2I30ywr5lISW5os7 decvUx+cqg81OoqMvS9zu0VCrf7+Thyio9+uN/lwfJgSplsWEA6d4v2QNxprZxxX3iDw BaI9ZZ1aJLkX1LFnoNId4H9trtk0O0B8RAalf18cQPRBRqAyzwqyuMPk3vDjR6h1CC7a Sazg==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uWxjxI3s; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-135882-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135882-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from ny.mirrors.kernel.org (ny.mirrors.kernel.org. [2604:1380:45d1:ec00::1]) by mx.google.com with ESMTPS id dg7-20020a056214084700b0069b1e8ae955si2286889qvb.200.2024.04.08.12.43.51 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 12:43:51 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135882-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) client-ip=2604:1380:45d1:ec00::1; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=uWxjxI3s; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-135882-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45d1:ec00::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135882-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 ny.mirrors.kernel.org (Postfix) with ESMTPS id 9B0ED1C2173F for ; Mon, 8 Apr 2024 19:43:51 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 28050146007; Mon, 8 Apr 2024 19:43:46 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="uWxjxI3s" 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 4D84A1448D9 for ; Mon, 8 Apr 2024 19:43:44 +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=1712605425; cv=none; b=U5DmZzzZv4LI+kWXbL4zZDNo0NgC1vmwWqeErjSLX4FZpfe1koBik92kWpf/LzWd6DBfDaLL8SW+CUPQbAGL8NI0j5qQREEh5PT/av4cGlXgwxkwjwyURr7XTB5FjBBlm+K7SrmXKYrKdyM13aYD0NCDnSl9762mbUpYQLyC0ds= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712605425; c=relaxed/simple; bh=BkSTcCa7P95+0xNGk9pfPNydAixF7fgFE/gIk/vA5No=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=P12nBgC6v9MNSxL0ShE1hbRLeh4c6GT2sjIRzRuJnY9iLzolnivgB0IpwJWNv0z6Hs5xupsnrux9eiuzfn+T1ySxbyHxDaiem2dvq3WKNNhzNjiYWKlqKjFa8dCfLBKu9yJWl+xzQr6k8DnKG4X+LT9gyUkHGQtF2K25ljrvH1Q= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=uWxjxI3s; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 4F4ABC433C7; Mon, 8 Apr 2024 19:43:44 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712605424; bh=BkSTcCa7P95+0xNGk9pfPNydAixF7fgFE/gIk/vA5No=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=uWxjxI3saf/KYjm7wbLcynNdlmqhP9L76BhQNVUs2UkIu7nX7TdTl4Hh/LHPCkybJ 9qZ5a9MwGMqqkC8INOWrl4IuFpyW627NMvI2GDsTcZeTabSPHzIguKGlF5GeX8/ahJ E7Yr+U0u3jfF1cV50+OjaBsaC4tqtfO50ANFmPuKndSm53gZ4LuRM3sHI5IxG4YFgQ OgBXFiV4sEn1ZGqxYkqsrgzP0AQKJI7dB4sirbzeT+9iQr3caPuDvN8CDbEFe3IyiW 99TTaKAJX5qM9QE/Lb52zS8lqKL0cKKxKKWNNuE99f7uThk8dpjicVy6jwchk7e+uW I5GG7TEdSkcJQ== Date: Mon, 8 Apr 2024 21:43:41 +0200 From: Frederic Weisbecker To: Ian Rogers Cc: LKML , Peter Zijlstra , Ingo Molnar , Arnaldo Carvalho de Melo , Namhyung Kim , Mark Rutland , Alexander Shishkin , Jiri Olsa , Adrian Hunter 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: 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. Thanks. > > Thanks, > Ian > > > -- > > 2.44.0 > >