KASAN: use-after-free Write in __alloc_skb

45 views
Skip to first unread message

syzbot

unread,
Nov 5, 2019, 7:02:07 AM11/5/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: ef244c30 Linux 4.19.81
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=14653f34e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=a3e67c0671e5c5e7
dashboard link: https://syzkaller.appspot.com/bug?extid=1eb0ac3e1381b5a0a6bf
compiler: gcc (GCC) 9.0.0 20181231 (experimental)

Unfortunately, I don't have any reproducer for this crash yet.

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

nla_parse: 7 callbacks suppressed
netlink: 2 bytes leftover after parsing attributes in process
`syz-executor.3'.
==================================================================
BUG: KASAN: use-after-free in memset include/linux/string.h:333 [inline]
BUG: KASAN: use-after-free in __alloc_skb+0x381/0x5f0 net/core/skbuff.c:234
Write of size 32 at addr ffff88819589fb40 by task syz-executor.3/10719

CPU: 0 PID: 10719 Comm: syz-executor.3 Not tainted 4.19.81 #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x172/0x1f0 lib/dump_stack.c:113
print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report mm/kasan/report.c:412 [inline]
kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
check_memory_region_inline mm/kasan/kasan.c:260 [inline]
check_memory_region+0x123/0x190 mm/kasan/kasan.c:267
memset+0x24/0x40 mm/kasan/kasan.c:285
memset include/linux/string.h:333 [inline]
__alloc_skb+0x381/0x5f0 net/core/skbuff.c:234
alloc_skb include/linux/skbuff.h:995 [inline]
alloc_skb_with_frags+0x93/0x590 net/core/skbuff.c:5303
sock_alloc_send_pskb+0x72d/0x8a0 net/core/sock.c:2085
sock_alloc_send_skb+0x32/0x40 net/core/sock.c:2102
mld_newpack+0x1d7/0x7f0 net/ipv6/mcast.c:1611
add_grhead.isra.0+0x299/0x370 net/ipv6/mcast.c:1715
add_grec+0x7e7/0x10c0 net/ipv6/mcast.c:1846
mld_send_cr net/ipv6/mcast.c:1972 [inline]
mld_ifc_timer_expire+0x3d4/0x8a0 net/ipv6/mcast.c:2479
call_timer_fn+0x18d/0x720 kernel/time/timer.c:1326
expire_timers kernel/time/timer.c:1363 [inline]
__run_timers kernel/time/timer.c:1684 [inline]
__run_timers kernel/time/timer.c:1652 [inline]
run_timer_softirq+0x64f/0x16a0 kernel/time/timer.c:1697
__do_softirq+0x25c/0x921 kernel/softirq.c:292
invoke_softirq kernel/softirq.c:372 [inline]
irq_exit+0x180/0x1d0 kernel/softirq.c:412
exiting_irq arch/x86/include/asm/apic.h:536 [inline]
smp_apic_timer_interrupt+0x13b/0x550 arch/x86/kernel/apic/apic.c:1094
apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:893
</IRQ>
RIP: 0010:page_remove_file_rmap mm/rmap.c:1218 [inline]
RIP: 0010:page_remove_rmap+0x550/0x12c0 mm/rmap.c:1300
Code: ff 45 84 f6 0f 85 3b 05 00 00 e8 6b 27 d2 ff 4c 89 e7 e8 23 0c 0d 00
4c 89 e7 e8 ab 66 04 00 31 ff 89 c3 89 c6 e8 d0 28 d2 ff <85> db 74 6a e8
47 27 d2 ff 49 8d 7c 24 54 be 04 00 00 00 e8 18 ad
RSP: 0018:ffff8880403ef6b0 EFLAGS: 00000293 ORIG_RAX: ffffffffffffff13
RAX: 0000000000000000 RBX: 0000000000000000 RCX: ffffffff81989ff0
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000005
RBP: ffff8880403ef6f0 R08: ffff8880984f8100 R09: ffffed1015d04733
R10: ffffed1015d04732 R11: ffff8880ae823993 R12: ffffea00021ad380
R13: ffffea00021ad388 R14: 0000000000000000 R15: dead000000000100
zap_pte_range mm/memory.c:1338 [inline]
zap_pmd_range mm/memory.c:1440 [inline]
zap_pud_range mm/memory.c:1469 [inline]
zap_p4d_range mm/memory.c:1490 [inline]
unmap_page_range+0xd80/0x1e70 mm/memory.c:1511
unmap_single_vma+0x19d/0x300 mm/memory.c:1556
unmap_vmas+0xae/0x180 mm/memory.c:1586
exit_mmap+0x2c2/0x530 mm/mmap.c:3097
__mmput kernel/fork.c:1010 [inline]
mmput+0x15f/0x4c0 kernel/fork.c:1031
exit_mm kernel/exit.c:546 [inline]
do_exit+0x899/0x2fa0 kernel/exit.c:863
do_group_exit+0x135/0x370 kernel/exit.c:979
get_signal+0x3ec/0x1fc0 kernel/signal.c:2574
do_signal+0x95/0x1960 arch/x86/kernel/signal.c:821
exit_to_usermode_loop+0x244/0x2c0 arch/x86/entry/common.c:163
prepare_exit_to_usermode arch/x86/entry/common.c:198 [inline]
syscall_return_slowpath arch/x86/entry/common.c:271 [inline]
do_syscall_64+0x53d/0x620 arch/x86/entry/common.c:296
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x45a219
Code: ad b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 90 48 89 f8 48 89 f7
48 89 d6 48 89 ca 4d 89 c2 4d 89 c8 4c 8b 4c 24 08 0f 05 <48> 3d 01 f0 ff
ff 0f 83 7b b6 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f591c7ebcf8 EFLAGS: 00000246 ORIG_RAX: 00000000000000ca
RAX: 0000000000000001 RBX: 000000000075bf28 RCX: 000000000045a219
RDX: 00000000004c974d RSI: 0000000000000081 RDI: 000000000075bf2c
RBP: 000000000075bf20 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000003 R11: 0000000000000246 R12: 000000000075bf2c
R13: 00007ffc94eef76f R14: 00007f591c7ec9c0 R15: 000000000075bf2c

The buggy address belongs to the page:
page:ffffea00065627c0 count:0 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0x6fffc0000000000()
raw: 06fffc0000000000 ffffea00065627c8 ffffea00065627c8 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff88819589fa00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88819589fa80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ffff88819589fb00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff88819589fb80: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff88819589fc00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================


---
This bug 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 bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.

syzbot

unread,
Dec 13, 2019, 4:53:10 AM12/13/19
to syzkaller...@googlegroups.com
syzbot has found a reproducer for the following crash on:

HEAD commit: 312017a4 Linux 4.19.89
git tree: linux-4.19.y
console output: https://syzkaller.appspot.com/x/log.txt?x=17eaa1a6e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=67c148d572dbab48
dashboard link: https://syzkaller.appspot.com/bug?extid=1eb0ac3e1381b5a0a6bf
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=17763d96e00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=15805cb6e00000

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

audit: type=1400 audit(1576230604.619:39): avc: denied { read } for
pid=7655 comm="syz-executor358"
scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
tclass=netlink_generic_socket permissive=1
==================================================================
BUG: KASAN: use-after-free in memset include/linux/string.h:333 [inline]
BUG: KASAN: use-after-free in __alloc_skb+0x381/0x5f0 net/core/skbuff.c:234
Write of size 32 at addr ffff8881a3a4a540 by task swapper/1/0

CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.19.89-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:77 [inline]
dump_stack+0x197/0x210 lib/dump_stack.c:118
print_address_description.cold+0x7c/0x20d mm/kasan/report.c:256
kasan_report_error mm/kasan/report.c:354 [inline]
kasan_report mm/kasan/report.c:412 [inline]
kasan_report.cold+0x8c/0x2ba mm/kasan/report.c:396
check_memory_region_inline mm/kasan/kasan.c:260 [inline]
check_memory_region+0x123/0x190 mm/kasan/kasan.c:267
memset+0x24/0x40 mm/kasan/kasan.c:285
memset include/linux/string.h:333 [inline]
__alloc_skb+0x381/0x5f0 net/core/skbuff.c:234
alloc_skb include/linux/skbuff.h:995 [inline]
alloc_skb_with_frags+0x93/0x590 net/core/skbuff.c:5303
sock_alloc_send_pskb+0x72d/0x8a0 net/core/sock.c:2085
sock_alloc_send_skb+0x32/0x40 net/core/sock.c:2102
mld_newpack+0x1d7/0x7f0 net/ipv6/mcast.c:1611
add_grhead.isra.0+0x299/0x370 net/ipv6/mcast.c:1715
add_grec+0x7e7/0x10c0 net/ipv6/mcast.c:1846
mld_send_cr net/ipv6/mcast.c:1972 [inline]
mld_ifc_timer_expire+0x3d4/0x8b0 net/ipv6/mcast.c:2479
call_timer_fn+0x18d/0x720 kernel/time/timer.c:1326
expire_timers kernel/time/timer.c:1363 [inline]
__run_timers kernel/time/timer.c:1684 [inline]
__run_timers kernel/time/timer.c:1652 [inline]
run_timer_softirq+0x64f/0x16a0 kernel/time/timer.c:1697
__do_softirq+0x25c/0x921 kernel/softirq.c:292
invoke_softirq kernel/softirq.c:372 [inline]
irq_exit+0x180/0x1d0 kernel/softirq.c:412
exiting_irq arch/x86/include/asm/apic.h:536 [inline]
smp_apic_timer_interrupt+0x13b/0x550 arch/x86/kernel/apic/apic.c:1094
apic_timer_interrupt+0xf/0x20 arch/x86/entry/entry_64.S:893
</IRQ>
RIP: 0010:native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:61
Code: ff ff 48 89 df e8 92 64 56 fa eb 82 e9 07 00 00 00 0f 00 2d 84 73 5b
00 f4 c3 66 90 e9 07 00 00 00 0f 00 2d 74 73 5b 00 fb f4 <c3> 90 55 48 89
e5 41 57 41 56 41 55 41 54 53 e8 1e 43 0d fa e8 f9
RSP: 0018:ffff8880aa3b7d08 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff13
RAX: 1ffffffff11e4b7c RBX: ffff8880aa3a43c0 RCX: 0000000000000000
RDX: dffffc0000000000 RSI: 0000000000000001 RDI: ffff8880aa3a4c3c
RBP: ffff8880aa3b7d38 R08: ffff8880aa3a43c0 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000001
R13: ffffffff88f25bd0 R14: 0000000000000000 R15: ffff8880aa3a43c0
arch_cpu_idle+0xa/0x10 arch/x86/kernel/process.c:556
default_idle_call+0x36/0x90 kernel/sched/idle.c:93
cpuidle_idle_call kernel/sched/idle.c:153 [inline]
do_idle+0x30c/0x4d0 kernel/sched/idle.c:263
cpu_startup_entry+0xc8/0xe0 kernel/sched/idle.c:369
start_secondary+0x3e8/0x5b0 arch/x86/kernel/smpboot.c:271
secondary_startup_64+0xa4/0xb0 arch/x86/kernel/head_64.S:243

The buggy address belongs to the page:
page:ffffea00068e9280 count:0 mapcount:0 mapping:0000000000000000 index:0x0
flags: 0x57ffe0000000000()
raw: 057ffe0000000000 ffffea00068e9288 ffffea00068e9288 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8881a3a4a400: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff8881a3a4a480: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ffff8881a3a4a500: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff8881a3a4a580: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff8881a3a4a600: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================

syzbot

unread,
Dec 13, 2019, 5:42:09 AM12/13/19
to syzkaller...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: a844dc4c Linux 4.14.158
git tree: linux-4.14.y
console output: https://syzkaller.appspot.com/x/log.txt?x=151aa1a6e00000
kernel config: https://syzkaller.appspot.com/x/.config?x=c02bef505ffc02ff
dashboard link: https://syzkaller.appspot.com/bug?extid=8c710373724f6ea5edfd
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=127c6396e00000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=139ef851e00000

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

audit: type=1400 audit(1576233567.448:39): avc: denied { read } for
pid=7007 comm="syz-executor975"
scontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
tcontext=unconfined_u:system_r:insmod_t:s0-s0:c0.c1023
tclass=netlink_generic_socket permissive=1
==================================================================
BUG: KASAN: use-after-free in memset include/linux/string.h:332 [inline]
BUG: KASAN: use-after-free in __alloc_skb+0x318/0x500 net/core/skbuff.c:234
Write of size 36 at addr ffff8881974a1900 by task swapper/1/0

CPU: 1 PID: 0 Comm: swapper/1 Not tainted 4.14.158-syzkaller #0
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
Call Trace:
<IRQ>
__dump_stack lib/dump_stack.c:17 [inline]
dump_stack+0x142/0x197 lib/dump_stack.c:58
print_address_description.cold+0x7c/0x1dc mm/kasan/report.c:252
kasan_report_error mm/kasan/report.c:351 [inline]
kasan_report mm/kasan/report.c:409 [inline]
kasan_report.cold+0xa9/0x2af mm/kasan/report.c:393
check_memory_region_inline mm/kasan/kasan.c:260 [inline]
check_memory_region+0x123/0x190 mm/kasan/kasan.c:267
memset+0x24/0x40 mm/kasan/kasan.c:285
memset include/linux/string.h:332 [inline]
__alloc_skb+0x318/0x500 net/core/skbuff.c:234
alloc_skb include/linux/skbuff.h:980 [inline]
alloc_skb_with_frags+0x86/0x4b0 net/core/skbuff.c:5228
sock_alloc_send_pskb+0x5db/0x740 net/core/sock.c:2078
sock_alloc_send_skb+0x32/0x40 net/core/sock.c:2095
mld_newpack+0x1c0/0x7a0 net/ipv6/mcast.c:1585
add_grhead.isra.0+0x299/0x370 net/ipv6/mcast.c:1691
add_grec+0x69c/0xef0 net/ipv6/mcast.c:1822
mld_send_cr net/ipv6/mcast.c:1948 [inline]
mld_ifc_timer_expire+0x33e/0x7b0 net/ipv6/mcast.c:2455
call_timer_fn+0x161/0x670 kernel/time/timer.c:1279
expire_timers kernel/time/timer.c:1318 [inline]
__run_timers kernel/time/timer.c:1636 [inline]
__run_timers kernel/time/timer.c:1604 [inline]
run_timer_softirq+0x5b7/0x1520 kernel/time/timer.c:1649
__do_softirq+0x244/0x9a0 kernel/softirq.c:288
invoke_softirq kernel/softirq.c:368 [inline]
irq_exit+0x160/0x1b0 kernel/softirq.c:409
exiting_irq arch/x86/include/asm/apic.h:648 [inline]
smp_apic_timer_interrupt+0x146/0x5e0 arch/x86/kernel/apic/apic.c:1102
apic_timer_interrupt+0x96/0xa0 arch/x86/entry/entry_64.S:792
</IRQ>
RIP: 0010:native_safe_halt+0xe/0x10 arch/x86/include/asm/irqflags.h:61
RSP: 0018:ffff8880a9d37e70 EFLAGS: 00000286 ORIG_RAX: ffffffffffffff10
RAX: 1ffffffff0fe2d2c RBX: ffff8880a9d2a340 RCX: 0000000000000000
RDX: dffffc0000000000 RSI: 0000000000000001 RDI: ffff8880a9d2abbc
RBP: ffff8880a9d37e98 R08: 1ffffffff1164701 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000000 R12: ffffffff87f16950
R13: 0000000000000000 R14: 0000000000000000 R15: ffff8880a9d2a340
arch_cpu_idle+0xa/0x10 arch/x86/kernel/process.c:557
default_idle_call+0x36/0x90 kernel/sched/idle.c:98
cpuidle_idle_call kernel/sched/idle.c:156 [inline]
do_idle+0x262/0x3d0 kernel/sched/idle.c:246
cpu_startup_entry+0x1b/0x20 kernel/sched/idle.c:351
start_secondary+0x346/0x4b0 arch/x86/kernel/smpboot.c:272
secondary_startup_64+0xa5/0xb0 arch/x86/kernel/head_64.S:240

The buggy address belongs to the page:
page:ffffea00065d2840 count:0 mapcount:0 mapping: (null) index:0x0
flags: 0x57ffe0000000000()
raw: 057ffe0000000000 0000000000000000 0000000000000000 00000000ffffffff
raw: ffffea00065d2860 ffffea00065d2860 0000000000000000 0000000000000000
page dumped because: kasan: bad access detected

Memory state around the buggy address:
ffff8881974a1800: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff8881974a1880: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
> ffff8881974a1900: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
^
ffff8881974a1980: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
ffff8881974a1a00: ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff ff
==================================================================


---
This bug 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 bug report. See:
https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
syzbot can test patches for this bug, for details see:
https://goo.gl/tpsmEJ#testing-patches

syzbot

unread,
Feb 11, 2020, 9:43:02 AM2/11/20
to syzkaller...@googlegroups.com
syzbot suspects this bug was fixed by commit:

commit be1a2be7a7b0ed5a758fd8decc39386ba3b5d556
Author: Eric Dumazet <edum...@google.com>
Date: Wed Jan 22 06:47:29 2020 +0000

net: rtnetlink: validate IFLA_MTU attribute in rtnl_create_link()

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=16f79c09e00000
start commit: 312017a4 Linux 4.19.89
git tree: linux-4.19.y
If the result looks correct, please mark the bug fixed by replying with:

#syz fix: net: rtnetlink: validate IFLA_MTU attribute in rtnl_create_link()

For information about bisection process see: https://goo.gl/tpsmEJ#bisection

syzbot

unread,
Feb 14, 2020, 2:03:04 PM2/14/20
to syzkaller...@googlegroups.com
syzbot suspects this bug was fixed by commit:

commit e841252840c48e9a0e5add9d82796b1d55c0f653
Author: Eric Dumazet <edum...@google.com>
Date: Wed Jan 22 06:47:29 2020 +0000

net: rtnetlink: validate IFLA_MTU attribute in rtnl_create_link()

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=1394f7a5e00000
start commit: a844dc4c Linux 4.14.158
git tree: linux-4.14.y
Reply all
Reply to author
Forward
0 new messages