lists.openwall.net | lists / announce owl-users owl-dev john-users john-dev passwdqc-users yescrypt popa3d-users / oss-security kernel-hardening musl sabotage tlsify passwords / crypt-dev xvendor / Bugtraq Full-Disclosure linux-kernel linux-netdev linux-ext4 linux-hardening PHC | |
Open Source and information security mailing list archives
| ||
|
Date: Fri, 9 Sep 2022 07:18:21 -0700 From: Petar Penkov <peterpenkov96@...il.com> To: Ziyang Xuan <william.xuanziyang@...wei.com> Cc: davem@...emloft.net, edumazet@...gle.com, kuba@...nel.org, pabeni@...hat.com, netdev@...r.kernel.org, linux-kernel@...r.kernel.org, ast@...nel.org, daniel@...earbox.net, hawk@...nel.org, john.fastabend@...il.com, maheshb@...gle.com Subject: Re: [PATCH net] net: tun: limit first seg size to avoid oversized linearization Thanks, this looks good to me! On Tue, Sep 6, 2022 at 6:56 PM Ziyang Xuan <william.xuanziyang@...wei.com> wrote: > > Recently, we found a syzkaller problem as following: > > ======================================================== > WARNING: CPU: 1 PID: 17965 at mm/page_alloc.c:5295 __alloc_pages+0x1308/0x16c4 mm/page_alloc.c:5295 > ... > Call trace: > __alloc_pages+0x1308/0x16c4 mm/page_alloc.c:5295 > __alloc_pages_node include/linux/gfp.h:550 [inline] > alloc_pages_node include/linux/gfp.h:564 [inline] > kmalloc_large_node+0x94/0x350 mm/slub.c:4038 > __kmalloc_node_track_caller+0x620/0x8e4 mm/slub.c:4545 > __kmalloc_reserve.constprop.0+0x1e4/0x2b0 net/core/skbuff.c:151 > pskb_expand_head+0x130/0x8b0 net/core/skbuff.c:1654 > __skb_grow include/linux/skbuff.h:2779 [inline] > tun_napi_alloc_frags+0x144/0x610 drivers/net/tun.c:1477 > tun_get_user+0x31c/0x2010 drivers/net/tun.c:1835 > tun_chr_write_iter+0x98/0x100 drivers/net/tun.c:2036 > > It is because the first seg size of the iov_iter from user space is > very big, it is 2147479538 which is bigger than the threshold value > for bail out early in __alloc_pages(). And skb->pfmemalloc is true, > __kmalloc_reserve() would use pfmemalloc reserves without __GFP_NOWARN > flag. Thus we got a warning. > > I noticed that non-first segs size are required less than PAGE_SIZE in > tun_napi_alloc_frags(). The first seg should not be a special case, and > oversized linearization is also unreasonable. Limit the first seg size to > PAGE_SIZE to avoid oversized linearization. > > Fixes: 90e33d459407 ("tun: enable napi_gro_frags() for TUN/TAP driver") > Signed-off-by: Ziyang Xuan <william.xuanziyang@...wei.com> > --- Acked-by: Petar Penkov <ppenkov@...atrix.com>
Powered by blists - more mailing lists