[tip:,perf/urgent] perf: Fix check before add_event_to_groups() in perf_group_detach()
Message ID | 167891408482.5837.1916820071250811928.tip-bot2@tip-bot2 |
---|---|
State | New |
Headers |
Return-Path: <linux-kernel-owner@vger.kernel.org> Delivered-To: ouuuleilei@gmail.com Received: by 2002:a5d:604a:0:0:0:0:0 with SMTP id j10csp126789wrt; Wed, 15 Mar 2023 14:13:10 -0700 (PDT) X-Google-Smtp-Source: AK7set/Dj5tYbvfT3pMRAaa99yf051VvTAWn+sGM3n0ZD/zdSkSUXYGXvRwYGCy5jRaiyxuCByYx X-Received: by 2002:a17:902:ea0e:b0:19e:f315:98c with SMTP id s14-20020a170902ea0e00b0019ef315098cmr908645plg.57.1678914790240; Wed, 15 Mar 2023 14:13:10 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1678914790; cv=none; d=google.com; s=arc-20160816; b=SK1Rxypa/rzym32dCuFNV0OQ9mDhIdwp+adgqWRrOXp5+nAI/f7orEMGxamidM3cwF OtrQDBhBKt+bJQlTZoPnhlLm+x/Y4V5Je00nJDRRUuxR9Wry9jRs/38frWlhM81JPTWh t/eDw26B6c3XmtUsKPJi7uukefLlDyJldJn2jcUYn6q5WHsd6INo2SRAHMN2/zm21wet ojd2ydEWlqXqSRG7rA9wdYYFg+RwH5Rovt2MOVTEzK4YX9ymcUPJzw8gdLaI9Rk1CAtr PN7ZYkQe7NEye2K/+o0HUh8cDh5XLKBwPGPEdQpox4I9l/oVUzkA98JbCOCytAolymC6 0Mxg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:robot-unsubscribe :robot-id:message-id:mime-version:references:in-reply-to:cc:subject :to:reply-to:sender:from:dkim-signature:dkim-signature:date; bh=rQDe+aTeE4qENndIwz1O+WFE52XvI5+P/zTU+CioWGI=; b=BnyCRL/EpoUoCydJ9DRn1Mp4C03uyQjflJ+8adpZhBdCD7S3onRqQxcwy+kQH2Iffi W+qGYAnof9d6XA/u37mZTNz/FkE/y3mbAkkfCadxru6VvICSQ7d1bVSBpI7/b4ElZ+MG 4nnOngDjJ7SW8wyXCRbewbzvQT9TzihI4LYgeODYGOnciPcYIVIi2Se3mOxlld2oe14X +6BzOy8Ew4sopbhbD7IQtq679Bpcl+8SRQ3fDjnfnuqM6WVa4vQjfenH4lzmG3FXR0QY lkSWxnr/jq0ZCvFK/EicwS6JnhjcCK3DJFYf7K3RoOXJzfVRbGXAP5hRdMdPb9OkhSCW 0GKg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linutronix.de header.s=2020 header.b=3tmcIHL9; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=oaO34zHg; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e5-20020a17090301c500b00199200945a3si6459347plh.74.2023.03.15.14.12.56; Wed, 15 Mar 2023 14:13:10 -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=@linutronix.de header.s=2020 header.b=3tmcIHL9; dkim=neutral (no key) header.i=@linutronix.de header.s=2020e header.b=oaO34zHg; 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=NONE sp=QUARANTINE dis=NONE) header.from=linutronix.de Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231820AbjCOVDG (ORCPT <rfc822;ruipengqi7@gmail.com> + 99 others); Wed, 15 Mar 2023 17:03:06 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:36104 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231971AbjCOVDE (ORCPT <rfc822;linux-kernel@vger.kernel.org>); Wed, 15 Mar 2023 17:03:04 -0400 Received: from galois.linutronix.de (Galois.linutronix.de [IPv6:2a0a:51c0:0:12e:550::1]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 29666A2193; Wed, 15 Mar 2023 14:02:35 -0700 (PDT) Date: Wed, 15 Mar 2023 21:01:24 -0000 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020; t=1678914086; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rQDe+aTeE4qENndIwz1O+WFE52XvI5+P/zTU+CioWGI=; b=3tmcIHL9ZgTfFFqhjE6SYTd6+fF6JZsHb0OjbEOwgxVlKac159KtqjoIKTvvkNuLjopUOj IoCsy0t7jVy638x1LW4fjWzM/KiNbDKNU8mJe5G/8V3ZZAJ5qFRGwut2mqIboW7RSaU/HS L+0G4ArNziCU9KHYJetNwTlmGWYJcND8XJFZuN9GEF1cWUvJi8Xruag6kSF7BNGyj2S4iR AH9x/gOl0+AberMiTRdXmq0QYZfMZTWxL7DxWg8HHlijAcSvVTrP25INMKtSKaDGyB9Z16 pixa5moefti9ynWTlIB6503ZEsC6074uVGDupdDuQG2rNXYv5kcCB8Mvy/lKvQ== DKIM-Signature: v=1; a=ed25519-sha256; c=relaxed/relaxed; d=linutronix.de; s=2020e; t=1678914086; h=from:from:sender:sender:reply-to:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references; bh=rQDe+aTeE4qENndIwz1O+WFE52XvI5+P/zTU+CioWGI=; b=oaO34zHgrXlq27uIrPDl2B4fNXAHj/KEA03NTcDMPBFo27ul9nd8Ub+HLgfruzL4FhhB4U FhGAYuDsql9I9WCA== From: "tip-bot2 for Budimir Markovic" <tip-bot2@linutronix.de> Sender: tip-bot2@linutronix.de Reply-to: linux-kernel@vger.kernel.org To: linux-tip-commits@vger.kernel.org Subject: [tip: perf/urgent] perf: Fix check before add_event_to_groups() in perf_group_detach() Cc: Budimir Markovic <markovicbudimir@gmail.com>, "Peter Zijlstra (Intel)" <peterz@infradead.org>, x86@kernel.org, linux-kernel@vger.kernel.org In-Reply-To: <ZBFzvQV9tEqoHEtH@gentoo> References: <ZBFzvQV9tEqoHEtH@gentoo> MIME-Version: 1.0 Message-ID: <167891408482.5837.1916820071250811928.tip-bot2@tip-bot2> Robot-ID: <tip-bot2@linutronix.de> Robot-Unsubscribe: Contact <mailto:tglx@linutronix.de> to get blacklisted from these emails Content-Type: text/plain; charset="utf-8" Content-Transfer-Encoding: 7bit X-Spam-Status: No, score=-4.4 required=5.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,SPF_HELO_NONE, SPF_PASS,URIBL_BLOCKED autolearn=ham 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: <linux-kernel.vger.kernel.org> X-Mailing-List: linux-kernel@vger.kernel.org X-getmail-retrieved-from-mailbox: =?utf-8?q?INBOX?= X-GMAIL-THRID: =?utf-8?q?1760469755005889709?= X-GMAIL-MSGID: =?utf-8?q?1760469755005889709?= |
Series |
[tip:,perf/urgent] perf: Fix check before add_event_to_groups() in perf_group_detach()
|
|
Commit Message
tip-bot2 for Thomas Gleixner
March 15, 2023, 9:01 p.m. UTC
The following commit has been merged into the perf/urgent branch of tip: Commit-ID: fd0815f632c24878e325821943edccc7fde947a2 Gitweb: https://git.kernel.org/tip/fd0815f632c24878e325821943edccc7fde947a2 Author: Budimir Markovic <markovicbudimir@gmail.com> AuthorDate: Wed, 15 Mar 2023 00:29:01 -07:00 Committer: Peter Zijlstra <peterz@infradead.org> CommitterDate: Wed, 15 Mar 2023 21:49:47 +01:00 perf: Fix check before add_event_to_groups() in perf_group_detach() Events should only be added to a groups rb tree if they have not been removed from their context by list_del_event(). Since remove_on_exec made it possible to call list_del_event() on individual events before they are detached from their group, perf_group_detach() should check each sibling's attach_state before calling add_event_to_groups() on it. Fixes: 2e498d0a74e5 ("perf: Add support for event removal on exec") Signed-off-by: Budimir Markovic <markovicbudimir@gmail.com> Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org> Link: https://lkml.kernel.org/r/ZBFzvQV9tEqoHEtH@gentoo --- kernel/events/core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/kernel/events/core.c b/kernel/events/core.c index 52b4aa0..fb3e436 100644 --- a/kernel/events/core.c +++ b/kernel/events/core.c @@ -2163,7 +2163,7 @@ static void perf_group_detach(struct perf_event *event) /* Inherit group flags from the previous leader */ sibling->group_caps = event->group_caps; - if (!RB_EMPTY_NODE(&event->group_node)) { + if (sibling->attach_state & PERF_ATTACH_CONTEXT) { add_event_to_groups(sibling, event->ctx); if (sibling->state == PERF_EVENT_STATE_ACTIVE)