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=1796210846; b=ynlLsLeoqBJ5ngwYL0xAmTcAPKp2i/0Du1jDE+i5fGcAUDkIfFHsW0bfjzmWGbQAouyQ IKZUw4Nbq3AcnAPnpo3P82buq75iApHDkHxDS2TtUs/cIn1HXa8AUG4hV2hwR9gO7kKoQ V02Rx2E+xs4bY41NDW62bnXDPELElb7sCN3uEBpO+IlxwfDInO5lLKUxwNVQRNBrDXkYA ie+QnSqmST9qdxHL0zDr+JRaDHMHSSVb9KqVM6USORyBEGCwn6sGL7LdlaIJ4HMGc/r6r lsUI+XLKG/vVUbcTyEoeEUsg9ivXZLJuersLFwUOoAJOnHd9SjrRmJeOEqUO3Y5hVrg== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796210846; h=Received:DKIM-Signature:Date:From:To:Cc:Subject:Message-ID: References:MIME-Version:Content-Type:Content-Disposition:In-Reply-To; bh=g8koA8HHrS1WEfPrJFFpjP700Md5K49Yrp41PVU35xY=; b=o3aVxS+hjwJz9qRvNF25KpUOFe/CQhXmakuFPxzqO6aiDh0zb3iq+c+aP4ItuRuyx871 ScfqrbtRCyLxMzg+6ZL9efMLMriLmkkXp7b1fr1MSMtvyYvMOef0OnL9GZpOaIIN6hKlK 9phUiiCK77iv5qV1ZON0xZIZVB1u6JMCB+YW1cI6VB2e7ECwsn3GcVlNqvtxdwZN47hle S5kEwAU3wirrKCUdlzolbngpMJQ7NP8Eupp62W1K/mqTO/D/FNjQhHgAegrkY+9hjPU60 3MHBphEkYQcw9/9fO6pf3X80BRC4bEV2MZnUCTrw/eNr/EARrJYVj27GiD4MjlcM8tQ== 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=nEcK2avl; 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 49B9C606A322; Wed, 2 Dec 2026 11:27:26 +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=nEcK2avl Received: by smtp.kernel.org (Postfix) with ESMTPSA id 5C5C91F00896; Wed, 2 Dec 2026 11:27:22 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=kernel.org; s=k20260515; t=1796210845; bh=g8koA8HHrS1WEfPrJFFpjP700Md5K49Yrp41PVU35xY=; h=Date:From:To:Cc:Subject:References:In-Reply-To; b=nEcK2avl43SsYNbSqnNPUcVIVwL75sCbKDuuzJzqOjSAi0tE23+nbux58DfTztt2O CpAJRn4xMzJShrw1bB+FV4SQ/mn061BtWf4w+RnLO1omy3O4OUhdECMzirx9E/I+6D iXzz1eekZHwQwpnDQVAvMijS63hXMjKKctEvJqT+c08hN8jDbd93tk2/mVXHGeY3zx JoZ/ltGrDi1SAmOHodiNOsczR1orN3OmGPsSMWE9ss8Ev88sScthGcAZ0dmZ5xeD+E UqaI9vp6CLGliQbg6JKhrGUPoNqdkgdHIPI3tJvPiby2H7cai2FQalzM524uz9Zb3K 31VRV5uaF1Vuw== Date: Wed, 2 Dec 2026 12:27:19 +0100 From: Christian Brauner To: Andrew Morton , syzbot Cc: adobriyan@gmail.com, jack@suse.cz, jannh@google.com, linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org, sforshee@kernel.org, syzkaller-bugs@googlegroups.com, Marco Elver , Dmitry Vyukov Subject: Re: [syzbot] [fs?] KCSAN: data-race in task_dump_owner / task_dump_owner (2) Message-ID: <20261202-vitamine-pfahl-lebst-c182e197ef1c@brauner> References: <6b04f2d2.44b41460.34b83f.0037.GAE@google.com> <20261124203741.0eab4c0987ae73f2bcdf5e47@linux-foundation.org> 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 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline In-Reply-To: <20261124203741.0eab4c0987ae73f2bcdf5e47@linux-foundation.org> On Tue, Nov 24, 2026 at 08:37:41PM -0800, Andrew Morton wrote: > A simple patch which takes ->i_lock in a few places fixed all that up, > but the performance costs were pretty horrid. Eeew, no. i_lock isn't about the permission fields of an inode and it really shouldn't start being about it. It protects inode state, hash, lru and so on. If filesystems start using it to serialize i_uid, i_gid and i_mode nobody will know anymore what it actually protects and everything will suffer in performance including the dcache. > So updates are now made inside a write section of a new per-inode > seqcount, still under i_lock, and they read the task's credentials > inside that section. The comparison is a read section of the same > seqcount. It waits for an update which is in flight, and it is only > trusted if no update started while it ran. Every later update reads > the task after the comparison did and cannot store anything older. Comparing first and reading the credentials inside the write section looks ok. But give struct proc_inode its own lock for that, e.g., a seqlock_t owner_lock. I'd also fold the two patches into one as the first one only exists to be rewritten by the second. Note that this will conflict with the procfs work in vfs-7.5.procfs. fs/proc/fd.c changed quite a bit there and "proc: refresh the owner of fd/ before checking access" adds another tid_fd_update_inode() caller from the permission path. Please rebase onto vfs-7.5.procfs and send it to fsdevel and I'll pick it up.