Received: by 2002:a05:7412:798b:b0:fc:a2b0:25d7 with SMTP id fb11csp622228rdb; Thu, 22 Feb 2024 14:12:02 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCWTrROBMo7PcL/PjJ/kqNSlLI0rnAGd+a3MCLe0zT148+8U6LHdFlc4xu6Rn2FG3S1JIGbfeksE55SvlDoIO5HXYjHoLVHZQmmqJIyhwg== X-Google-Smtp-Source: AGHT+IFkjkulq79gCaan3ghSUwCyqAOtTS2MLksBoT8RxqLJ9X1OJ5WVZ7AuijdeaT9FB8tQ6R8D X-Received: by 2002:a05:6a21:1707:b0:1a0:931c:a152 with SMTP id nv7-20020a056a21170700b001a0931ca152mr154284pzb.21.1708639922381; Thu, 22 Feb 2024 14:12:02 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1708639922; cv=pass; d=google.com; s=arc-20160816; b=bELDAGkyeUpyJvBpO4/ZeLe++qcZTF+yI1qEGbcbrPYG976hNH77N8gRIscDQV/Gdz 8shsJv8zcODqM+1XB2RyRd083Lr5GWQP9ATLwgqNabhH9bLN6F1uZJ9C9DEZHe7f5yYs 8s+ssb0h7l1ukgUmz4qpET+/gRFZOqD/xYTXZUoSkIm0yRwNG+r9tGuFcXOj12P7RS4E jKyCXhgJ4isoBn+bVUa/JiP9kM+ReOf9GSRY4OLjB0YIyyKYffl0XxL2nbcm4lx+mmiR W3UQ2QMWkl3k638CwcP1cXm1hg3UsDS5nDJfAcl2aMFI96DOpS15p+SMGBIfTG3Vhm2M kF/A== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:references:in-reply-to:message-id :subject:cc:to:from:date; bh=U3Td2V4P2xFXx3mC5NhPKmPqfFs7czQ2ExWm5lMaMCQ=; fh=UgJ1M/WLDuBX5Hd7iWpdBibTSPJm5+ZRhFuzMIW+uy0=; b=SaoZg9L0eY7qvDdAzIDQhXU2vVge+Y006s3V8WvIHv3b8swevH6AaDa72QFbcefWhW K2Vo6JEql9y0oyFDEJQrh0QZWFEjt85DTkT84PMPRHUFxaVvMwCkhusMQylMQ2y2NdoU 4rDJ0ENitdjqYR2rmKTLNj69ELdHeC6l2j0eh6w7nNcWV3AMqTrmRw+6NZpoCEeY8Ie9 sq7Zafm16c5bAuRj2P9mzMQBdKWha7OZ8goWLYcquDgdeRsyDUo9Kdnfrjm+TXaDwC4S Rla0So4aKFuf0UpSoSSxFch6Owu49PrMQyBcX7Bshfv62QWZDuCeTSHd4RRr9QEDZps3 TO+g==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-77450-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77450-linux.lists.archive=gmail.com@vger.kernel.org" Return-Path: Received: from sv.mirrors.kernel.org (sv.mirrors.kernel.org. [2604:1380:45e3:2400::1]) by mx.google.com with ESMTPS id e7-20020a056a001a8700b006e2f87df15dsi1112663pfv.140.2024.02.22.14.12.02 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 22 Feb 2024 14:12:02 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-77450-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) client-ip=2604:1380:45e3:2400::1; Authentication-Results: mx.google.com; arc=pass (i=1); spf=pass (google.com: domain of linux-kernel+bounces-77450-linux.lists.archive=gmail.com@vger.kernel.org designates 2604:1380:45e3:2400::1 as permitted sender) smtp.mailfrom="linux-kernel+bounces-77450-linux.lists.archive=gmail.com@vger.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 sv.mirrors.kernel.org (Postfix) with ESMTPS id 0275C288933 for ; Thu, 22 Feb 2024 22:12:02 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id 4C36512D21F; Thu, 22 Feb 2024 22:11:56 +0000 (UTC) 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 C46C073F20; Thu, 22 Feb 2024 22:11:55 +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=1708639915; cv=none; b=M4Vi89pxeT8CKgOv0hHnndMUpzByY2r70O0Ir0sNfHE5klAYt1Nm03ilK9G06HBA1osWeS+6aOf9T7+j9uHmhGAqa+CMn9vTAdPE4r2uHKh3NFlptXQz3rltp+Gk4wH2EizPa0To1w/jiOLHuETuCFCCPjb3sRSxdV8vD+t3QY4= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1708639915; c=relaxed/simple; bh=p+8uhwqkWinqy5UVg9deOCr1wsUGH7ZlNzrnMxbpJCk=; h=Date:From:To:Cc:Subject:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=HbFrHna5KoxRWNvRIxCaYRqoFi4ZIFfm52b8lShWOGOXjtsTCxy3DOiphSdTa1oUb5BXmbWH8E9o7GxTktscmB2xsGwzrpFH17B6jdVX6QsE2gbV9HrR7IU4MNjl6sSeQnBSEZkHW0EYQ9KbpquPSZ7lRC41szybgvn6QmjN5OY= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8F909C433F1; Thu, 22 Feb 2024 22:11:54 +0000 (UTC) Date: Thu, 22 Feb 2024 17:13:45 -0500 From: Steven Rostedt To: Beau Belgrave Cc: mhiramat@kernel.org, linux-kernel@vger.kernel.org, linux-trace-kernel@vger.kernel.org, mathieu.desnoyers@efficios.com Subject: Re: [PATCH v4 2/4] tracing/user_events: Introduce multi-format events Message-ID: <20240222171345.25b1a289@gandalf.local.home> In-Reply-To: <20240222001807.1463-3-beaub@linux.microsoft.com> References: <20240222001807.1463-1-beaub@linux.microsoft.com> <20240222001807.1463-3-beaub@linux.microsoft.com> X-Mailer: Claws Mail 3.19.1 (GTK+ 2.24.33; x86_64-pc-linux-gnu) 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=US-ASCII Content-Transfer-Encoding: 7bit On Thu, 22 Feb 2024 00:18:05 +0000 Beau Belgrave wrote: > Currently user_events supports 1 event with the same name and must have > the exact same format when referenced by multiple programs. This opens > an opportunity for malicous or poorly thought through programs to malicious? ;-) -- Steve > create events that others use with different formats. Another scenario > is user programs wishing to use the same event name but add more fields > later when the software updates. Various versions of a program may be > running side-by-side, which is prevented by the current single format > requirement. > > Add a new register flag (USER_EVENT_REG_MULTI_FORMAT) which indicates > the user program wishes to use the same user_event name, but may have > several different formats of the event. When this flag is used, create > the underlying tracepoint backing the user_event with a unique name > per-version of the format. It's important that existing ABI users do > not get this logic automatically, even if one of the multi format > events matches the format. This ensures existing programs that create > events and assume the tracepoint name will match exactly continue to > work as expected. Add logic to only check multi-format events with > other multi-format events and single-format events to only check > single-format events during find. > > Change system name of the multi-format event tracepoint to ensure that > multi-format events are isolated completely from single-format events. > This prevents single-format names from conflicting with multi-format > events if they end with the same suffix as the multi-format events. > > Add a register_name (reg_name) to the user_event struct which allows for > split naming of events. We now have the name that was used to register > within user_events as well as the unique name for the tracepoint. Upon > registering events ensure matches based on first the reg_name, followed > by the fields and format of the event. This allows for multiple events > with the same registered name to have different formats. The underlying > tracepoint will have a unique name in the format of {reg_name}.{unique_id}. > > For example, if both "test u32 value" and "test u64 value" are used with > the USER_EVENT_REG_MULTI_FORMAT the system would have 2 unique > tracepoints. The dynamic_events file would then show the following: > u:test u64 count > u:test u32 count > > The actual tracepoint names look like this: > test.0 > test.1 > > Both would be under the new user_events_multi system name to prevent the > older ABI from being used to squat on multi-formatted events and block > their use. > > Deleting events via "!u:test u64 count" would only delete the first > tracepoint that matched that format. When the delete ABI is used all > events with the same name will be attempted to be deleted. If > per-version deletion is required, user programs should either not use > persistent events or delete them via dynamic_events. > > Signed-off-by: Beau Belgrave