mirror of https://lore.kernel.org/lkml/
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Andrew Morton <akpm@linux-foundation.org>,
	 syzbot <syzbot+3b8f4ae71137f7af00ca@syzkaller.appspotmail.com>
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 <elver@google.com>,
	 Dmitry Vyukov <dvyukov@google.com>
Subject: Re: [syzbot] [fs?] KCSAN: data-race in task_dump_owner / task_dump_owner (2)
Date: Wed, 2 Dec 2026 12:27:19 +0100	[thread overview]
Message-ID: <20261202-vitamine-pfahl-lebst-c182e197ef1c@brauner> (raw)
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.

      reply	other threads:[~2026-12-02 11:27 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-24  2:13 syzbot
2026-11-25  4:37 ` Andrew Morton
2026-12-02 11:27   ` Christian Brauner [this message]

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261202-vitamine-pfahl-lebst-c182e197ef1c@brauner \
    --to=brauner@kernel.org \
    --cc=adobriyan@gmail.com \
    --cc=akpm@linux-foundation.org \
    --cc=dvyukov@google.com \
    --cc=elver@google.com \
    --cc=jack@suse.cz \
    --cc=jannh@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=sforshee@kernel.org \
    --cc=syzbot+3b8f4ae71137f7af00ca@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox

all inboxes | Powered by JetHome®