diff options
author | Kees Cook <[email protected]> | 2022-12-07 22:02:59 -0800 |
---|---|---|
committer | Jakub Kicinski <[email protected]> | 2022-12-09 19:47:41 -0800 |
commit | ce098da1497c6dee9589fce2c61d1910f4fcf0e7 (patch) | |
tree | bc8f934696421281c7ec8452433b0a1a5fb5b074 /lib/mpi/mpiutil.c | |
parent | 28d39503e4e06c2caf09a89865c81cfd9e4eae7c (diff) |
skbuff: Introduce slab_build_skb()
syzkaller reported:
BUG: KASAN: slab-out-of-bounds in __build_skb_around+0x235/0x340 net/core/skbuff.c:294
Write of size 32 at addr ffff88802aa172c0 by task syz-executor413/5295
For bpf_prog_test_run_skb(), which uses a kmalloc()ed buffer passed to
build_skb().
When build_skb() is passed a frag_size of 0, it means the buffer came
from kmalloc. In these cases, ksize() is used to find its actual size,
but since the allocation may not have been made to that size, actually
perform the krealloc() call so that all the associated buffer size
checking will be correctly notified (and use the "new" pointer so that
compiler hinting works correctly). Split this logic out into a new
interface, slab_build_skb(), but leave the original 0 checking for now
to catch any stragglers.
Reported-by: [email protected]
Link: https://groups.google.com/g/syzkaller-bugs/c/UnIKxTtU5-0/m/-wbXinkgAQAJ
Fixes: 38931d8989b5 ("mm: Make ksize() a reporting-only function")
Cc: Pavel Begunkov <[email protected]>
Cc: pepsipu <[email protected]>
Cc: [email protected]
Cc: Vlastimil Babka <[email protected]>
Cc: kasan-dev <[email protected]>
Cc: Andrii Nakryiko <[email protected]>
Cc: [email protected]
Cc: Daniel Borkmann <[email protected]>
Cc: Hao Luo <[email protected]>
Cc: Jesper Dangaard Brouer <[email protected]>
Cc: John Fastabend <[email protected]>
Cc: [email protected]
Cc: KP Singh <[email protected]>
Cc: [email protected]
Cc: Stanislav Fomichev <[email protected]>
Cc: [email protected]
Cc: Yonghong Song <[email protected]>
Signed-off-by: Kees Cook <[email protected]>
Link: https://lore.kernel.org/r/[email protected]
Signed-off-by: Jakub Kicinski <[email protected]>
Diffstat (limited to 'lib/mpi/mpiutil.c')
0 files changed, 0 insertions, 0 deletions