public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Christian Schoenebeck <linux_oss@crudebyte.com>
To: Linus Torvalds <torvalds@linux-foundation.org>,
	Al Viro <viro@zeniv.linux.org.uk>
Cc: asmadeus@codewreck.org, Leo Stone <leocstone@gmail.com>,
	syzbot+03fb58296859d8dbab4d@syzkaller.appspotmail.com,
	ericvh@gmail.com, ericvh@kernel.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	lucho@ionkov.net, syzkaller-bugs@googlegroups.com,
	v9fs-developer@lists.sourceforge.net, v9fs@lists.linux.dev,
	Fedor Pchelkin <pchelkin@ispras.ru>,
	Seth Forshee <sforshee@kernel.org>,
	Christian Brauner <brauner@kernel.org>
Subject: Re: Alloc cap limit for 9p xattrs (Was: WARNING in __alloc_frozen_pages_noprof)
Date: Thu, 12 Dec 2024 12:22:21 +0100	[thread overview]
Message-ID: <6965367.ZqKit0hgWb@silver> (raw)
In-Reply-To: <2475109.TFnaqUCzQF@silver>

On Thursday, December 12, 2024 11:17:06 AM CET Christian Schoenebeck wrote:
> On Wednesday, December 11, 2024 11:55:00 PM CET Al Viro wrote:
> > On Wed, Dec 11, 2024 at 01:32:26PM -0800, Linus Torvalds wrote:
> > > On Wed, 11 Dec 2024 at 13:04, <asmadeus@codewreck.org> wrote:
> > > >
> > > > Christian Schoenebeck's suggestion was something like this -- I guess
> > > > that's good enough for now and won't break anything (e.g. ACLs bigger
> > > > than XATTR_SIZE_MAX), so shall we go with that instead?
> > > 
> > > Please use XATTR_SIZE_MAX. The KMALLOC_MAX_SIZE limit seems to make no
> > > sense in this context.
> > > 
> > > Afaik the VFS layer doesn't allow getting an xattr bigger than
> > > XATTR_SIZE_MAX anyway, and would return E2BIG for them later
> > > regardless, so returning anything bigger wouldn't work anyway, even if
> > > p9 tried to return such a thing up to some bigger limit.
> > 
> > E2BIG on attempt to set, quiet cap to XATTR_SIZE_MAX on attempt to get
> > (i.e. never asking more than that from fs) and if filesystem complains
> > about XATTR_SIZE_MAX not being enough, E2BIG it is (instead of ERANGE
> > normally expected on "your buffer is too small for that").
> 
> So that cap is effective even if that xattr does not go out to user space?
> 
> I mean the concern I had was about ACLs on guest, which are often mapped with 
> 9p to xattr on host and can become pretty big. So these were xattr not 
> directly exposed to guest's user space.

AFAICS it is not capped in this particular case: v9fs_fid_get_acl() calls
v9fs_fid_xattr_get() for getting the xattr, which in turn calls p9 client
functions to retrieve the xattr directly from 9p server (host). So the regular
Linux VFS layers are not involved here.

I also see no limit applied in fs/posix_acl.c when encoding/decoding ACLs.

And 9p server is not necessarily a Linux host, hence Linux's limit for xattr
do not necessarily apply.

So to me KMALLOC_MAX_SIZE (or better: 9p client's msize - header) still looks
right here, no?

/Christian




  reply	other threads:[~2024-12-12 11:22 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-11 10:05 [syzbot] [v9fs?] WARNING in __alloc_frozen_pages_noprof syzbot
2024-12-11 20:02 ` Leo Stone
2024-12-11 20:28   ` [syzbot] [v9fs?] " syzbot
2024-12-11 21:04   ` Alloc cap limit for 9p xattrs (Was: WARNING in __alloc_frozen_pages_noprof) asmadeus
2024-12-11 21:32     ` Linus Torvalds
2024-12-11 22:55       ` Al Viro
2024-12-12 10:17         ` Christian Schoenebeck
2024-12-12 11:22           ` Christian Schoenebeck [this message]
2024-12-11 21:04 ` [syzbot] Re: [syzbot] [v9fs?] WARNING in __alloc_frozen_pages_noprof syzbot
2024-12-12  0:20 ` [PATCH] 9p: Limit xattr size to XATTR_SIZE_MAX Leo Stone

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=6965367.ZqKit0hgWb@silver \
    --to=linux_oss@crudebyte.com \
    --cc=asmadeus@codewreck.org \
    --cc=brauner@kernel.org \
    --cc=ericvh@gmail.com \
    --cc=ericvh@kernel.org \
    --cc=leocstone@gmail.com \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=lucho@ionkov.net \
    --cc=pchelkin@ispras.ru \
    --cc=sforshee@kernel.org \
    --cc=syzbot+03fb58296859d8dbab4d@syzkaller.appspotmail.com \
    --cc=syzkaller-bugs@googlegroups.com \
    --cc=torvalds@linux-foundation.org \
    --cc=v9fs-developer@lists.sourceforge.net \
    --cc=v9fs@lists.linux.dev \
    --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