From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=100.103.45.18 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796293063; b=uVc7gyyDmL+YZOKDB7eI0cy4R6xsqm5gDMN85fCu4WgvRfaVcdo7uDmKIq5PxTNgaKG+ xP3qu1WJJW3ZjbsVNv1F51nm5F3uUSCoRZMAfXV9wBrQ1djhv23UCPSyq4Da+6AumCF33 jol8E9uui9la2ZnDc2mByKdGa5fNe1HMB04xkg6DA5JlOfW9UXexKhKbBLwfyAJuWyAem KUNuzKkxwMy4IF/cpHPtyMlsS+oTLS8OdrvOEOD+UbmPclCkdSIRALJS5W+0VcWOsKcRx zo/NLBouFHp9ixlDQv8/C+FeELJmyUHji+tLZ4zEXbTVCPxeexmlKVyYIbsUIohZQlQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796293063; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=v6WudD7ONCP8ZtJMXxnbQv0SdTxXwjCO0iE50HYIn0A=; b=n/HEgxxMssuBR2ZS4N9TZlXMQoR4KSNWQf4QMfPHNV5JYhCri5aR62YyBiDA2TMHaOw3 1Zqi7wF6vQLzt8tiKi1k0k48tm9g67v2THDwzeBaWC6JoFkYWoyVVj/3Ncyu4vdxOEjJh iM+zF2METQC5MgpklaD45p3AijjV92+wSy/kz7yqH3t2p0rtrgnIbDuBqKVknvwPzbteY +WJq90OE2Yj03wnYdudiyQGuE/6snrpKOUGinIFn38UlliC7T/jtuF9N4sFuiRrCxzbQD wFGSB0+nYk5tVB74r6CI4BJcN9Lq9cJhQEAXCzyvfjNwLDg98QoX8zxWeIEL7qnuwxw== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BjTEFv83; arc=none smtp.remote-ip=100.103.45.18 Received: from smtp.kernel.org (quasi.space.kernel.org [100.103.45.18]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature ECDSA (prime256v1)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0414E606A322 for ; Thu, 3 Dec 2026 10:17:42 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.a=rsa-sha256 header.s=k20260515 header.b=BjTEFv83 Received: by smtp.kernel.org (Postfix) with ESMTPSA id 8B4CA1F00893; Thu, 3 Dec 2026 10:17:42 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796293062; bh=v6WudD7ONCP8ZtJMXxnbQv0SdTxXwjCO0iE50HYIn0A=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=BjTEFv83YvZo0zfpqxUdap+PTMQ+TksMj3zUJ0skHCRef9m316lO6+AejmS3SiwaZ vKwL1W1na/EZrFAHjTsj5WHS8AkS8KuVwvhpUJwe5g2OsX29YvxT0WLtAW3+4xpyoI guLnafTca9h020t81gseIkqEPbFNiz7TmE4Wqf75Rn1aItzECn+wmTIiiP1WdpWVb/ o/9u+k+iCw+CI6/QArkNrmqF4Eqkq6G82TZAcbkw+gK6r0ZdoycBS9xZodF7Ipn8SO WUvX/RA0FhF7MZkHeQGJNfRqKIpUbWtFQtYfa1zRQaqID8xmbOmZbxcLNiNOpJ+Rbk OwaCPH3vTSlBw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v2 1/3] tracing: Return EOF on empty readonly instances Reply-To: sashiko-reviews@lists.linux.dev To: =?utf-8?b?TWFzYW1pIEhpcmFtYXRzdSAoR29vZ2xlKQ==?= Cc: linux-trace-kernel@vger.kernel.org In-Reply-To: <179629164246.2691692.4666270506346866296.stgit@mhiramat.c.googlers.com> References: <179629163198.2691692.6206990932650792224.stgit@mhiramat.c.googlers.com> <179629164246.2691692.4666270506346866296.stgit@mhiramat.c.googlers.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Thu, 03 Dec 2026 10:17:42 +0000 X-Mailing-List: linux-trace-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list Thank you for your contribution! Sashiko AI review found 1 potential issue to consider: - [Medium] tracing: readonly splice EOF skips update_last_data_if_empty() -- commit 6492f59da7819633891017bc6387b13b6a84a5c4 Author: Masami Hiramatsu (Google) tracing: Return EOF on empty readonly instances This commit returns EOF instead of blocking or returning -EAGAIN on empty readonly trace instances in the pipe read, splice, and mmap reader ioctl paths, and reports them as readable in trace_poll(). > diff --git a/kernel/trace/trace.c b/kernel/trace/trace.c > index fa65ef8d7fbea..b431606c6375f 100644 > --- a/kernel/trace/trace.c > +++ b/kernel/trace/trace.c [ ... ] > @@ -5369,6 +5369,10 @@ static int tracing_wait_pipe(struct file *filp) > =20 > while (trace_empty(iter)) { > =20 > + /* Readonly instances can never receive new events. */ > + if (trace_array_is_readonly(iter->tr)) > + return 0; > + > if ((filp->f_flags & O_NONBLOCK)) { > return -EAGAIN; > } [ ... ] > @@ -7375,6 +7382,9 @@ ssize_t tracing_buffers_splice_read(struct file *fi= le, loff_t *ppos, > if (woken) > goto out; > =20 > + if (trace_array_is_readonly(iter->tr)) > + goto out; > + > ret =3D -EAGAIN; > if ((file->f_flags & O_NONBLOCK) || (flags & SPLICE_F_NONBLOCK)) > goto out; [Severity: Medium] Should these splice EOF paths also call update_last_data_if_empty(iter->tr)? Unlike tracing_read_pipe() and tracing_buffers_read(), neither tracing_splice_read_pipe() (via tracing_wait_pipe()) nor tracing_buffers_splice_read() calls update_last_data_if_empty(iter->tr) before returning 0 on an empty readonly instance. When a readonly backup instance is drained via splice() on trace_pipe or trace_pipe_raw, TRACE_ARRAY_FL_LAST_BOOT is never cleared and tr->free_on_close stays false, so closing the file descriptor does not schedule automatic removal and the backup ring buffer stays allocated. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/179629163198.269169= 2.6206990932650792224.stgit@mhiramat.c.googlers.com?part=3D1