* [PATCH] fs: 9p: avoid warning during xattr allocation
@ 2024-02-02 12:13 Fedor Pchelkin
2024-03-04 13:09 ` Dominique Martinet
0 siblings, 1 reply; 3+ messages in thread
From: Fedor Pchelkin @ 2024-02-02 12:13 UTC (permalink / raw)
To: Dominique Martinet, Christian Schoenebeck
Cc: Fedor Pchelkin, Eric Van Hensbergen, Latchesar Ionkov,
Venkateswararao Jujjuri, Aneesh Kumar K.V, v9fs, linux-kernel,
Alexey Khoroshilov, lvc-project, syzbot+56fdf7f6291d819b9b19,
syzbot+a83dc51a78f0f4cf20da, Pavel Skripkin
An invalid server may reply with an xattr size which still fits into
ssize_t but is large enough to cause splat during kzalloc().
Add __GFP_NOWARN flag for the allocation. It seems client side can't do
much more about sanity checking here so it's better to return ENOMEM
silently.
Found by Linux Verification Center (linuxtesting.org) with Syzkaller.
Fixes: 85ff872d3f4a ("fs/9p: Implement POSIX ACL permission checking function")
Reported-by: syzbot+56fdf7f6291d819b9b19@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/lkml/000000000000789bcd05c9aa3d5d@google.com/
Reported-by: syzbot+a83dc51a78f0f4cf20da@syzkaller.appspotmail.com
Closes: https://lore.kernel.org/lkml/00000000000086a03405eec3a706@google.com/
Suggested-by: Pavel Skripkin <paskripkin@gmail.com>
Signed-off-by: Fedor Pchelkin <pchelkin@ispras.ru>
---
fs/9p/acl.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/fs/9p/acl.c b/fs/9p/acl.c
index eed551d8555f..e19a46192d2e 100644
--- a/fs/9p/acl.c
+++ b/fs/9p/acl.c
@@ -29,7 +29,7 @@ static struct posix_acl *v9fs_fid_get_acl(struct p9_fid *fid, const char *name)
if (size == 0)
return ERR_PTR(-ENODATA);
- value = kzalloc(size, GFP_NOFS);
+ value = kzalloc(size, GFP_NOFS | __GFP_NOWARN);
if (!value)
return ERR_PTR(-ENOMEM);
--
2.43.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] fs: 9p: avoid warning during xattr allocation
2024-02-02 12:13 [PATCH] fs: 9p: avoid warning during xattr allocation Fedor Pchelkin
@ 2024-03-04 13:09 ` Dominique Martinet
2024-03-04 21:19 ` Fedor Pchelkin
0 siblings, 1 reply; 3+ messages in thread
From: Dominique Martinet @ 2024-03-04 13:09 UTC (permalink / raw)
To: Fedor Pchelkin
Cc: Christian Schoenebeck, Eric Van Hensbergen, Latchesar Ionkov,
Venkateswararao Jujjuri, Aneesh Kumar K.V, v9fs, linux-kernel,
Alexey Khoroshilov, lvc-project, syzbot+56fdf7f6291d819b9b19,
syzbot+a83dc51a78f0f4cf20da, Pavel Skripkin
Fedor Pchelkin wrote on Fri, Feb 02, 2024 at 03:13:17PM +0300:
> An invalid server may reply with an xattr size which still fits into
> ssize_t but is large enough to cause splat during kzalloc().
Ah, sorry for not replying to this earlier.. and I had forgotten about
it when something similar came up just now.
I've submitted a patch to limit such allocations to 64k:
https://lkml.kernel.org/r/20240304-xattr_maxsize-v1-1-322357ec6bdf@codewreck.org
Would you agree this makes this patch obsolete?
I'll go ahead and add the reported-by/closes you cited in this mail to
my commit.
--
Dominique Martinet | Asmadeus
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: Re: [PATCH] fs: 9p: avoid warning during xattr allocation
2024-03-04 13:09 ` Dominique Martinet
@ 2024-03-04 21:19 ` Fedor Pchelkin
0 siblings, 0 replies; 3+ messages in thread
From: Fedor Pchelkin @ 2024-03-04 21:19 UTC (permalink / raw)
To: Dominique Martinet
Cc: Christian Schoenebeck, Eric Van Hensbergen, Latchesar Ionkov,
Venkateswararao Jujjuri, Aneesh Kumar K.V, v9fs, linux-kernel,
Alexey Khoroshilov, lvc-project, syzbot+56fdf7f6291d819b9b19,
syzbot+a83dc51a78f0f4cf20da, Pavel Skripkin
On 24/03/04 10:09PM, Dominique Martinet wrote:
> Fedor Pchelkin wrote on Fri, Feb 02, 2024 at 03:13:17PM +0300:
> > An invalid server may reply with an xattr size which still fits into
> > ssize_t but is large enough to cause splat during kzalloc().
>
>
> Ah, sorry for not replying to this earlier.. and I had forgotten about
> it when something similar came up just now.
>
> I've submitted a patch to limit such allocations to 64k:
> https://lkml.kernel.org/r/20240304-xattr_maxsize-v1-1-322357ec6bdf@codewreck.org
>
> Would you agree this makes this patch obsolete?
Yes, thanks! Checking against the VFS limits is more appropriate.
>
> I'll go ahead and add the reported-by/closes you cited in this mail to
> my commit.
Okay.
--
Fedor
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2024-03-04 21:19 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-02-02 12:13 [PATCH] fs: 9p: avoid warning during xattr allocation Fedor Pchelkin
2024-03-04 13:09 ` Dominique Martinet
2024-03-04 21:19 ` Fedor Pchelkin
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.