Linux filesystem development
 help / color / mirror / Atom feed
From: Christian Brauner <brauner@kernel.org>
To: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Al Viro <viro@zeniv.linux.org.uk>,
	linux-fsdevel@vger.kernel.org,
	 Thomas Gleixner <tglx@linutronix.de>,
	Jann Horn <jannh@google.com>
Subject: Re: [PATCH RFC 0/4] fs: port files to rcuref_long_t
Date: Sun, 6 Oct 2024 11:55:29 +0200	[thread overview]
Message-ID: <20241006-pfund-einreden-036466d1c003@brauner> (raw)
In-Reply-To: <CAHk-=wgKmjuc8T_9mc7hWpBp1m_E+wkri-jFAD67AqkHZQjWPQ@mail.gmail.com>

On Sat, Oct 05, 2024 at 03:43:16PM GMT, Linus Torvalds wrote:
> On Sat, 5 Oct 2024 at 15:28, Al Viro <viro@zeniv.linux.org.uk> wrote:
> >
> > You can keep sending SCM_RIGHTS packets filled with references
> > to the same file, for example...
> 
> Yeah, it's always SCM_RIGHTS or splice() that ends up having those
> issues.  But it's a really easy place to go "Oh, no, you can't do
> that".
> 
> > Anyway, which error would you return?  EBADF?
> 
> I really don't think it matters.
> 
> Come on - the only possible reason for two billion files is a bad
> user. Do we care what error return an attacker gets? No. We're not
> talking about breaking existing programs.
> 
> So EBADF sounds fine to me particularly from fget() and friends, since
> they have that whole case of "no such file" anyway.
> 
> For try_get_page(), we also still have the WARN_ON_ONCE() if it ever
> triggers. I don't recall having ever heard a report of it actually
> triggering, but I do think we would do the same thing for the file ref
> counting.

I really don't see the issue in making fget() _theoretically_ fail. And
I agree it would be a bug. We already have that WARN_ON() in get_file()
just to protect against completely theoretical overflow issues. If that
ever triggers anywhere we should worry about it.

> 
> Anyway, maybe making f_count a 32-bit thing isn't worth it, simply
> because 'struct file' is so much bigger (and less critical) than
> 'struct page' is anyway.
> 
> So I don't think that's actually the important thing here. If we keep
> it a 'long', I won't lose any sleep over it.

struct file is significantly smaller since the work I did the last two
cycles. So I don't think there's any pressure to go from long to int.

  parent reply	other threads:[~2024-10-06  9:55 UTC|newest]

Thread overview: 17+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-10-05 19:16 [PATCH RFC 0/4] fs: port files to rcuref_long_t Christian Brauner
2024-10-05 19:16 ` [PATCH RFC 1/4] fs: protect backing files with rcu Christian Brauner
2024-10-05 19:16 ` [PATCH RFC 2/4] types: add rcuref_long_t Christian Brauner
2024-10-05 19:16 ` [PATCH RFC 3/4] rcuref: add rcuref_long_*() helpers Christian Brauner
2024-10-05 19:16 ` [PATCH RFC 4/4] fs: port files to rcuref_long_t Christian Brauner
2024-10-05 21:42 ` [PATCH RFC 0/4] " Linus Torvalds
2024-10-05 22:01   ` Al Viro
2024-10-05 22:14     ` Linus Torvalds
2024-10-05 22:28       ` Al Viro
2024-10-05 22:43         ` Linus Torvalds
2024-10-05 22:51           ` Al Viro
2024-10-06  9:55           ` Christian Brauner [this message]
2024-10-05 22:01   ` Linus Torvalds
2024-10-06 10:21     ` Christian Brauner
2024-10-06 18:09       ` Linus Torvalds
2024-10-07  7:37         ` Christian Brauner
2024-10-06  9:48   ` Christian Brauner

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=20241006-pfund-einreden-036466d1c003@brauner \
    --to=brauner@kernel.org \
    --cc=jannh@google.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=tglx@linutronix.de \
    --cc=torvalds@linux-foundation.org \
    --cc=viro@zeniv.linux.org.uk \
    /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