[v5.15] KASAN: slab-out-of-bounds Write in pskb_expand_head

5 views
Skip to first unread message

syzbot

unread,
Mar 11, 2023, 8:03:48 AM3/11/23
to syzkaller...@googlegroups.com
Hello,

syzbot found the following issue on:

HEAD commit: abddfcf701a5 Linux 5.15.99
git tree: linux-5.15.y
console output: https://syzkaller.appspot.com/x/log.txt?x=163e10ecc80000
kernel config: https://syzkaller.appspot.com/x/.config?x=53e47369740caba3
dashboard link: https://syzkaller.appspot.com/bug?extid=c9ac918714c3dfc9108c
compiler: Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
userspace arch: arm64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=14e63988c80000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=12a99a70c80000

Downloadable assets:
disk image: https://storage.googleapis.com/syzbot-assets/78c522505d54/disk-abddfcf7.raw.xz
vmlinux: https://storage.googleapis.com/syzbot-assets/caca388168a7/vmlinux-abddfcf7.xz
kernel image: https://storage.googleapis.com/syzbot-assets/e6db198604be/Image-abddfcf7.gz.xz

IMPORTANT: if you fix the issue, please add the following tag to the commit:
Reported-by: syzbot+c9ac91...@syzkaller.appspotmail.com

==================================================================
BUG: KASAN: slab-out-of-bounds in pskb_expand_head+0x1c4/0x1064 net/core/skbuff.c:1714
Write of size 48 at addr ffff0000c1c3e1c0 by task kworker/0:0/7

CPU: 0 PID: 7 Comm: kworker/0:0 Not tainted 5.15.99-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Workqueue: mld mld_ifc_work
Call trace:
dump_backtrace+0x0/0x530 arch/arm64/kernel/stacktrace.c:152
show_stack+0x2c/0x3c arch/arm64/kernel/stacktrace.c:216
__dump_stack lib/dump_stack.c:88 [inline]
dump_stack_lvl+0x108/0x170 lib/dump_stack.c:106
print_address_description+0x7c/0x3f0 mm/kasan/report.c:248
__kasan_report mm/kasan/report.c:434 [inline]
kasan_report+0x174/0x1e4 mm/kasan/report.c:451
kasan_check_range+0x274/0x2b4 mm/kasan/generic.c:189
memcpy+0xb4/0xe8 mm/kasan/shadow.c:66
pskb_expand_head+0x1c4/0x1064 net/core/skbuff.c:1714
__skb_cow include/linux/skbuff.h:3364 [inline]
skb_cow_head include/linux/skbuff.h:3398 [inline]
batadv_skb_head_push+0x158/0x1e8 net/batman-adv/soft-interface.c:73
batadv_interface_tx+0xb74/0x12d8 net/batman-adv/soft-interface.c:330
__netdev_start_xmit include/linux/netdevice.h:5017 [inline]
netdev_start_xmit include/linux/netdevice.h:5031 [inline]
xmit_one net/core/dev.c:3590 [inline]
dev_hard_start_xmit+0x3a0/0xc50 net/core/dev.c:3606
__dev_queue_xmit+0x1500/0x2c20 net/core/dev.c:4221
dev_queue_xmit+0x24/0x34 net/core/dev.c:4254
neigh_hh_output include/net/neighbour.h:500 [inline]
neigh_output include/net/neighbour.h:514 [inline]
ip6_finish_output2+0x1310/0x1c48 net/ipv6/ip6_output.c:126
__ip6_finish_output+0x518/0x67c net/ipv6/ip6_output.c:191
ip6_finish_output+0x40/0x218 net/ipv6/ip6_output.c:201
NF_HOOK_COND include/linux/netfilter.h:296 [inline]
ip6_output+0x270/0x594 net/ipv6/ip6_output.c:224
dst_output include/net/dst.h:449 [inline]
NF_HOOK+0x160/0x4ec include/linux/netfilter.h:307
mld_sendpack+0x828/0x1264 net/ipv6/mcast.c:1820
mld_send_cr net/ipv6/mcast.c:2121 [inline]
mld_ifc_work+0x85c/0xb9c net/ipv6/mcast.c:2653
process_one_work+0x84c/0x14b8 kernel/workqueue.c:2306
worker_thread+0x910/0x1034 kernel/workqueue.c:2453
kthread+0x37c/0x45c kernel/kthread.c:319
ret_from_fork+0x10/0x20 <unknown>:870

