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=1796365189; b=acZArG2UYAEpq5dqKnm6mcycujhzXh9NCXxGYHgBk8s0X3UyNmKhjshy9mOu5BQAgHCn JxDFG6H8NdJZxGwQLrsCrT9aXbxLd2HoN7lp9TD8pNi0+DcNhrzYkMdwBQZUUtRftwmJ1 XaLNtL3Okx6abtW0UZ9m8rkgUrVGwNVSvSFu5qX2+edreB97xPgJcLWXZTIde9hJhhO45 CRjPHM2Zud/X8Qoy7cMo4MIHgmPZxCiFXp/gRr8U+joYjlmaNng99gpO7eS3NMh1G924T JXsWYTP+TcrQC1cwUVz8B3G+Gx3p5lu0kyDad60Sci7pvGxG7GchgudqNdBw/JL9BpQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796365189; h=Received:DKIM-Signature:Message-ID:From:Subject:Reply-To:To:Cc: In-Reply-To:References:Content-Type:Content-Transfer-Encoding:Date; bh=HK01a4GeklEDJoMapS1Enr/GVJrl8ksDcsyMvlGz1dA=; b=Gifop/DDlatXGhy5ZPlQjjJY0SOgokmNqGvZhbz51g0nczkY/qrFUByUFjGn2PgvzSx0 zr83VB13cblrZ9UWYYHYLzlcK5Eyf7WL41Z88im+NFrJATosQDx3aLub5pBdiuvCo9BZq 6cSZXoKl00D83bdOeUR0b9ski9CGb9s7IFg+gsyJAStR69Q1lJJ4/Kv+B123YwWgdx1ZI wc1EJt+M+ka4GNp6Qg2WMgNdqWOGNJmPBOWIniJy9XvF+SQxPoiqFl+1csV/d+FaLpPaC 47llqkKQcVPC6memzfMMfcf2+rT4TqjmMmP+DMjFt90xYiazBmesL7wLsmSBu3Z2lxQ== 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=QZQa2M4n; 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 EB995606A322 for ; Fri, 4 Dec 2026 06:19:48 +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=QZQa2M4n Received: by smtp.kernel.org (Postfix) with ESMTPSA id 46C4D1F000CE; Fri, 4 Dec 2026 06:19:47 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796365188; bh=HK01a4GeklEDJoMapS1Enr/GVJrl8ksDcsyMvlGz1dA=; h=From:Subject:Reply-To:To:Cc:In-Reply-To:References:Date; b=QZQa2M4n18Ad88/LTgcApufB85BR505jENC+O8y4E7g6Q8193Ka8JYUlvsmTvp2Fb eP8foPGf4klsnQ/7lPB5uOCxO41bd8yE9FN2wW17bwaZ3gRuvX8XvVxGT0qrMZdSFT 3RRVSXblwz12WXeEsboGw32/Wjxpq3QpOkKipbqtXlCcmbkSmXk8W/jNKsgl0FAyHX otN1GLdX159IfkTVLC8zyck8mFniP420TP3EToRRv8ynba+NLTg8CmeB/OqbuVtR3N ScExHG2ECTMpeZdWBGva3Covg42iDmZIaQwIrvtbuPtauXi2OiHTmFGTxokLGe714l 7AoAVnA3K6Vnw== Message-ID: From: sashiko-bot@kernel.org Subject: Re: [PATCH v3 1/3] tracing: Hold file reference in splice buffer_ref Reply-To: sashiko-reviews@lists.linux.dev To: =?utf-8?b?TWFzYW1pIEhpcmFtYXRzdSAoR29vZ2xlKQ==?= Cc: linux-trace-kernel@vger.kernel.org In-Reply-To: <179636441309.1289712.3872630578310009929.stgit@mhiramat.c.googlers.com> References: <179636440238.1289712.8372580891085333773.stgit@mhiramat.c.googlers.com> <179636441309.1289712.3872630578310009929.stgit@mhiramat.c.googlers.com> Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: quoted-printable Date: Fri, 04 Dec 2026 06:19:46 +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: - [Low] tracing: Fixes trailer cites wrong commit for ring_buffer_free_read_page() UAF -- commit d437840eacea8fdaf6388c3810c823a11b795543 Author: Masami Hiramatsu (Google) > tracing: Hold file reference in splice buffer_ref > > tracing_buffers_splice_read() stores a raw pointer to > iter->array_buffer->buffer in each struct buffer_ref attached to the pipe > buffers, and buffer_ref_release() later dereferences ref->buffer in > ring_buffer_free_read_page() when the pipe drains or closes. > > However, struct buffer_ref does not hold a reference to the source file > (and thus the owning struct trace_array). If the trace_pipe_raw file > descriptor is closed while spliced pages are still sitting in the pipe > and the trace instance is then destroyed (via manual rmdir or backup > instance autoremove), ring_buffer_free_read_page() dereferences the freed > trace_buffer, causing a use-after-free. > > Store a get_file(file) reference in struct buffer_ref for each spliced > page and release it via fput() in buffer_ref_release() after > ring_buffer_free_read_page(). Holding the file reference keeps the > trace_array (including tr->trace_ref, so tracer switches and instance > removal return -EBUSY until the pipe drains) and its ring buffer alive > without taking trace_types_lock on the splice data path. > > Fixes: 0c8916c34203 ("tracing: Add rmdir to remove multibuffer instances") > Cc: stable@vger.kernel.org > Signed-off-by: Masami Hiramatsu (Google) [Severity: Low] Should the Fixes tag cite 73a757e63114 ("ring-buffer: Return reader page back into existing ring buffer") instead of 0c8916c34203 ("tracing: Add rmdir to remove multibuffer instances")? When instance rmdir was added, ring_buffer_free_read_page() only called free_page() and ignored the buffer pointer. The buffer->buffers[cpu] dereference that causes the use-after-free was introduced when reader page caching was added. --=20 Sashiko AI review =C2=B7 https://sashiko.dev/#/patchset/179636440238.128971= 2.8372580891085333773.stgit@mhiramat.c.googlers.com?part=3D1