public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Seth Forshee <sforshee@kernel.org>
To: Christian Brauner <brauner@kernel.org>
Cc: Christian Schoenebeck <linux_oss@crudebyte.com>,
	Eric Van Hensbergen <ericvh@kernel.org>,
	Latchesar Ionkov <lucho@ionkov.net>,
	Dominique Martinet <asmadeus@codewreck.org>,
	v9fs@lists.linux.dev, linux-kernel@vger.kernel.org,
	xingwei lee <xrivendell7@gmail.com>,
	sam sun <samsun1006219@gmail.com>
Subject: Re: [PATCH] 9p: cap xattr max size to XATTR_SIZE_MAX
Date: Mon, 4 Mar 2024 08:35:46 -0600	[thread overview]
Message-ID: <ZeXcQmHWcYvfCR93@do-x1extreme> (raw)
In-Reply-To: <20240304-zeitschrift-tagung-6f2a28e781bc@brauner>

On Mon, Mar 04, 2024 at 03:19:58PM +0100, Christian Brauner wrote:
> On Mon, Mar 04, 2024 at 02:35:07PM +0100, Christian Schoenebeck wrote:
> > On Monday, March 4, 2024 1:42:43 PM CET Dominique Martinet wrote:
> > > We probably shouldn't ever get an xattr bigger than that, and the current check
> > > of SSIZE_MAX is a bit too large.
> > 
> > Maybe, OTOH e.g. ACLs (dynamic size) are implemented by storing them as xattrs
> > on 9p server as well, and this change somewhat expects server to run Linux as
> > well. So maybe s/XATTR_SIZE_MAX/KMALLOC_MAX_SIZE/ might be more appropriate,
> > considering that this patch is about fixing a potential kmalloc() warning?
> > 
> > Worth to mention in the commit log BTW what the issue was.
> > 
> > /Christian
> 
> So the error is somewhat specific to filesystem capabilities which also
> live in the xattr apis but Seth is working to get rid of them in there.
> 
> They currently use a special api vfs_getxattr_alloc() which is an
> in-kernel api that does a racy query-size+allocate-buffer+retrieve-data
> dance.

Yes, the patches I've sent does use vfs_getxattr_alloc() for fscaps
anymore.

> That api is used for fscaps, security labels, and other xattrs. And that
> api doesn't do any size checks which probably should also be fixed now
> that I write this.
> 
> @Seth?

I agree. I don't see any reason that vfs_getxattr_alloc() shouldn't just
bail out with an error if the size of the xattr is >= XATTR_SIZE_MAX.

  reply	other threads:[~2024-03-04 14:35 UTC|newest]

Thread overview: 7+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-03-04 12:42 [PATCH] 9p: cap xattr max size to XATTR_SIZE_MAX Dominique Martinet
2024-03-04 13:35 ` Christian Schoenebeck
2024-03-04 14:19   ` Christian Brauner
2024-03-04 14:35     ` Seth Forshee [this message]
2024-03-04 14:44       ` Seth Forshee
2024-09-01  7:16   ` Fedor Pchelkin
2024-09-22 20:26     ` Dominique Martinet

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=ZeXcQmHWcYvfCR93@do-x1extreme \
    --to=sforshee@kernel.org \
    --cc=asmadeus@codewreck.org \
    --cc=brauner@kernel.org \
    --cc=ericvh@kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux_oss@crudebyte.com \
    --cc=lucho@ionkov.net \
    --cc=samsun1006219@gmail.com \
    --cc=v9fs@lists.linux.dev \
    --cc=xrivendell7@gmail.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