Received: by 2002:a89:2c3:0:b0:1ed:23cc:44d1 with SMTP id d3csp67719lqs; Mon, 4 Mar 2024 15:24:31 -0800 (PST) X-Forwarded-Encrypted: i=3; AJvYcCVy/68yh+l9Gi+bbwC9qDrpwjgYQQrkKc1hEmVYcxa+Ds52oOwtw2zuT82RuMmpt3N2O8mgLCaHCSDNrIrZO1eLTtlTfmXbIkz4bNTB3A== X-Google-Smtp-Source: AGHT+IHylPsVS0mv5BzJb9p/MzgXuk/Dokvg3p/LFTCetO3ySKlkskaws2HJXBdtFBaeAYJoS+Id X-Received: by 2002:a17:902:d590:b0:1dc:3294:f09b with SMTP id k16-20020a170902d59000b001dc3294f09bmr270916plh.26.1709594670866; Mon, 04 Mar 2024 15:24:30 -0800 (PST) ARC-Seal: i=2; a=rsa-sha256; t=1709594670; cv=pass; d=google.com; s=arc-20160816; b=Ai2uTsBEJr6JbFaTWCYF6wGre0Y1IPKgqZd3GRSxN51kfM7r0oH6U7cFcuFj8UCDnz v2TfmluTL7xDLCfdkC6W/pyvYJ4DVCAMs8lQGQBSlgeSORRBBoeGTeS8fXO34SuLtEmi LJ6lQgohn0KjVGTmwVNGLV41lQbdySpSXLbUZlTW1MqewO7HxJhelOpGw658llVkvXnn vbmNZPkfkfGsfPFqbcT6LxXzodmcs8LFurD93swWK7ubdn6HMZN7dWrEpGVZXnAeHE5C hjRiXXhVUHzuW+ZSTsKYgKlpTaZm8W0IINebBtBUJoVLG17wQo9RZ9qc4in5uWQwLTBj lBtw== ARC-Message-Signature: i=2; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:in-reply-to:from:references:cc:to :content-language:subject:user-agent:mime-version:list-unsubscribe :list-subscribe:list-id:precedence:date:message-id:dkim-signature; bh=DBzElalcVKNEYvWUU8qxthfG+V6PRlxc+bhvEOntqS4=; fh=PvsZpbRQQEWyCLZxsPjZXSCP14eGpVe9A2irUmq+3hM=; b=ycLFfDonutXm7y8X9vJuNTgFu5zB83bajJS+1/24SxYQPlCY5kK0so+q8c6pmapP32 dfExpVxAYMDgBu582IGgTfb+WMjeLsGiJYI3k2K51NFrSICMvnb/nj8QPVX6a0ojM+Vw uciO35HgeeyB5W2K855cS6pHPpP4VY4Pl+nQ1iy7aOQq32c5Q/WtTlS1IHrrxIKz6cwk 9eB9lWunZLb+cHpTu+P4/xO91nxLVjje26mxvO/HBDOX0bljWcsz8Rm3rrJvuqPo9dwb U+hKIFupgn/Y+KGKmtg/MWBnG97Qgr3iAlFEev8WDF00yxlnTzHEoybnt72+D6MO7CSz ayKw==; dara=google.com ARC-Authentication-Results: i=2; mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=Lq7A1dKK; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-91404-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91404-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com Return-Path: Received: from sy.mirrors.kernel.org (sy.mirrors.kernel.org. [147.75.48.161]) by mx.google.com with ESMTPS id z9-20020a170902ccc900b001dd0f4b0dd1si2569268ple.202.2024.03.04.15.24.30 for (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Mon, 04 Mar 2024 15:24:30 -0800 (PST) Received-SPF: pass (google.com: domain of linux-kernel+bounces-91404-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) client-ip=147.75.48.161; Authentication-Results: mx.google.com; dkim=pass header.i=@efficios.com header.s=smtpout1 header.b=Lq7A1dKK; arc=pass (i=1 spf=pass spfdomain=efficios.com dkim=pass dkdomain=efficios.com dmarc=pass fromdomain=efficios.com); spf=pass (google.com: domain of linux-kernel+bounces-91404-linux.lists.archive=gmail.com@vger.kernel.org designates 147.75.48.161 as permitted sender) smtp.mailfrom="linux-kernel+bounces-91404-linux.lists.archive=gmail.com@vger.kernel.org"; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=efficios.com 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 sy.mirrors.kernel.org (Postfix) with ESMTPS id AB01BB21F9B for ; Mon, 4 Mar 2024 23:23:55 +0000 (UTC) Received: from localhost.localdomain (localhost.localdomain [127.0.0.1]) by smtp.subspace.kernel.org (Postfix) with ESMTP id C56267CF06; Mon, 4 Mar 2024 23:23:49 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b="Lq7A1dKK" Received: from smtpout.efficios.com (smtpout.efficios.com [167.114.26.122]) (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 C8D8B1E4A2; Mon, 4 Mar 2024 23:23:44 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=167.114.26.122 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709594628; cv=none; b=sehKkGC+GJmECeU56ZGtXKY7XL8BG/hV4hiYDYyQkVeggNYJ8akuESQYAchhuJx02Tipj0eMTLU8X5aefYgzHfgj4Zypuh/iBkbd1juxCf1r3w82zgQVTjEQvSQODX3iB79ZnEs3rvcn8N0vRvYHBUFlUAQRfHIBS69EBrPhnsk= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1709594628; c=relaxed/simple; bh=HEq5kgUP1ZPh6+iesZI1t0ZbH0sGN6VXjzGiLV0x70g=; h=Message-ID:Date:MIME-Version:Subject:To:Cc:References:From: In-Reply-To:Content-Type; b=MbhMGMGmbAfARnsnmyCHObqOnEVAf3YlWw9cB5vMDtBWRhvFCt9I7g2OPvzd6xjZhIyF8SGUQbsuEX7RddI0oFazSgVL+2k0j0kXaCM/A5GJQTbzNat8V5TorfcKn+apUNJb7G/NVV28V9ViY/U6/QdjzqoPG29LcrMOIUH949Y= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com; spf=pass smtp.mailfrom=efficios.com; dkim=pass (2048-bit key) header.d=efficios.com header.i=@efficios.com header.b=Lq7A1dKK; arc=none smtp.client-ip=167.114.26.122 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=efficios.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=efficios.com DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=efficios.com; s=smtpout1; t=1709594617; bh=HEq5kgUP1ZPh6+iesZI1t0ZbH0sGN6VXjzGiLV0x70g=; h=Date:Subject:To:Cc:References:From:In-Reply-To:From; b=Lq7A1dKKdKHYGgVerwIPoaMP/oem/Sw4zYJEeh3Uh0vap4ivUuxdZdZ5MeZVpqtPY wzoZ5eF4Idl6zq4reEmNAnIlgTlle9lqOoHFdlGds7COD/U7SVktHdbzXjucH4FhTf ImtK22+NAE9igHG64k7rlYVaih1s2h8qU/iOQTBbD2F0fKUAOCWhOJwlzvf1ZwGYw4 Tj0NBrVVr6sAg7uvFTAixQ78RTim+yHupOvNfgbuHWzsMOBLnOcNJZeG6TmWqvLd2x rw+dBL7d9aJ/dwTyhFBUX2mw5hbKe8LZGJ4dMK6FIIdIMu3zS8zki4/gLHd6Xp5kZu BFfMWQFryfsWQ== Received: from [IPV6:2606:6d00:100:4000:cacb:9855:de1f:ded2] (unknown [IPv6:2606:6d00:100:4000:cacb:9855:de1f:ded2]) by smtpout.efficios.com (Postfix) with ESMTPSA id 4TpZWY0lJBzfcS; Mon, 4 Mar 2024 18:23:37 -0500 (EST) Message-ID: Date: Mon, 4 Mar 2024 18:23:41 -0500 Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] tracing: Remove precision vsnprintf() check from print event Content-Language: en-US To: Steven Rostedt , LKML , Linux Trace Kernel Cc: Masami Hiramatsu , Linus Torvalds , Sachin Sant References: <20240304174341.2a561d9f@gandalf.local.home> From: Mathieu Desnoyers In-Reply-To: <20240304174341.2a561d9f@gandalf.local.home> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit On 2024-03-04 17:43, Steven Rostedt wrote: > From: "Steven Rostedt (Google)" > > This reverts 60be76eeabb3d ("tracing: Add size check when printing > trace_marker output"). The only reason the precision check was added > was because of a bug that miscalculated the write size of the string into > the ring buffer and it truncated it removing the terminating nul byte. On > reading the trace it crashed the kernel. But this was due to the bug in > the code that happened during development and should never happen in > practice. If anything, the precision can hide bugs where the string in the > ring buffer isn't nul terminated and it will not be checked. > > Link: https://lore.kernel.org/all/C7E7AF1A-D30F-4D18-B8E5-AF1EF58004F5@linux.ibm.com/ > Link: https://lore.kernel.org/linux-trace-kernel/20240227125706.04279ac2@gandalf.local.home > Link: https://lore.kernel.org/all/20240302111244.3a1674be@gandalf.local.home/ > > Reported-by: Sachin Sant > Fixes: 60be76eeabb3d ("tracing: Add size check when printing trace_marker output") > Signed-off-by: Steven Rostedt (Google) This is a step in the right direction IMHO. Reviewed-by: Mathieu Desnoyers Just out of curiosity, is there anything to prevent trace_marker from writing a huge string into the ring buffer in the first place ? Is this limit implicit and based on the page size of the architecture or is it a known fixed limit ? (e.g. 4kB strings). It appears to currently be limited by #define TRACE_SEQ_BUFFER_SIZE (PAGE_SIZE * 2 - \ (sizeof(struct seq_buf) + sizeof(size_t) + sizeof(int))) checked within tracing_mark_write(). I would have hoped for a simpler limit (e.g. 4kB) consistent across architectures. But that would belong to a separate change. Thanks, Mathieu -- Mathieu Desnoyers EfficiOS Inc. https://www.efficios.com