Allocated by task 1:
kasan_save_stack mm/kasan/common.c:38 [inline]
kasan_set_track mm/kasan/common.c:46 [inline]
set_alloc_info mm/kasan/common.c:434 [inline]
____kasan_kmalloc+0xbc/0xfc mm/kasan/common.c:513
__kasan_kmalloc+0x10/0x1c mm/kasan/common.c:522
kasan_kmalloc include/linux/kasan.h:264 [inline]
kmem_cache_alloc_trace+0x248/0x3b4 mm/slub.c:3247
kmalloc include/linux/slab.h:591 [inline]
kzalloc include/linux/slab.h:721 [inline]
call_usermodehelper_setup+0xa8/0x254 kernel/umh.c:365
kobject_uevent_env+0x660/0x898 lib/kobject_uevent.c:614
kobject_uevent+0x2c/0x3c lib/kobject_uevent.c:642
kernel_add_sysfs_param+0x104/0x138 kernel/params.c:816
param_sysfs_builtin+0x180/0x1ec kernel/params.c:851
param_sysfs_init+0x70/0x80 kernel/params.c:970
do_one_initcall+0x2e4/0xc68 init/main.c:1306
do_initcall_level+0x154/0x214 init/main.c:1379
do_initcalls+0x58/0xac init/main.c:1395
do_basic_setup+0x8c/0xa0 init/main.c:1414
kernel_init_freeable+0x470/0x650 init/main.c:1619
kernel_init+0x24/0x294 init/main.c:1510
ret_from_fork+0x10/0x20 <unknown>:870

