From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=95.215.58.56 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796106218; b=fuDVMlr2TUBBv7dMozLihBrJH8LDrsgFybfi6oWIXKLfJcgo+VS3/zBjJalhyWHBNTWq BSkHwVRNrGUt/0PVOa+8MXF5z14kq8siidc/m4vCewvZ2Jsf5C7117PpPVb0nskIevp7p +XvJR3VWnaLEQ5ForB1Syo3nkr15MepkKVqwiB7RYxofHmgeLx/ATdo+6ZWbUeOU215dh +gW+hA8YqU8vFxSX3Vx/QmMuwl4XwrO3zD45KoRyf3u+pqpmlRNqOZyniLgYsCwnpJ3XL p7FybgaBP26uzA7HfE52e41o53h3P1mBzrxnf5vjN1kwPY+KMv1m642Efc7VzhIBEJQ== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796106218; h=DMARC-Filter:X-Envelope-To:DKIM-Signature:X-Envelope-To:Received: X-Mizu-Trace-ID:X-Migadu-Flow:Message-ID:Date:MIME-Version:User-Agent: Subject:To:Cc:References:Content-Language:From:In-Reply-To: Content-Type:Content-Transfer-Encoding; bh=vkSPwDn/U59X6dGET0GIj96fHXnhyTeWQdxvYX0t7rQ=; b=YcIKxA0dGiRV4wuoV7ley8yByNf+G+cXEvITzSnUhLcAISK/rEWQtoMJ9a9BZ4MUkFTm jorPSPJYWBjtagJtVHhcHQ7kYuynqET5yW5tam/045Hv09RyZ9P9mx1kc6SuebH741Jgb T7N9iybK1zg+w9ktay+rbX0+1nDO7tOxyzdlwMJYAqv2LtRGTn5TqoJ4dViDJMMuCGy5c wTBQU/1HPfYjFHMX39MH0tn4/jeH1DNLgRxGRgElCSsM2LcfdTaxTi13QubKFVB/e9PV+ i95VWPOvEGof81Le68ZRF87eMdf14dKgqGnsX8Rg+Ec8XO0JXUnaXEWeHfWXbWCOG0A== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=chenxiaosong.com; spf=pass smtp.mailfrom=chenxiaosong.com; dkim=pass header.d=chenxiaosong.com header.i=@chenxiaosong.com header.a=rsa-sha256 header.s=key1 header.b=R4qdpdXa; arc=none smtp.remote-ip=95.215.58.56 Received: from mta1.migadu.com (out-56.mta1.migadu.com [95.215.58.56]) (using TLSv1.3 with cipher TLS_AES_128_GCM_SHA256 (128/128 bits) key-exchange X25519 server-signature ECDSA (prime256v1) server-digest SHA256) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id CCAE8606A31A for ; Tue, 1 Dec 2026 06:23:35 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org CCAE8606A31A Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=quarantine dis=none) header.from=chenxiaosong.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=chenxiaosong.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key, unprotected) header.d=chenxiaosong.com header.i=@chenxiaosong.com header.a=rsa-sha256 header.s=key1 header.b=R4qdpdXa X-Envelope-To: linux-kernel@vger.kernel.org DKIM-Signature: a=rsa-sha256; bh=Lq/60B21XIlhg1KrhziHpWffgl3L7dVmSUmA5wt1tZw=; c=simple/simple; d=chenxiaosong.com; h=from:to:subject:date:message-id:mime-version:content-type; s=key1; t=1796106213; v=1; x=1796711013; b=R4qdpdXaH0UHVz6n/vS5cvfD2xjm3wi87EAwjbWDDmm8FWWFPznKhBEqc545WpSfyTcs3lfZ 4DlEym8CE023rfyjpXKw0n9N2GCmYHUHDuTkMMpEyDBp9DaMzbtp2e7WW+YTLNsm3OtO6wEpQ8o xVUR0ABXClLD8nZvE7rJNlMJOf0jxcsMo2iBrmK8++nMQZoanOjFjN5vy+Ij0QeIJAa6HA/rm2U aXvKlCd3pFf9vjOrHIJw3m+VJCOjLXd+6NLDrQloSyXhDuT78pMvTvhSnbAVJK0EQt0P8yFoSfC LwfE+kN9o9ZjXW91sXU+6f9Upcd4tn1gfZvc1mj0h9rpg== X-Envelope-To: linux-kernel@vger.kernel.org Received: by smtp.migadu.com with ESMTPS id bd66160c610d59ee; Tue, 01 Dec 2026 06:23:32 +0000 X-Mizu-Trace-ID: bd66160c610d59ee X-Migadu-Flow: FLOW_OUT Message-ID: <786d0399-5091-461b-b8bc-eed6fd9f2d50@chenxiaosong.com> Date: Tue, 1 Dec 2026 14:23:21 +0800 X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 User-Agent: Mozilla Thunderbird Subject: Re: [PATCH] ksmbd: delete only the stream whose handle has delete-on-close To: Ian Bridges , linkinjeon@kernel.org Cc: senozhatsky@chromium.org, tom@talpey.com, gael.blivet@gmail.com, linux-cifs@vger.kernel.org, linux-kernel@vger.kernel.org, stable@vger.kernel.org References: <20261201041029.2181504-1-icb@fastmail.org> Content-Language: en-US From: ChenXiaoSong In-Reply-To: <20261201041029.2181504-1-icb@fastmail.org> Content-Type: text/plain; charset=UTF-8; format=flowed Content-Transfer-Encoding: 7bit Reviewed-by: ChenXiaoSong On 12/1/26 12:10, Ian Bridges wrote: > A delete-on-close open of a named stream sets a flag on the inode > instead of on the handle. The next stream handle of the file to close > takes the flag and deletes its own stream. So when another stream > handle of the file closes first, that other stream is deleted, and the > stream that was opened with delete-on-close is kept. > > The stream is removed with the credentials of the closing handle. A > user who cannot write the file can open one stream with delete-on-close > and make another user's handle delete a different stream on close. > > Record delete-on-close on the stream handle, as > FileDispositionInformation on a stream handle already does. Deleting a > stream never removes the file, so delete-on-close of a stream no longer > makes a new delete-on-close open close the disconnected durable handles > of the file. > > Fixes: f44158485826 ("cifsd: add file operations") > Cc:stable@vger.kernel.org > Signed-off-by: Ian Bridges > --- > Tested on ksmbd-for-next 87ff512becd4, on x86_64 with KASAN. A script > opened named streams of one file with and without delete-on-close, as > the owner and as a user who cannot write the file, and closed the > handles in different orders. On the base, the first stream handle to > close deleted its own stream. With the patch, only the streams opened > with delete-on-close were deleted, and FileDispositionInformation on a > stream behaved as on the base. smbtorture gives the same results as on > the base, and KASAN reported nothing. > > This patch was developed with LLM assistance. > > fs/smb/server/vfs_cache.c | 41 ++++++++++++++++++--------------------- > fs/smb/server/vfs_cache.h | 1 + > 2 files changed, 20 insertions(+), 22 deletions(-) -- ChenXiaoSong Chinese Homepage: https://chenxiaosong.com English Homepage: https://chenxiaosong.com/en