[prev in list] [next in list] [prev in thread] [next in thread] 

List:       linux-kernel
Subject:    Re: [PATCH v3] tty: tty_io: remove hung_up_tty_fops
From:       Tetsuo Handa <penguin-kernel () I-love ! SAKURA ! ne ! jp>
Date:       2024-05-02 23:54:10
Message-ID: 5125d9ac-32d5-476d-82cc-b57d4e5d0807 () I-love ! SAKURA ! ne ! jp
[Download RAW message or body]

On 2024/05/03 2:29, Linus Torvalds wrote:
> > Hmm, debugfs assumes that f_op does not change?
> > 
> > fs/debugfs/file.c: In function 'full_proxy_release':
> > fs/debugfs/file.c:357:45: warning: initialization discards 'volatile' qualifier \
> > from pointer target type [-Wdiscarded-qualifiers] const struct file_operations \
> > *proxy_fops = filp->f_op; ^~~~
> 
> This error is a direct result of placing the __data_racy in the wrong place.

Oops. But it seems to me that the problem is that

> 
> It's not that the _result_ of reading filp->f_op is racy. It's the
> read of filp->f_op itself that is.

debugfs (or maybe any filesystems that wraps f_op) caches filp->f_op into
private data

  struct debugfs_fsdata {
      const struct file_operations *real_fops; // <= may not be up to dated?
      (...snip...)
  }

and cannot update cached real_fops value when

	filp->f_op = &hung_up_tty_fops;

or

	mfile->file->f_op = &snd_shutdown_f_ops;

is called.

Such filesystems need to be updated to cache "struct file *" rather than
"struct file_operations *" ?


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic