Bart Van Assche
009bb421b6
workqueue, lockdep: Fix an alloc_workqueue() error path
This patch fixes a use-after-free and a memory leak in an alloc_workqueue()
error path.
Repoted by syzkaller and KASAN:
BUG: KASAN: use-after-free in __read_once_size include/linux/compiler.h:197 [inline]
BUG: KASAN: use-after-free in lockdep_register_key+0x3b9/0x490 kernel/locking/lockdep.c:1023
Read of size 8 at addr ffff888090fc2698 by task syz-executor134/7858
CPU: 1 PID: 7858 Comm: syz-executor134 Not tainted 5.0.0-rc8-next-20190301 #1
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 01/01/2011
Call Trace:
__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:187
kasan_report.cold+0x1b/0x40 mm/kasan/report.c:317
__asan_report_load8_noabort+0x14/0x20 mm/kasan/generic_report.c:132
__read_once_size include/linux/compiler.h:197 [inline]
lockdep_register_key+0x3b9/0x490 kernel/locking/lockdep.c:1023
wq_init_lockdep kernel/workqueue.c:3444 [inline]
alloc_workqueue+0x427/0xe70 kernel/workqueue.c:4263
ucma_open+0x76/0x290 drivers/infiniband/core/ucma.c:1732
misc_open+0x398/0x4c0 drivers/char/misc.c:141
chrdev_open+0x247/0x6b0 fs/char_dev.c:417
do_dentry_open+0x488/0x1160 fs/open.c:771
vfs_open+0xa0/0xd0 fs/open.c:880
do_last fs/namei.c:3416 [inline]
path_openat+0x10e9/0x46e0 fs/namei.c:3533
do_filp_open+0x1a1/0x280 fs/namei.c:3563
do_sys_open+0x3fe/0x5d0 fs/open.c:1063
__do_sys_openat fs/open.c:1090 [inline]
__se_sys_openat fs/open.c:1084 [inline]
__x64_sys_openat+0x9d/0x100 fs/open.c:1084
do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
Allocated by task 7789:
save_stack+0x45/0xd0 mm/kasan/common.c:75
set_track mm/kasan/common.c:87 [inline]
__kasan_kmalloc mm/kasan/common.c:497 [inline]
__kasan_kmalloc.constprop.0+0xcf/0xe0 mm/kasan/common.c:470
kasan_kmalloc+0x9/0x10 mm/kasan/common.c:511
__do_kmalloc mm/slab.c:3726 [inline]
__kmalloc+0x15c/0x740 mm/slab.c:3735
kmalloc include/linux/slab.h:553 [inline]
kzalloc include/linux/slab.h:743 [inline]
alloc_workqueue+0x13c/0xe70 kernel/workqueue.c:4236
ucma_open+0x76/0x290 drivers/infiniband/core/ucma.c:1732
misc_open+0x398/0x4c0 drivers/char/misc.c:141
chrdev_open+0x247/0x6b0 fs/char_dev.c:417
do_dentry_open+0x488/0x1160 fs/open.c:771
vfs_open+0xa0/0xd0 fs/open.c:880
do_last fs/namei.c:3416 [inline]
path_openat+0x10e9/0x46e0 fs/namei.c:3533
do_filp_open+0x1a1/0x280 fs/namei.c:3563
do_sys_open+0x3fe/0x5d0 fs/open.c:1063
__do_sys_openat fs/open.c:1090 [inline]
__se_sys_openat fs/open.c:1084 [inline]
__x64_sys_openat+0x9d/0x100 fs/open.c:1084
do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
Freed by task 7789:
save_stack+0x45/0xd0 mm/kasan/common.c:75
set_track mm/kasan/common.c:87 [inline]
__kasan_slab_free+0x102/0x150 mm/kasan/common.c:459
kasan_slab_free+0xe/0x10 mm/kasan/common.c:467
__cache_free mm/slab.c:3498 [inline]
kfree+0xcf/0x230 mm/slab.c:3821
alloc_workqueue+0xc3e/0xe70 kernel/workqueue.c:4295
ucma_open+0x76/0x290 drivers/infiniband/core/ucma.c:1732
misc_open+0x398/0x4c0 drivers/char/misc.c:141
chrdev_open+0x247/0x6b0 fs/char_dev.c:417
do_dentry_open+0x488/0x1160 fs/open.c:771
vfs_open+0xa0/0xd0 fs/open.c:880
do_last fs/namei.c:3416 [inline]
path_openat+0x10e9/0x46e0 fs/namei.c:3533
do_filp_open+0x1a1/0x280 fs/namei.c:3563
do_sys_open+0x3fe/0x5d0 fs/open.c:1063
__do_sys_openat fs/open.c:1090 [inline]
__se_sys_openat fs/open.c:1084 [inline]
__x64_sys_openat+0x9d/0x100 fs/open.c:1084
do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
The buggy address belongs to the object at ffff888090fc2580
which belongs to the cache kmalloc-512 of size 512
The buggy address is located 280 bytes inside of
512-byte region [ffff888090fc2580, ffff888090fc2780)
Reported-by: syzbot+17335689e239ce135d8b@syzkaller.appspotmail.com
Signed-off-by: Bart Van Assche <bvanassche@acm.org>
Signed-off-by: Peter Zijlstra (Intel) <peterz@infradead.org>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Andy Lutomirski <luto@kernel.org>
Cc: Borislav Petkov <bp@alien8.de>
Cc: Dave Hansen <dave.hansen@linux.intel.com>
Cc: H. Peter Anvin <hpa@zytor.com>
Cc: Linus Torvalds <torvalds@linux-foundation.org>
Cc: Paul E. McKenney <paulmck@linux.vnet.ibm.com>
Cc: Peter Zijlstra <peterz@infradead.org>
Cc: Rik van Riel <riel@surriel.com>
Cc: Thomas Gleixner <tglx@linutronix.de>
Cc: Will Deacon <will.deacon@arm.com>
Fixes: 669de8bda8 ("kernel/workqueue: Use dynamic lockdep keys for workqueues")
Link: https://lkml.kernel.org/r/20190303220046.29448-1-bvanassche@acm.org
Signed-off-by: Ingo Molnar <mingo@kernel.org>
|
2019-03-09 14:15:52 +01:00 |
| .. |
|
bpf
|
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
|
2019-03-06 07:59:36 -08:00 |
|
cgroup
|
Merge git://git.kernel.org/pub/scm/linux/kernel/git/davem/net-next
|
2019-03-05 08:26:13 -08:00 |
|
configs
|
kvm_config: add CONFIG_VIRTIO_MENU
|
2018-10-24 20:55:56 -04:00 |
|
debug
|
kdb: use bool for binary state indicators
|
2018-12-30 08:31:52 +00:00 |
|
dma
|
swiotlb: clear io_tlb_start and io_tlb_end in swiotlb_exit
|
2019-01-16 09:59:17 -05:00 |
|
events
|
perf/core improvements and fixes:
|
2019-02-28 08:29:50 +01:00 |
|
gcov
|
|
|
|
irq
|
irqchip updates for Linux 5.1
|
2019-02-23 10:53:31 +01:00 |
|
livepatch
|
livepatch: Replace synchronize_sched() with synchronize_rcu()
|
2018-12-01 12:38:50 -08:00 |
|
locking
|
locking/lockdep: Only call init_rcu_head() after RCU has been initialized
|
2019-03-09 14:15:51 +01:00 |
|
power
|
mm: convert totalram_pages and totalhigh_pages variables to atomic
|
2018-12-28 12:11:47 -08:00 |
|
printk
|
Remove 'type' argument from access_ok() function
|
2019-01-03 18:57:57 -08:00 |
|
rcu
|
Merge branch 'perf-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
|
2019-03-06 07:59:36 -08:00 |
|
sched
|
Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
|
2019-03-06 08:14:05 -08:00 |
|
time
|
Merge branch 'core-rcu-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
|
2019-03-05 14:49:11 -08:00 |
|
trace
|
Merge branch 'linus' into perf/core, to pick up fixes
|
2019-02-28 08:27:17 +01:00 |
|
.gitignore
|
|
|
|
acct.c
|
|
|
|
async.c
|
|
|
|
audit.c
|
audit: remove duplicated include from audit.c
|
2018-12-14 12:09:30 -05:00 |
|
audit.h
|
audit: use current whenever possible
|
2018-11-26 18:41:21 -05:00 |
|
audit_fsnotify.c
|
audit: minimize our use of audit_log_format()
|
2018-11-26 18:40:00 -05:00 |
|
audit_tree.c
|
audit: minimize our use of audit_log_format()
|
2018-11-26 18:40:00 -05:00 |
|
audit_watch.c
|
audit: minimize our use of audit_log_format()
|
2018-11-26 18:40:00 -05:00 |
|
auditfilter.c
|
|
|
|
auditsc.c
|
audit: use current whenever possible
|
2018-11-26 18:41:21 -05:00 |
|
backtracetest.c
|
|
|
|
bounds.c
|
kbuild: fix kernel/bounds.c 'W=1' warning
|
2018-10-31 08:54:14 -07:00 |
|
capability.c
|
|
|
|
compat.c
|
time: make adjtime compat handling available for 32 bit
|
2019-02-07 00:13:27 +01:00 |
|
configs.c
|
|
|
|
context_tracking.c
|
|
|
|
cpu.c
|
Linux 5.0-rc5
|
2019-02-04 08:57:24 +01:00 |
|
cpu_pm.c
|
|
|
|
crash_core.c
|
kernel/crash_core.c: print timestamp using time64_t
|
2018-08-22 10:52:47 -07:00 |
|
crash_dump.c
|
|
|
|
cred.c
|
cred: export get_task_cred().
|
2018-12-19 13:52:44 -05:00 |
|
delayacct.c
|
delayacct: track delays from thrashing cache pages
|
2018-10-26 16:26:32 -07:00 |
|
dma.c
|
|
|
|
elfcore.c
|
|
|
|
exec_domain.c
|
|
|
|
exit.c
|
kernel/exit.c: release ptraced tasks before zap_pid_ns_processes
|
2019-02-01 15:46:23 -08:00 |
|
extable.c
|
|
|
|
fail_function.c
|
kernel/fail_function.c: remove meaningless null pointer check before debugfs_remove_recursive
|
2018-10-31 08:54:12 -07:00 |
|
fork.c
|
sched/core: Convert task_struct.stack_refcount to refcount_t
|
2019-02-04 08:53:56 +01:00 |
|
freezer.c
|
PM / reboot: Eliminate race between reboot and suspend
|
2018-08-06 12:35:20 +02:00 |
|
futex.c
|
Merge branch 'locking-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
|
2019-03-06 07:17:17 -08:00 |
|
groups.c
|
|
|
|
hung_task.c
|
kernel/hung_task.c: break RCU locks based on jiffies
|
2019-01-04 13:13:45 -08:00 |
|
iomem.c
|
|
|
|
irq_work.c
|
|
|
|
jump_label.c
|
jump_label: move 'asm goto' support test to Kconfig
|
2019-01-06 09:46:51 +09:00 |
|
kallsyms.c
|
bpf: Add module name [bpf] to ksymbols for bpf programs
|
2019-01-21 17:38:56 -03:00 |
|
kcmp.c
|
|
|
|
Kconfig.freezer
|
|
|
|
Kconfig.hz
|
|
|
|
Kconfig.locks
|
bpf: introduce bpf_spin_lock
|
2019-02-01 20:55:38 +01:00 |
|
Kconfig.preempt
|
kconfig: warn no new line at end of file
|
2018-12-15 17:44:35 +09:00 |
|
kcov.c
|
kernel/kcov.c: mark write_comp_data() as notrace
|
2019-01-04 13:13:47 -08:00 |
|
kexec.c
|
kexec: add call to LSM hook in original kexec_load syscall
|
2018-07-16 12:31:57 -07:00 |
|
kexec_core.c
|
mm: convert totalram_pages and totalhigh_pages variables to atomic
|
2018-12-28 12:11:47 -08:00 |
|
kexec_file.c
|
kexec_file: kexec_walk_memblock() only walks a dedicated region at kdump
|
2018-12-06 14:38:50 +00:00 |
|
kexec_internal.h
|
|
|
|
kmod.c
|
|
|
|
kprobes.c
|
kprobes: Search non-suffixed symbol in blacklist
|
2019-02-13 08:16:40 +01:00 |
|
ksysfs.c
|
|
|
|
kthread.c
|
Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
|
2019-03-06 08:14:05 -08:00 |
|
latencytop.c
|
|
|
|
Makefile
|
kbuild: change filechk to surround the given command with { }
|
2019-01-06 09:46:51 +09:00 |
|
memremap.c
|
mm/hmm: fix memremap.h, move dev_page_fault_t callback to hmm
|
2018-12-28 12:11:52 -08:00 |
|
module-internal.h
|
|
|
|
module.c
|
jump_label: move 'asm goto' support test to Kconfig
|
2019-01-06 09:46:51 +09:00 |
|
module_signing.c
|
modsign: use all trusted keys to verify module signature
|
2018-11-07 14:41:41 +01:00 |
|
notifier.c
|
|
|
|
nsproxy.c
|
|
|
|
padata.c
|
padata: clean an indentation issue, remove extraneous space
|
2018-11-16 14:11:04 +08:00 |
|
panic.c
|
kernel/sysctl: add panic_print into sysctl
|
2019-01-04 13:13:47 -08:00 |
|
params.c
|
|
|
|
pid.c
|
Fix failure path in alloc_pid()
|
2018-12-28 12:42:30 -08:00 |
|
pid_namespace.c
|
signal: Use group_send_sig_info to kill all processes in a pid namespace
|
2018-09-16 16:08:25 +02:00 |
|
profile.c
|
mm: remove include/linux/bootmem.h
|
2018-10-31 08:54:16 -07:00 |
|
ptrace.c
|
Remove 'type' argument from access_ok() function
|
2019-01-03 18:57:57 -08:00 |
|
range.c
|
|
|
|
reboot.c
|
kernel/reboot.c: export pm_power_off_prepare
|
2018-09-11 16:13:24 +01:00 |
|
relay.c
|
relay: check return of create_buf_file() properly
|
2019-01-31 14:01:48 +01:00 |
|
resource.c
|
kernel, resource: check for IORESOURCE_SYSRAM in release_mem_region_adjustable
|
2018-12-28 12:11:49 -08:00 |
|
rseq.c
|
Remove 'type' argument from access_ok() function
|
2019-01-03 18:57:57 -08:00 |
|
seccomp.c
|
seccomp, bpf: disable preemption before calling into bpf prog
|
2019-02-22 00:14:19 +01:00 |
|
signal.c
|
Merge branch 'timers-2038-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
|
2019-03-05 14:08:26 -08:00 |
|
smp.c
|
cpu/hotplug: Fix "SMT disabled by BIOS" detection for KVM
|
2019-01-30 19:27:00 +01:00 |
|
smpboot.c
|
|
|
|
smpboot.h
|
|
|
|
softirq.c
|
softirq: Don't skip softirq execution when softirq thread is parking
|
2019-02-10 21:51:39 +01:00 |
|
stackleak.c
|
stackleak: Mark stackleak_track_stack() as notrace
|
2018-12-05 19:31:44 -08:00 |
|
stacktrace.c
|
|
|
|
stop_machine.c
|
Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
|
2018-08-13 11:25:07 -07:00 |
|
sys.c
|
kernel/sys.c: Clarify that UNAME26 does not generate unique versions anymore
|
2019-01-14 10:38:03 +12:00 |
|
sys_ni.c
|
y2038: syscalls: rename y2038 compat syscalls
|
2019-02-07 00:13:27 +01:00 |
|
sysctl.c
|
Merge branch 'sched-core-for-linus' of git://git.kernel.org/pub/scm/linux/kernel/git/tip/tip
|
2019-03-06 08:14:05 -08:00 |
|
sysctl_binary.c
|
kernel/sysctl: add panic_print into sysctl
|
2019-01-04 13:13:47 -08:00 |
|
task_work.c
|
|
|
|
taskstats.c
|
|
|
|
test_kprobes.c
|
|
|
|
torture.c
|
Merge branches 'doc.2019.01.26a', 'fixes.2019.01.26a', 'sil.2019.01.26a', 'spdx.2019.02.09a', 'srcu.2019.01.26a' and 'torture.2019.01.26a' into HEAD
|
2019-02-09 08:47:52 -08:00 |
|
tracepoint.c
|
tracing: Replace synchronize_sched() and call_rcu_sched()
|
2018-11-27 09:21:41 -08:00 |
|
tsacct.c
|
|
|
|
ucount.c
|
|
|
|
uid16.c
|
|
|
|
uid16.h
|
|
|
|
umh.c
|
umh: add exit routine for UMH process
|
2019-01-11 18:05:40 -08:00 |
|
up.c
|
smp,cpumask: introduce on_each_cpu_cond_mask
|
2018-10-09 16:51:11 +02:00 |
|
user-return-notifier.c
|
|
|
|
user.c
|
userns: use irqsave variant of refcount_dec_and_lock()
|
2018-08-22 10:52:47 -07:00 |
|
user_namespace.c
|
userns: also map extents in the reverse map to kernel IDs
|
2018-11-07 23:51:16 -06:00 |
|
utsname.c
|
|
|
|
utsname_sysctl.c
|
sys: don't hold uts_sem while accessing userspace memory
|
2018-08-11 02:05:53 -05:00 |
|
watchdog.c
|
watchdog: Mark watchdog touch functions as notrace
|
2018-08-30 12:56:40 +02:00 |
|
watchdog_hld.c
|
watchdog: Mark watchdog touch functions as notrace
|
2018-08-30 12:56:40 +02:00 |
|
workqueue.c
|
workqueue, lockdep: Fix an alloc_workqueue() error path
|
2019-03-09 14:15:52 +01:00 |
|
workqueue_internal.h
|
psi: fix aggregation idle shut-off
|
2019-02-01 15:46:23 -08:00 |