KASAN: use-after-free Read in pppol2tp_connect

9 views
Skip to first unread message

syzbot

unread,
Apr 12, 2019, 8:00:40 PM4/12/19
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 962d1f3f ANDROID: sched: EAS: check energy_aware() before ..
git tree: android-4.4
console output: https://syzkaller.appspot.com/x/log.txt?x=113e5215800000
kernel config: https://syzkaller.appspot.com/x/.config?x=c329588c9963e90f
dashboard link: https://syzkaller.appspot.com/bug?extid=31ed21fddd78c6184a31
compiler: gcc (GCC) 7.1.1 20170620
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=108e1a65800000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=14baa725800000

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

==================================================================
BUG: KASAN: use-after-free in pppol2tp_connect+0x18d2/0x1930
net/l2tp/l2tp_ppp.c:728
Read of size 8 at addr ffff8801cb66e690 by task syzkaller228382/8748

CPU: 1 PID: 8748 Comm: syzkaller228382 Not tainted 4.4.113-g962d1f3 #2
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
0000000000000000 e330089678c3fa09 ffff8801cdaa7b28 ffffffff81d028ed
ffffea00072d9b80 ffff8801cb66e690 0000000000000000 ffff8801cb66e690
1ffff10039b54f82 ffff8801cdaa7b60 ffffffff814fd1c3 ffff8801cb66e690
Call Trace:
[<ffffffff81d028ed>] __dump_stack lib/dump_stack.c:15 [inline]
[<ffffffff81d028ed>] dump_stack+0xc1/0x124 lib/dump_stack.c:51
[<ffffffff814fd1c3>] print_address_description+0x73/0x260
mm/kasan/report.c:252
[<ffffffff814fd6d5>] kasan_report_error mm/kasan/report.c:351 [inline]
[<ffffffff814fd6d5>] kasan_report+0x285/0x370 mm/kasan/report.c:408
[<ffffffff814fd834>] __asan_report_load8_noabort+0x14/0x20
mm/kasan/report.c:429
[<ffffffff83460e22>] pppol2tp_connect+0x18d2/0x1930 net/l2tp/l2tp_ppp.c:728
[<ffffffff82dead36>] SYSC_connect+0x1b6/0x310 net/socket.c:1557
[<ffffffff82ded5a4>] SyS_connect+0x24/0x30 net/socket.c:1538
[<ffffffff83771c9f>] entry_SYSCALL_64_fastpath+0x1c/0x98

Allocated by task 8757:
[<ffffffff81035df6>] save_stack_trace+0x26/0x50
arch/x86/kernel/stacktrace.c:63
[<ffffffff814fc233>] save_stack+0x43/0xd0 mm/kasan/kasan.c:512
[<ffffffff814fc4fd>] set_track mm/kasan/kasan.c:524 [inline]
[<ffffffff814fc4fd>] kasan_kmalloc+0xad/0xe0 mm/kasan/kasan.c:616
[<ffffffff814f87e4>] __kmalloc+0x124/0x320 mm/slub.c:3613
[<ffffffff8345bfb9>] kmalloc include/linux/slab.h:481 [inline]
[<ffffffff8345bfb9>] kzalloc include/linux/slab.h:620 [inline]
[<ffffffff8345bfb9>] l2tp_session_create+0x39/0x10f0
net/l2tp/l2tp_core.c:1744
[<ffffffff8346064c>] pppol2tp_connect+0x10fc/0x1930 net/l2tp/l2tp_ppp.c:718
[<ffffffff82dead36>] SYSC_connect+0x1b6/0x310 net/socket.c:1557
[<ffffffff82ded5a4>] SyS_connect+0x24/0x30 net/socket.c:1538
[<ffffffff83771c9f>] entry_SYSCALL_64_fastpath+0x1c/0x98

