Received: by 2002:ab2:3350:0:b0:1f4:6588:b3a7 with SMTP id o16csp1598333lqe; Mon, 8 Apr 2024 13:59:01 -0700 (PDT) X-Forwarded-Encrypted: i=3; AJvYcCXKuQT70qz558a8scrzcnvueL/bRmZsAqudvHaxI2N7Soh3Uc2SBmAnbFnDoRoVGGmtc8lJd5Ii8ymWGhX8LLJWj3leswrI4HEtv4a4Iw== X-Google-Smtp-Source: AGHT+IHxMzlrljRYAEMs1dtymv7R+B2Wq0WXJL40nCITUohUv+MfbDlZjqSZnxeHFn4KuWVulMXb X-Received: by 2002:a50:8d14:0:b0:56c:2785:ca34 with SMTP id s20-20020a508d14000000b0056c2785ca34mr5942282eds.5.1712609941674; Mon, 08 Apr 2024 13:59:01 -0700 (PDT) ARC-Seal: i=2; a=rsa-sha256; t=1712609941; cv=pass; d=google.com; s=arc-20160816; b=qrNJD82NmMV4OXJN4qZWMwdn5got04jaELiIs1QbOSVSNUzLsacxJVcDWzHIu7qZ82 Ptqf8AGOCsQdPg1sTtMCbRVh5fTD54dpUfKdrW6zWaJ1FCEOZj4Us/G3cIcrS0G5kg58 d1O6l2LrSuykxmUqLRlB6QNWABBkiZcAGO50Qhj3LmBM+NMD/EuKjty4Xjrm5u88f+Um ocw7RreqAkTiQS3kVkERK5o8rtPOJuevSL9t2HUdqbLkzJ6WnMknq0bfvNou8OcyzvqN uj89rOA2N67sHrOS6pYE/L3sgyoW2ksskTtNDRpjzkwh5wA0zE8JGq3nL0tTAs0LxGNz pEbg== 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=BcJS1TBMgnEm38kX1bqA8oeV2q2wVUH5Hbq6bo7npZU=; fh=QuBWxR5IHaW4D9e1wvbw/FozFqL0z+FamncYcVJFlAA=; b=GMncCPPrktOwd23V4pawSVw+ibEzW+NaZaUayUY8R7+hCpRPyRzFBTvZToVhdiVms0 1KYe/BFuZF5blvCAbM/jUUSWXe2yQQCgoltuO8x3WJ86es8FHrZSZwXlG6eMW2BfKjZp tdtgHDK7qij0M/WKuCna0Gn67eLj6Hm+A/8vG4nztigqGrJ2hMway1WUyYGzFFb8YOVG KIjZHvYOGSyOZ2NMXcxsk9jir9IZVBPMAHTjQc670ELD+6daFl4QdEuKXEl5m8wEvY5q RLfdv4Nw0O1QZxdT/jwAccKbB/51h9MJdil70n0PN7iX1y7oKGdeJZalkjpV58l1yVAJ njJw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dB8VNrrK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-135926-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135926-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=kernel.org Return-Path: Received: from am.mirrors.kernel.org (am.mirrors.kernel.org. [2604:1380:4601:e00::3]) by mx.google.com with ESMTPS id c11-20020a509f8b000000b0056e22357f83si4129052edf.633.2024.04.08.13.59.01 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 08 Apr 2024 13:59:01 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel+bounces-135926-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) client-ip=2604:1380:4601:e00::3; Authentication-Results: mx.google.com; dkim=pass header.i=@kernel.org header.s=k20201202 header.b=dB8VNrrK; arc=pass (i=1 dkim=pass dkdomain=kernel.org); spf=pass (google.com: domain of linux-kernel+bounces-135926-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:4601:e00::3 as permitted sender) smtp.mailfrom="linux-kernel+bounces-135926-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 am.mirrors.kernel.org (Postfix) with ESMTPS id 66B001F2329A for ; Mon, 8 Apr 2024 20:59:01 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 63DCC147C64; Mon, 8 Apr 2024 20:58:55 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="dB8VNrrK" 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 89B0F1EB46; Mon, 8 Apr 2024 20:58:54 +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=1712609934; cv=none; b=R0dH2H7QnkKTx2qsHml3OXMVsi3CpgjIO7U/UGxgzM5w9AyaOlttrOyR0k6PBD46DHRnO/oMuMNHNaRZXFoJ0dKven8WLK6s/krZN00r5MXk4pSC55i5h2f0B2xDA2BmjL7Ys5utOeiqY6u0XJai7y7no8y9+FfBHKqLJDMj0nI= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1712609934; c=relaxed/simple; bh=RivaelhbL8/R2Cq/U40S9EoXUuV3ar3kkSKVrsKkD5o=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=h/chz0fEd8EAbLYm0Ss3fjMTINS8oVeIENsonxGWPq1QurLw7rVmaBmN8bzdll7FBCt4ctP5cSpRfOhq0nuCup6M9Idqd2RyIXgGxP4NBo+Fa/hwkDo3oyfyYtDZY3WJuqdrqTjUqyHm3LWca2swwaH7BOKmqRGcHehpF7e7Y54= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=dB8VNrrK; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id CC297C433C7; Mon, 8 Apr 2024 20:58:53 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1712609934; bh=RivaelhbL8/R2Cq/U40S9EoXUuV3ar3kkSKVrsKkD5o=; h=Date:From:To:Cc:Subject:References:In-Reply-To:From; b=dB8VNrrKnfxdSYX24RUGwsY507ar92cFxs2Z8aq8tQhWOdLwCUmAjfjW9hlhGec73 70ZZpZh3RlmUii4yn7UvP3FbHr8ukhibrAbcdQEslDHeXY4/w1vL2rwM9qMsCyjUhA 0nJM2wOn/o33xP9Pu8T1C6ZBQPcWC3gEsEV4K9sOJ65i5kJUyirrI4PNzNNaeKERGW 0ys7HfQ8eyC6/LfsxFPG/PJH4qLsIcwa5NF1T8QV2otwTquyedrOQG26BDGB1V7hxC dlkoCXFTZ456xuiBF2etG9Fxihvzpzmlgx5TU04xRONZJKr1ERWi82BxqFg1cVM19L yfuhSpSA5jZfw== Date: Mon, 8 Apr 2024 22:58:51 +0200 From: Frederic Weisbecker To: Arnaldo Carvalho de Melo Cc: Sebastian Andrzej Siewior , 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: Le Mon, Apr 08, 2024 at 05:20:27PM -0300, Arnaldo Carvalho de Melo a écrit : > 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 Nice, I think it partially fixes the issues I've seen. Lemme review that. Thanks. > > - Arnaldo