All of lore.kernel.org
 help / color / mirror / Atom feed
From: asmadeus@codewreck.org
To: Leo Stone <leocstone@gmail.com>
Cc: syzbot+03fb58296859d8dbab4d@syzkaller.appspotmail.com,
	ericvh@gmail.com, ericvh@kernel.org,
	linux-fsdevel@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux_oss@crudebyte.com, lucho@ionkov.net,
	syzkaller-bugs@googlegroups.com, torvalds@linux-foundation.org,
	v9fs-developer@lists.sourceforge.net, v9fs@lists.linux.dev,
	viro@zeniv.linux.org.uk, Fedor Pchelkin <pchelkin@ispras.ru>,
	Seth Forshee <sforshee@kernel.org>,
	Christian Brauner <brauner@kernel.org>
Subject: Alloc cap limit for 9p xattrs (Was: WARNING in __alloc_frozen_pages_noprof)
Date: Thu, 12 Dec 2024 06:04:17 +0900	[thread overview]
Message-ID: <Z1n-Ue19Pa_AWVu0@codewreck.org> (raw)
In-Reply-To: <20241211200240.103853-1-leocstone@gmail.com>

Leo Stone wrote on Wed, Dec 11, 2024 at 12:02:40PM -0800:
> syzbot creates a pipe and writes some data to it. It then creates a v9fs
> mount using the pipe as transport. The data in the pipe specifies an ACL
> of size 9 TB (9895604649984 bytes) for the root inode, causing kmalloc
> to fail.

grmbl.

Sorry about that, there's been some paches ages ago to either cap xattrs
allocations to XATTR_SIZE_MAX, KMALLOC_MAX_SIZE, look into
vfs_getxattr_alloc or just flag the alloc __GFP_NOWARN:
https://lore.kernel.org/all/20240304-xattr_maxsize-v1-1-322357ec6bdf@codewreck.org/T/#u

and it was left forgotten because no decision was taken on something I
don't have time to think about

I've re-added everyone involved in Ccs, let's pick one and be done with
it.

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?

I don't care but let's get something in this cycle, the first patch is
almost one year old and this is ridiculous...

diff --git a/fs/9p/xattr.c b/fs/9p/xattr.c
index 8604e3377ee7..97f60b73bf16 100644
--- a/fs/9p/xattr.c
+++ b/fs/9p/xattr.c
@@ -37,8 +37,8 @@ ssize_t v9fs_fid_xattr_get(struct p9_fid *fid, const char *name,
 	if (attr_size > buffer_size) {
 		if (buffer_size)
 			retval = -ERANGE;
-		else if (attr_size > SSIZE_MAX)
-			retval = -EOVERFLOW;
+		else if (attr_size > KMALLOC_MAX_SIZE)
+			retval = -E2BIG;
 		else /* request to get the attr_size */
 			retval = attr_size;
 	} else {

--
Dominique,
sleepy

  parent reply	other threads:[~2024-12-11 21:04 UTC|newest]

Thread overview: 11+ 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   ` asmadeus [this message]
2024-12-11 21:32     ` Alloc cap limit for 9p xattrs (Was: WARNING in __alloc_frozen_pages_noprof) Linus Torvalds
2024-12-11 22:55       ` Al Viro
2024-12-12 10:17         ` Christian Schoenebeck
2024-12-12 11:22           ` Christian Schoenebeck
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
2026-05-18 16:36 ` Forwarded: Re: [PATCH RFC] drm/lease: Fix warning on large user-controlled allocations syzbot

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=Z1n-Ue19Pa_AWVu0@codewreck.org \
    --to=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=linux_oss@crudebyte.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.