Freed by task 8757:
[<ffffffff81035df6>] save_stack_trace+0x26/0x50
arch/x86/kernel/stacktrace.c:63
[<ffffffff814fc233>] save_stack+0x43/0xd0 mm/kasan/kasan.c:512
[<ffffffff814fcb52>] set_track mm/kasan/kasan.c:524 [inline]
[<ffffffff814fcb52>] kasan_slab_free+0x72/0xc0 mm/kasan/kasan.c:589
[<ffffffff814f95ec>] slab_free_hook mm/slub.c:1383 [inline]
[<ffffffff814f95ec>] slab_free_freelist_hook mm/slub.c:1405 [inline]
[<ffffffff814f95ec>] slab_free mm/slub.c:2859 [inline]
[<ffffffff814f95ec>] kfree+0xfc/0x300 mm/slub.c:3749
[<ffffffff83458540>] l2tp_session_free+0x170/0x200
net/l2tp/l2tp_core.c:1672
[<ffffffff834622e3>] l2tp_session_dec_refcount_1 net/l2tp/l2tp_core.h:293
[inline]
[<ffffffff834622e3>] pppol2tp_session_destruct+0xd3/0x110
net/l2tp/l2tp_ppp.c:477
[<ffffffff82dfb3da>] sk_destruct+0x4a/0x4c0 net/core/sock.c:1447
[<ffffffff82dfb8a7>] __sk_free+0x57/0x230 net/core/sock.c:1480
[<ffffffff82dfbab0>] sk_free+0x30/0x40 net/core/sock.c:1491
[<ffffffff834631ba>] sock_put include/net/sock.h:1639 [inline]
[<ffffffff834631ba>] pppol2tp_release+0x27a/0x310 net/l2tp/l2tp_ppp.c:518
[<ffffffff82de637d>] sock_release+0x8d/0x1e0 net/socket.c:586
[<ffffffff82de64e6>] sock_close+0x16/0x20 net/socket.c:1037
[<ffffffff815224d3>] __fput+0x233/0x6d0 fs/file_table.c:208
[<ffffffff815229f5>] ____fput+0x15/0x20 fs/file_table.c:244
[<ffffffff8118b9d4>] task_work_run+0x104/0x180 kernel/task_work.c:115
[<ffffffff81132f7a>] exit_task_work include/linux/task_work.h:21 [inline]
[<ffffffff81132f7a>] do_exit+0x82a/0x2a10 kernel/exit.c:755
[<ffffffff81139418>] do_group_exit+0x108/0x320 kernel/exit.c:885
[<ffffffff8115c872>] get_signal+0x4f2/0x1550 kernel/signal.c:2317
[<ffffffff8100e7fb>] do_signal+0x8b/0x1d40 arch/x86/kernel/signal.c:712
[<ffffffff810035fa>] exit_to_usermode_loop+0x11a/0x160
arch/x86/entry/common.c:247
[<ffffffff81006535>] prepare_exit_to_usermode arch/x86/entry/common.c:282
[inline]
[<ffffffff81006535>] syscall_return_slowpath+0x1b5/0x1f0
arch/x86/entry/common.c:347
[<ffffffff83771e29>] int_ret_from_sys_call+0x25/0xa3

