From patchwork Mon Jun 10 17:13:15 2024 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Stefan Hajnoczi X-Patchwork-Id: 803020 Delivered-To: patch@linaro.org Received: by 2002:adf:f147:0:b0:35b:5a80:51b4 with SMTP id y7csp2050687wro; Mon, 10 Jun 2024 10:15:47 -0700 (PDT) X-Forwarded-Encrypted: i=2; AJvYcCVgJ3jw4NFcqKMqG2DLb+4iD7F/xp9IzngXQHzfNemWsoTwxoU+2TUBkM2UTGTXtL1x8kHKkJxNhum6NZytuBdd X-Google-Smtp-Source: AGHT+IHHneSs36IY0cM4L7DshlF/e+cNzp6QDicDNw//s0f6qCeq1W8ock4kfxh0UdY3vjcz7bSR X-Received: by 2002:a67:e443:0:b0:48c:436d:7bd9 with SMTP id ada2fe7eead31-48c436d7c62mr3193864137.35.1718039747250; Mon, 10 Jun 2024 10:15:47 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1718039747; cv=none; d=google.com; s=arc-20160816; b=dsGku8KJoDhT+IkxRSwrx8cwV8vk85e1BzEBlPaVVkcZ5QrtA2+3zSZHlBfBVleDr7 yh9KzGmsoQNtZ3ZEC43e5jMHrtbN2ubfpxVe5gG/dcj42yj5+KQgwdoMGERxfLiQYYDg eejQxaA/CTfpSI8LbfTjzesGA5192WeZfkZ+N3yxiG9jktnU6I6HPkBRQbiVqH4Qcf7P p5n4cGMMg/kbi5e96fUemkFKOKghIwkTsedH5EpwH0GWS7nv1zo+z6eCv8iI7CAJT87F m+f9soBhQlMGCvbYZG+JqSiGGLPtgboE6k8BjxfbnMMhb2uOrkvdifptV/w1Ux9/TlF3 IGFw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=sender:errors-to:list-subscribe:list-help:list-post:list-archive :list-unsubscribe:list-id:precedence:content-transfer-encoding :mime-version:references:in-reply-to:message-id:date:subject:cc:to :from:dkim-signature; bh=6u5EdR0g4SIOF7rO/PzpStojqc+t54mbkmc+ceI4mPA=; fh=5BUwsxIbXWsfJLvtXa4goI5op8xCypq7ckzDHegIvyo=; b=a13qN46++HBm1/4RDnxjd9iKFpd/aSjfIBJpitucJbgzdVB7lEZtCBL8nxD6JTwJ2b fioeGwqIE+CtqRju17wVwZI/OBHul0IDXTVWJuqE6qZpg/goimvTLmyijt+3tLmQrbGw vPsMzPFgzEVjw6bHAtsgrpnEl/jzkbxwzCVoFSxO4GF2kIhFdXSvHbRRvpqpo4aLcDpV We3oy/6IlVSCwNXNxOa5lZjoKEdH0IWT0+4/lFCPvwxRXSTebW6VLvVaHgAUKZMbtk+r 3BWlyostz9py6wxcxcZc47yPRGDtJiiYJYFQGP0xKPr6y9tcIkz6ixCFum20eHMn9+1G cdYQ==; dara=google.com ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Qionx+rQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Return-Path: Received: from lists.gnu.org (lists.gnu.org. [209.51.188.17]) by mx.google.com with ESMTPS id ada2fe7eead31-48d74c95b5fsi644358137.316.2024.06.10.10.15.46 for (version=TLS1_2 cipher=ECDHE-ECDSA-CHACHA20-POLY1305 bits=256/256); Mon, 10 Jun 2024 10:15:47 -0700 (PDT) Received-SPF: pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) client-ip=209.51.188.17; Authentication-Results: mx.google.com; dkim=pass header.i=@redhat.com header.s=mimecast20190719 header.b=Qionx+rQ; spf=pass (google.com: domain of qemu-devel-bounces+patch=linaro.org@nongnu.org designates 209.51.188.17 as permitted sender) smtp.mailfrom="qemu-devel-bounces+patch=linaro.org@nongnu.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=redhat.com Received: from localhost ([::1] helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1sGicN-0007Uv-UE; Mon, 10 Jun 2024 13:15:39 -0400 Received: from eggs.gnu.org ([2001:470:142:3::10]) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sGicJ-0007Js-QU for qemu-devel@nongnu.org; Mon, 10 Jun 2024 13:15:36 -0400 Received: from us-smtp-delivery-124.mimecast.com ([170.10.129.124]) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1sGicH-0001Wd-MH for qemu-devel@nongnu.org; Mon, 10 Jun 2024 13:15:35 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1718039733; h=from:from: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=6u5EdR0g4SIOF7rO/PzpStojqc+t54mbkmc+ceI4mPA=; b=Qionx+rQDhKU5zkXYgLmxNOIuTUm7+iDwWK1nOiBrxkK/ZM61ptH6heVFL+jNKVloYhfkB KCDCTAmYnPmeg3oxCIkeU/V92dGVlJgZhN41iljBm4RuDoV03lHrtj8ad5IR7pADtH8qSX laZ55hIeccZYC5VP7reJfL712A2+owo= Received: from mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (ec2-54-186-198-63.us-west-2.compute.amazonaws.com [54.186.198.63]) by relay.mimecast.com with ESMTP with STARTTLS (version=TLSv1.3, cipher=TLS_AES_256_GCM_SHA384) id us-mta-567-C5MOzwOjN_m4d4mx9qGrPw-1; Mon, 10 Jun 2024 13:15:29 -0400 X-MC-Unique: C5MOzwOjN_m4d4mx9qGrPw-1 Received: from mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com [10.30.177.17]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (2048 bits) server-digest SHA256) (No client certificate requested) by mx-prod-mc-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTPS id F38A01955D7C; Mon, 10 Jun 2024 17:15:27 +0000 (UTC) Received: from localhost (unknown [10.39.195.112]) by mx-prod-int-05.mail-002.prod.us-west-2.aws.redhat.com (Postfix) with ESMTP id 1C3D11956050; Mon, 10 Jun 2024 17:15:26 +0000 (UTC) From: Stefan Hajnoczi To: qemu-devel@nongnu.org Cc: =?utf-8?q?Daniel_P=2E_Berrang=C3=A9?= , Thomas Huth , Stefan Hajnoczi , Richard Henderson , =?utf-8?q?Marc-Andr=C3=A9_Lureau?= , Paolo Bonzini , =?utf-8?q?C=C3=A9dric_Le_Goater?= , Mads Ynddal , Alex Williamson , Yoshinori Sato , =?utf-8?q?Philippe_Mathieu-Dau?= =?utf-8?q?d=C3=A9?= , Stefan Berger Subject: [PULL 6/6] tracetool: Forbid newline character in event format Date: Mon, 10 Jun 2024 13:13:15 -0400 Message-ID: <20240610171315.346143-7-stefanha@redhat.com> In-Reply-To: <20240610171315.346143-1-stefanha@redhat.com> References: <20240610171315.346143-1-stefanha@redhat.com> MIME-Version: 1.0 X-Scanned-By: MIMEDefang 3.0 on 10.30.177.17 Received-SPF: pass client-ip=170.10.129.124; envelope-from=stefanha@redhat.com; helo=us-smtp-delivery-124.mimecast.com X-Spam_score_int: 11 X-Spam_score: 1.1 X-Spam_bar: + X-Spam_report: (1.1 / 5.0 requ) BAYES_00=-1.9, DKIMWL_WL_HIGH=-0.143, DKIM_SIGNED=0.1, DKIM_VALID=-0.1, DKIM_VALID_AU=-0.1, DKIM_VALID_EF=-0.1, RCVD_IN_DNSWL_NONE=-0.0001, RCVD_IN_MSPIKE_H4=0.001, RCVD_IN_MSPIKE_WL=0.001, RCVD_IN_SBL_CSS=3.335, SPF_HELO_NONE=0.001, SPF_PASS=-0.001, T_SCC_BODY_TEXT_LINE=-0.01 autolearn=no autolearn_force=no X-Spam_action: no action X-BeenThere: qemu-devel@nongnu.org X-Mailman-Version: 2.1.29 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: qemu-devel-bounces+patch=linaro.org@nongnu.org Sender: qemu-devel-bounces+patch=linaro.org@nongnu.org From: Philippe Mathieu-Daudé Events aren't designed to be multi-lines. Multiple events can be used instead. Prevent that format using multi-lines by forbidding the newline character. Signed-off-by: Philippe Mathieu-Daudé Acked-by: Mads Ynddal Reviewed-by: Daniel P. Berrangé Message-id: 20240606103943.79116-6-philmd@linaro.org Signed-off-by: Stefan Hajnoczi --- scripts/tracetool/__init__.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py index 7237abe0e8..bc03238c0f 100644 --- a/scripts/tracetool/__init__.py +++ b/scripts/tracetool/__init__.py @@ -301,6 +301,8 @@ def build(line_str, lineno, filename): if fmt.endswith(r'\n"'): raise ValueError("Event format must not end with a newline " "character") + if '\\n' in fmt: + raise ValueError("Event format must not use new line character") if len(fmt_trans) > 0: fmt = [fmt_trans, fmt]