The buggy address belongs to the object at ffff0000c1c3e000
which belongs to the cache kmalloc-256 of size 256
The buggy address is located 192 bytes to the right of
256-byte region [ffff0000c1c3e000, ffff0000c1c3e100)
The buggy address belongs to the page:
page:0000000069d69f6d refcount:1 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x101c3e
head:0000000069d69f6d order:1 compound_mapcount:0
flags: 0x5ffc00000010200(slab|head|node=0|zone=2|lastcpupid=0x7ff)
raw: 05ffc00000010200 dead000000000100 dead000000000122 ffff0000c0002480
raw: 0000000000000000 0000000080100010 00000001ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff0000c1c3e080: fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb fb
ffff0000c1c3e100: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
>ffff0000c1c3e180: fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc fc
^
ffff0000c1c3e200: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
ffff0000c1c3e280: 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00
==================================================================
Unable to handle kernel paging request at virtual address dfff800000000000
Mem abort info:
ESR = 0x0000000096000006
EC = 0x25: DABT (current EL), IL = 32 bits
SET = 0, FnV = 0
EA = 0, S1PTW = 0
FSC = 0x06: level 2 translation fault
Data abort info:
ISV = 0, ISS = 0x00000006
CM = 0, WnR = 0
[dfff800000000000] address between user and kernel address ranges
Internal error: Oops: 96000006 [#1] PREEMPT SMP
Modules linked in:
CPU: 0 PID: 7 Comm: kworker/0:0 Tainted: G B 5.15.99-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 03/02/2023
Workqueue: mld mld_ifc_work
pstate: 80400005 (Nzcv daif +PAN -UAO -TCO -DIT -SSBS BTYPE=--)
pc : _compound_head include/linux/page-flags.h:196 [inline]
pc : put_page+0x2c/0x21c include/linux/mm.h:1233
lr : put_page+0x24/0x21c include/linux/mm.h:1232
sp : ffff8000189a7050
x29: ffff8000189a7050 x28: ffff0001c1c3e1f0 x27: 1fffe0001b4eb00f
x26: dfff800000000000 x25: ffffffffffffffff x24: 1fffe00038387c38
x23: ffff0001c1c3e1f0 x22: 0000000000000000 x21: dfff800000000000
x20: 0000000000000007 x19: ffffffffffffffff x18: 0000000000000402
x17: ff808000083386a0 x16: ffff800011a08b18 x15: ffff8000083386a0
x14: 00000000ffffffff x13: ffffffffffffffff x12: 0000000000000000
x11: ff8080000fdc8df0 x10: 0000000000000000 x9 : ffff80000fdc8df0
x8 : 0000000000000000 x7 : 0000000000000000 x6 : ffff80000fdbd374
x5 : 0000000000000000 x4 : 0000000000000000 x3 : ffff80000fdb3d58
x2 : 0000000000000001 x1 : 0000000000000000 x0 : ffffffffffffffff
Call trace:
_compound_head include/linux/page-flags.h:196 [inline]
put_page+0x2c/0x21c include/linux/mm.h:1233
__skb_frag_unref include/linux/skbuff.h:3218 [inline]
skb_release_data+0x2e4/0x5fc net/core/skbuff.c:672
skb_release_all net/core/skbuff.c:742 [inline]
__kfree_skb net/core/skbuff.c:756 [inline]
consume_skb+0xa0/0x18c net/core/skbuff.c:914
batadv_send_bcast_packet+0x44/0x58 net/batman-adv/send.c:999
batadv_interface_tx+0xcec/0x12d8 net/batman-adv/soft-interface.c:351
__netdev_start_xmit include/linux/netdevice.h:5017 [inline]
netdev_start_xmit include/linux/netdevice.h:5031 [inline]
xmit_one net/core/dev.c:3590 [inline]
dev_hard_start_xmit+0x3a0/0xc50 net/core/dev.c:3606
__dev_queue_xmit+0x1500/0x2c20 net/core/dev.c:4221
dev_queue_xmit+0x24/0x34 net/core/dev.c:4254
neigh_hh_output include/net/neighbour.h:500 [inline]
neigh_output include/net/neighbour.h:514 [inline]
ip6_finish_output2+0x1310/0x1c48 net/ipv6/ip6_output.c:126
__ip6_finish_output+0x518/0x67c net/ipv6/ip6_output.c:191
ip6_finish_output+0x40/0x218 net/ipv6/ip6_output.c:201
NF_HOOK_COND include/linux/netfilter.h:296 [inline]
ip6_output+0x270/0x594 net/ipv6/ip6_output.c:224
dst_output include/net/dst.h:449 [inline]
NF_HOOK+0x160/0x4ec include/linux/netfilter.h:307
mld_sendpack+0x828/0x1264 net/ipv6/mcast.c:1820
mld_send_cr net/ipv6/mcast.c:2121 [inline]
mld_ifc_work+0x85c/0xb9c net/ipv6/mcast.c:2653
process_one_work+0x84c/0x14b8 kernel/workqueue.c:2306
worker_thread+0x910/0x1034 kernel/workqueue.c:2453
kthread+0x37c/0x45c kernel/kthread.c:319
ret_from_fork+0x10/0x20 <unknown>:870
Code: f2fbfff5 961bf75c 91002274 d343fe88 (38756908)
---[ end trace e2058ed71e43c7ab ]---
----------------
Code disassembly (best guess):
0: f2fbfff5 movk x21, #0xdfff, lsl #48
4: 961bf75c bl 0xfffffffff86fdd74
8: 91002274 add x20, x19, #0x8
c: d343fe88 lsr x8, x20, #3
* 10: 38756908 ldrb w8, [x8, x21] <-- trapping instruction


---
This report is generated by a bot. It may contain errors.
See https://goo.gl/tpsmEJ for more information about syzbot.
syzbot engineers can be reached at syzk...@googlegroups.com.

syzbot will keep track of this issue. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this issue, for details see:
https://goo.gl/tpsmEJ#testing-patches
Reply all
Reply to author
Forward
0 new messages