The buggy address belongs to the object at ffff8801cb66e500
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 400 bytes inside of
512-byte region [ffff8801cb66e500, ffff8801cb66e700)
The buggy address belongs to the page:
------------[ cut here ]------------
SeaBIOS (version 1.8.2-20171012_061934-google)
Initializing cgroup subsys cpuset
Initializing cgroup subsys cpu
Initializing cgroup subsys cpuacct
Initializing cgroup subsys schedtune
Linux version 4.4.113-g962d1f3 (syzkaller@ci) (gcc version 7.1.1 20170620
(GCC) ) #2 SMP PREEMPT Mon Jan 29 16:51:40 UTC 2018
Command line: BOOT_IMAGE=/vmlinuz root=/dev/sda1 console=ttyS0
earlyprintk=serial vsyscall=native rodata=n ftrace_dump_on_oops=orig_cpu
oops=panic panic_on_warn=1 nmi_watchdog=panic panic=86400
workqueue.watchdog_thresh=120
KERNEL supported cpus:
Intel GenuineIntel
AMD AuthenticAMD
Centaur CentaurHauls
x86/fpu: xstate_offset[2]: 576, xstate_sizes[2]: 256
x86/fpu: Supporting XSAVE feature 0x01: 'x87 floating point registers'
x86/fpu: Supporting XSAVE feature 0x02: 'SSE registers'
x86/fpu: Supporting XSAVE feature 0x04: 'AVX registers'
x86/fpu: Enabled xstate features 0x7, context size is 832 bytes,
using 'standard' format.
x86/fpu: Using 'eager' FPU context switches.
e820: BIOS-provided physical RAM map:
BIOS-e820: [mem 0x0000000000000000-0x000000000009fbff] usable
BIOS-e820: [mem 0x000000000009fc00-0x000000000009ffff] reserved
BIOS-e820: [mem 0x00000000000f0000-0x00000000000fffff] reserved
BIOS-e820: [mem 0x0000000000100000-0x00000000bfff2fff] usable
BIOS-e820: [mem 0x00000000bfff3000-0x00000000bfffffff] reserved
BIOS-e820: [mem 0x00000000fffbc000-0x00000000ffffffff] reserved
BIOS-e820: [mem 0x0000000100000000-0x000000021fffffff] usable
bootconsole [earlyser0] enabled
NX (Execute Disable) protection: active
SMBIOS 2.4 present.
Hypervisor detected: KVM
e820: last_pfn = 0x220000 max_arch_pfn = 0x400000000
x86/PAT: Configuration [0-7]: WB WC UC- UC WB WC UC- WT
e820: last_pfn = 0xbfff3 max_arch_pfn = 0x400000000
found SMP MP-table at [mem 0x000f28d0-0x000f28df] mapped at
[ffff8800000f28d0]
Scanning 1 areas for low memory corruption
Using GB pages for direct mapping
ACPI: Early table checksum verification disabled
ACPI: RSDP 0x00000000000F2890 000014 (v00 Google)
ACPI: RSDT 0x00000000BFFF3430 000038 (v01 Google GOOGRSDT 00000001 GOOG
00000001)
ACPI: FACP 0x00000000BFFFCF60 0000F4 (v02 Google GOOGFACP 00000001 GOOG
00000001)
ACPI: DSDT 0x00000000BFFF3470 0017B2 (v01 Google GOOGDSDT 00000001 GOOG
00000001)
ACPI: FACS 0x00000000BFFFCF00 000040
ACPI: FACS 0x00000000BFFFCF00 000040
ACPI: SSDT 0x00000000BFFF65F0 00690D (v01 Google GOOGSSDT 00000001 GOOG
00000001)
ACPI: APIC 0x00000000BFFF5D10 000076 (v01 Google GOOGAPIC 00000001 GOOG
00000001)
ACPI: WAET 0x00000000BFFF5CE0 000028 (v01 Google GOOGWAET 00000001 GOOG
00000001)
ACPI: SRAT 0x00000000BFFF4C30 0000C8 (v01 Google GOOGSRAT 00000001 GOOG
00000001)
kvm-clock: Using msrs 4b564d01 and 4b564d00
kvm-clock: cpu 0, msr 2:1fffd001, primary cpu clock
kvm-clock: using sched offset of 1938525517 cycles
clocksource: kvm-clock: mask: 0xffffffffffffffff max_cycles: 0x1cd42e4dffb,
max_idle_ns: 881590591483 ns
Zone ranges:
DMA [mem 0x0000000000001000-0x0000000000ffffff]
DMA32 [mem 0x0000000001000000-0x00000000ffffffff]
Normal [mem 0x0000000100000000-0x000000021fffffff]
Movable zone start for each node
Early memory node ranges
node 0: [mem 0x0000000000001000-0x000000000009efff]
node 0: [mem 0x0000000000100000-0x00000000bfff2fff]
node 0: [mem 0x0000000100000000-0x000000021fffffff]
Initmem setup node 0 [mem 0x0000000000001000-0x000000021fffffff]
kasan: KernelAddressSanitizer initialized
ACPI: PM-Timer IO Port: 0xb008
ACPI: LAPIC_NMI (acpi_id[0xff] dfl dfl lint[0x1])
IOAPIC[0]: apic_id 0, version 17, address 0xfec00000, GSI 0-23
ACPI: INT_SRC_OVR (bus 0 bus_irq 5 global_irq 5 high level)
ACPI: INT_SRC_OVR (bus 0 bus_irq 9 global_irq 9 high level)
ACPI: INT_SRC_OVR (bus 0 bus_irq 10 global_irq 10 high level)
ACPI: INT_SRC_OVR (bus 0 bus_irq 11 global_irq 11 high level)
Using ACPI (MADT) for SMP configuration information
smpboot: Allowing 2 CPUs, 0 hotplug CPUs
PM: Registered nosave memory: [mem 0x00000000-0x00000fff]
PM: Registered nosave memory: [mem 0x0009f000-0x0009ffff]
PM: Registered nosave memory: [mem 0x000a0000-0x000effff]
PM: Registered nosave memory: [mem 0x000f0000-0x000fffff]
PM: Registered nosave memory: [mem 0xbfff3000-0xbfffffff]
PM: Registered nosave memory: [mem 0xc0000000-0xfffbbfff]
PM: Registered nosave memory: [mem 0xfffbc000-0xffffffff]
e820: [mem 0xc0000000-0xfffbbfff] available for PCI devices
Booting paravirtualized kernel on KVM
clocksource: refined-jiffies: mask: 0xffffffff max_cycles: 0xffffffff,
max_idle_ns: 19112604462750000 ns
setup_percpu: NR_CPUS:64 nr_cpumask_bits:64 nr_cpu_ids:2 nr_node_ids:1
PERCPU: Embedded 42 pages/cpu @ffff8801db200000 s134024 r8192 d29816
u1048576
Built 1 zonelists in Zone order, mobility grouping on. Total pages: 1935227
Kernel command line: BOOT_IMAGE=/vmlinuz root=/dev/sda1 console=ttyS0
earlyprintk=serial vsyscall=native rodata=n ftrace_dump_on_oops=orig_cpu
oops=panic panic_on_warn=1 nmi_watchdog=panic panic=86400
workqueue.watchdog_thresh=120
PID hash table entries: 4096 (order: 3, 32768 bytes)
Dentry cache hash table entries: 1048576 (order: 11, 8388608 bytes)
Inode-cache hash table entries: 524288 (order: 10, 4194304 bytes)
Memory: 6581404K/7863876K available (40414K kernel code, 6135K rwdata,
8812K rodata, 1852K init, 23616K bss, 1282472K reserved, 0K cma-reserved)
SLUB: HWalign=64, Order=0-3, MinObjects=0, CPUs=2, Nodes=1
Kernel/User page tables isolation: enabled
Running RCU self tests
Preemptible hierarchical RCU implementation.
RCU lockdep checking is enabled.
Build-time adjustment of leaf fanout to 64.
RCU restricting CPUs from NR_CPUS=64 to nr_cpu_ids=2.
RCU: Adjusting geometry for rcu_fanout_leaf=64, nr_cpu_ids=2
NR_IRQS:4352 nr_irqs:440 16
console [ttyS0] enabled
console [ttyS0] enabled
bootconsole [earlyser0] disabled
bootconsole [earlyser0] disabled
Lock dependency validator: Copyright (c) 2006 Red Hat, Inc., Ingo Molnar
... MAX_LOCKDEP_SUBCLASSES: 8
... MAX_LOCK_DEPTH: 48
... MAX_LOCKDEP_KEYS: 8191
... CLASSHASH_SIZE: 4096
... MAX_LOCKDEP_ENTRIES: 32768
... MAX_LOCKDEP_CHAINS: 65536
... CHAINHASH_SIZE: 32768
memory used by lock dependency info: 8159 kB
per task-struct memory footprint: 1920 bytes
tsc: Detected 2300.000 MHz processor
Calibrating delay loop (skipped) preset value.. 4600.00 BogoMIPS
(lpj=23000000)
pid_max: default: 32768 minimum: 301
ACPI: Core revision 20150930
ACPI: 2 ACPI AML tables successfully acquired and loaded
Security Framework initialized
SELinux: Initializing.
AppArmor: AppArmor disabled by boot time parameter
Mount-cache hash table entries: 16384 (order: 5, 131072 bytes)
Mountpoint-cache hash table entries: 16384 (order: 5, 131072 bytes)
Initializing cgroup subsys io
Initializing cgroup subsys freezer
Initializing cgroup subsys hugetlb
Initializing cgroup subsys debug
CPU: Physical Processor ID: 0
mce: CPU supports 32 MCE banks
Last level iTLB entries: 4KB 1024, 2MB 1024, 4MB 1024
Last level dTLB entries: 4KB 1024, 2MB 1024, 4MB 1024, 1GB 4
Spectre V2 mitigation: Vulnerable: Minimal generic ASM retpoline
Freeing SMP alternatives memory: 44K
..TIMER: vector=0x30 apic1=0 pin1=0 apic2=-1 pin2=-1
smpboot: CPU0: Intel(R) Xeon(R) CPU @ 2.30GHz (family: 0x6, model: 0x3f,
stepping: 0x0)
Performance Events: unsupported p6 CPU model 63 no PMU driver, software
events only.
x86: Booting SMP configuration:
.... node #0, CPUs: #1
kvm-clock: cpu 1, msr 2:1fffd041, secondary cpu clock
x86: Booted up 1 node, 2 CPUs
smpboot: Total of 2 processors activated (9200.00 BogoMIPS)
devtmpfs: initialized
clocksource: jiffies: mask: 0xffffffff max_cycles: 0xffffffff, max_idle_ns:
19112604462750000 ns
futex hash table entries: 512 (order: 4, 65536 bytes)
xor: automatically using best checksumming function:
kworker/u4:0 (21) used greatest stack depth: 28008 bytes left
avx : 21526.000 MB/sec
RTC time: 2:33:25, date: 01/31/18
NET: Registered protocol family 16
schedtune: init normalization constants...
schedtune: no energy model data
schedtune: disabled!
cpuidle: using governor ladder
cpuidle: using governor menu
ACPI: bus type PCI registered
acpiphp: ACPI Hot Plug PCI Controller Driver version: 0.5
PCI: Using configuration type 1 for base access
kworker/u4:0 (43) used greatest stack depth: 27512 bytes left
kworker/u4:0 (479) used greatest stack depth: 27144 bytes left
raid6: sse2x1 gen() 4607 MB/s
raid6: sse2x1 xor() 2501 MB/s
raid6: sse2x2 gen() 6966 MB/s
raid6: sse2x2 xor() 3990 MB/s
raid6: sse2x4 gen() 8666 MB/s
raid6: sse2x4 xor() 5220 MB/s
raid6: avx2x1 gen() 9339 MB/s
raid6: avx2x2 gen() 14331 MB/s
raid6: avx2x4 gen() 18548 MB/s
raid6: using algorithm avx2x4 gen() 18548 MB/s
raid6: using avx2x2 recovery algorithm
ACPI: Added _OSI(Module Device)
ACPI: Added _OSI(Processor Device)
ACPI: Added _OSI(3.0 _SCP Extensions)
ACPI: Added _OSI(Processor Aggregator Device)
ACPI: Executed 2 blocks of module-level executable AML code
ACPI: Interpreter enabled
ACPI: (supports S0 S3 S4 S5)
ACPI: Using IOAPIC for interrupt routing
PCI: Using host bridge windows from ACPI; if necessary, use "pci=nocrs" and
report a bug
ACPI: PCI Root Bridge [PCI0] (domain 0000 [bus 00-ff])
acpi PNP0A03:00: _OSC: OS supports [ASPM ClockPM Segments MSI]
acpi PNP0A03:00: _OSC failed (AE_NOT_FOUND); disabling ASPM
acpi PNP0A03:00: fail to add MMCONFIG information, can't access extended
PCI configuration space under this bridge.
PCI host bridge to bus 0000:00
pci_bus 0000:00: root bus resource [io 0x0000-0x0cf7 window]
pci_bus 0000:00: root bus resource [io 0x0d00-0xffff window]
pci_bus 0000:00: root bus resource [mem 0x000a0000-0x000bffff window]
pci_bus 0000:00: root bus resource [mem 0xc0000000-0xfebfffff window]
pci_bus 0000:00: root bus resource [bus 00-ff]
pci 0000:00:01.3: quirk: [io 0xb000-0xb03f] claimed by PIIX4 ACPI
ACPI: PCI Interrupt Link [LNKA] (IRQs 5 *10 11)
ACPI: PCI Interrupt Link [LNKB] (IRQs 5 *10 11)
ACPI: PCI Interrupt Link [LNKC] (IRQs 5 10 *11)
ACPI: PCI Interrupt Link [LNKD] (IRQs 5 10 *11)
ACPI: PCI Interrupt Link [LNKS] (IRQs *9)


---
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
Reply all
Reply to author
Forward
0 new messages