possible deadlock in prepare_bprm_creds

18 views
Skip to first unread message

syzbot

unread,
Sep 3, 2019, 1:43:07 PM9/3/19
to syzkaller-a...@googlegroups.com
Hello,

syzbot found the following crash on:

HEAD commit: 62872f95 Merge 4.4.174 into android-4.4
git tree: android-4.4
console output: https://syzkaller.appspot.com/x/log.txt?x=1432819e600000
kernel config: https://syzkaller.appspot.com/x/.config?x=47bc4dd423780c4a
dashboard link: https://syzkaller.appspot.com/bug?extid=5f8059e8e2756fa82891
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+5f8059...@syzkaller.appspotmail.com

binder: 13792:13795 ioctl 40046207 0 returned -16
======================================================
[ INFO: possible circular locking dependency detected ]
4.4.174+ #4 Not tainted
-------------------------------------------------------
syz-executor.2/13800 is trying to acquire lock:
(&pipe->mutex/1){+.+.+.}, at: [ 559.402625] binder:
BINDER_SET_CONTEXT_MGR already set
binder: 13812:13814 ioctl 40046207 0 returned -16
binder_alloc: 13792: binder_alloc_buf, no vma
binder: 13812:13814 transaction failed 29189/-3, size 96-24 line 3137
binder: BINDER_SET_CONTEXT_MGR already set
binder: 13812:13814 ioctl 40046207 0 returned -16
binder_alloc: 13792: binder_alloc_buf, no vma
binder: 13812:13816 transaction failed 29189/-3, size 96-24 line 3137
binder: BINDER_SET_CONTEXT_MGR already set
binder: 13818:13821 ioctl 40046207 0 returned -16
binder_alloc: 13792: binder_alloc_buf, no vma
binder: 13818:13821 transaction failed 29189/-3, size 96-24 line 3137
binder: BINDER_SET_CONTEXT_MGR already set
binder: 13818:13822 ioctl 40046207 0 returned -16
[<ffffffff814b28fd>] __pipe_lock fs/pipe.c:86 [inline]
[<ffffffff814b28fd>] fifo_open+0x15d/0xa00 fs/pipe.c:896
binder: BINDER_SET_CONTEXT_MGR already set
binder: 13825:13826 ioctl 40046207 0 returned -16
binder_alloc: 13792: binder_alloc_buf, no vma
binder: 13825:13826 transaction failed 29189/-3, size 96-24 line 3137
binder: BINDER_SET_CONTEXT_MGR already set
binder: 13825:13826 ioctl 40046207 0 returned -16
binder_alloc: 13792: binder_alloc_buf, no vma
binder: 13825:13828 transaction failed 29189/-3, size 96-24 line 3137

but task is already holding lock:
([ 559.551337] binder: BINDER_SET_CONTEXT_MGR already set
binder: 13831:13833 ioctl 40046207 0 returned -16
binder_alloc: 13792: binder_alloc_buf, no vma
binder: 13831:13833 transaction failed 29189/-3, size 96-24 line 3137
binder: BINDER_SET_CONTEXT_MGR already set
binder: 13831:13833 ioctl 40046207 0 returned -16
binder_alloc: 13792: binder_alloc_buf, no vma
binder: 13831:13835 transaction failed 29189/-3, size 96-24 line 3137
&sig->cred_guard_mutex){+.+.+.}, at: [<ffffffff814acb45>]
prepare_bprm_creds+0x55/0x120 fs/exec.c:1225

which lock already depends on the new lock.


the existing dependency chain (in reverse order) is:

binder: BINDER_SET_CONTEXT_MGR already set
binder: 13839:13842 ioctl 40046207 0 returned -16
binder_alloc: 13792: binder_alloc_buf, no vma
binder: 13839:13842 transaction failed 29189/-3, size 96-24 line 3137
binder: BINDER_SET_CONTEXT_MGR already set
binder: 13839:13842 ioctl 40046207 0 returned -16
binder_alloc: 13792: binder_alloc_buf, no vma
binder: 13839:13845 transaction failed 29189/-3, size 96-24 line 3137
[<ffffffff81205f6e>] lock_acquire+0x15e/0x450
kernel/locking/lockdep.c:3592
[<ffffffff8270e5a2>] __mutex_lock_common kernel/locking/mutex.c:521
[inline]
[<ffffffff8270e5a2>] mutex_lock_interruptible_nested+0xd2/0xce0
kernel/locking/mutex.c:650
binder: undelivered TRANSACTION_ERROR: 29189
binder: undelivered TRANSACTION_ERROR: 29189
binder: undelivered TRANSACTION_ERROR: 29189
binder: undelivered TRANSACTION_ERROR: 29189
binder: undelivered TRANSACTION_ERROR: 29189
binder: undelivered TRANSACTION_ERROR: 29189
binder: undelivered TRANSACTION_ERROR: 29189
binder: undelivered TRANSACTION_ERROR: 29189
binder: undelivered TRANSACTION_ERROR: 29189
[<ffffffff815e7f78>] proc_pid_attr_write+0x1a8/0x2a0
fs/proc/base.c:2524
[<ffffffff81496916>] __vfs_write+0x116/0x3d0 fs/read_write.c:491
[<ffffffff81496ce2>] __kernel_write+0x112/0x370 fs/read_write.c:513
[<ffffffff81532e6d>] write_pipe_buf+0x15d/0x1f0 fs/splice.c:1074
[<ffffffff81533b6e>] splice_from_pipe_feed fs/splice.c:776 [inline]
[<ffffffff81533b6e>] __splice_from_pipe+0x37e/0x7a0 fs/splice.c:901
[<ffffffff81536be8>] splice_from_pipe+0x108/0x170 fs/splice.c:936
[<ffffffff81536cdc>] default_file_splice_write+0x3c/0x80
fs/splice.c:1086
[<ffffffff81537d31>] do_splice_from fs/splice.c:1128 [inline]
[<ffffffff81537d31>] do_splice fs/splice.c:1404 [inline]
[<ffffffff81537d31>] SYSC_splice fs/splice.c:1707 [inline]
[<ffffffff81537d31>] SyS_splice+0xd71/0x13a0 fs/splice.c:1690
[<ffffffff82718ba1>] entry_SYSCALL_64_fastpath+0x1e/0x9a

[<ffffffff81202d86>] check_prev_add kernel/locking/lockdep.c:1853
[inline]
[<ffffffff81202d86>] check_prevs_add kernel/locking/lockdep.c:1958
[inline]
[<ffffffff81202d86>] validate_chain kernel/locking/lockdep.c:2144
[inline]
[<ffffffff81202d86>] __lock_acquire+0x37d6/0x4f50
kernel/locking/lockdep.c:3213
[<ffffffff81205f6e>] lock_acquire+0x15e/0x450
kernel/locking/lockdep.c:3592
[<ffffffff8270c191>] __mutex_lock_common kernel/locking/mutex.c:521
[inline]
[<ffffffff8270c191>] mutex_lock_nested+0xc1/0xb80
kernel/locking/mutex.c:621
[<ffffffff814b28fd>] __pipe_lock fs/pipe.c:86 [inline]
[<ffffffff814b28fd>] fifo_open+0x15d/0xa00 fs/pipe.c:896
[<ffffffff8149154f>] do_dentry_open+0x38f/0xbd0 fs/open.c:749
[<ffffffff81494d3b>] vfs_open+0x10b/0x210 fs/open.c:862
[<ffffffff814c5ddf>] do_last fs/namei.c:3269 [inline]
[<ffffffff814c5ddf>] path_openat+0x136f/0x4470 fs/namei.c:3406
[<ffffffff814ccab1>] do_filp_open+0x1a1/0x270 fs/namei.c:3440
[<ffffffff814a7c8c>] do_open_execat+0x10c/0x6e0 fs/exec.c:805
[<ffffffff814ad306>] do_execveat_common.isra.0+0x6f6/0x1e90
fs/exec.c:1577
[<ffffffff814af422>] do_execve fs/exec.c:1683 [inline]
[<ffffffff814af422>] SYSC_execve fs/exec.c:1764 [inline]
[<ffffffff814af422>] SyS_execve+0x42/0x50 fs/exec.c:1759
[<ffffffff82718ef5>] return_from_execve+0x0/0x23

other info that might help us debug this:

Possible unsafe locking scenario:

CPU0 CPU1
---- ----
lock(&sig->cred_guard_mutex);
lock(&pipe->mutex/1);
lock(&sig->cred_guard_mutex);
lock(&pipe->mutex/1);

*** DEADLOCK ***

1 lock held by syz-executor.2/13800:
#0: (&sig->cred_guard_mutex){+.+.+.}, at: [<ffffffff814acb45>]
prepare_bprm_creds+0x55/0x120 fs/exec.c:1225

stack backtrace:
CPU: 0 PID: 13800 Comm: syz-executor.2 Not tainted 4.4.174+ #4
0000000000000000 d6d44ae3a289568f ffff8801c0acf530 ffffffff81aad1a1
ffffffff84057a80 ffff8801d4e297c0 ffffffff83abd2b0 ffffffff83ab6860
ffffffff83abd2b0 ffff8801c0acf580 ffffffff813abcda ffff8801c0acf660
Call Trace:
[<ffffffff81aad1a1>] __dump_stack lib/dump_stack.c:15 [inline]
[<ffffffff81aad1a1>] dump_stack+0xc1/0x120 lib/dump_stack.c:51
[<ffffffff813abcda>] print_circular_bug.cold+0x2f7/0x44e
kernel/locking/lockdep.c:1226
[<ffffffff81202d86>] check_prev_add kernel/locking/lockdep.c:1853 [inline]
[<ffffffff81202d86>] check_prevs_add kernel/locking/lockdep.c:1958 [inline]
[<ffffffff81202d86>] validate_chain kernel/locking/lockdep.c:2144 [inline]
[<ffffffff81202d86>] __lock_acquire+0x37d6/0x4f50
kernel/locking/lockdep.c:3213
[<ffffffff81205f6e>] lock_acquire+0x15e/0x450 kernel/locking/lockdep.c:3592
[<ffffffff8270c191>] __mutex_lock_common kernel/locking/mutex.c:521
[inline]
[<ffffffff8270c191>] mutex_lock_nested+0xc1/0xb80
kernel/locking/mutex.c:621
[<ffffffff814b28fd>] __pipe_lock fs/pipe.c:86 [inline]
[<ffffffff814b28fd>] fifo_open+0x15d/0xa00 fs/pipe.c:896
[<ffffffff8149154f>] do_dentry_open+0x38f/0xbd0 fs/open.c:749
[<ffffffff81494d3b>] vfs_open+0x10b/0x210 fs/open.c:862
[<ffffffff814c5ddf>] do_last fs/namei.c:3269 [inline]
[<ffffffff814c5ddf>] path_openat+0x136f/0x4470 fs/namei.c:3406
[<ffffffff814ccab1>] do_filp_open+0x1a1/0x270 fs/namei.c:3440
[<ffffffff814a7c8c>] do_open_execat+0x10c/0x6e0 fs/exec.c:805
[<ffffffff814ad306>] do_execveat_common.isra.0+0x6f6/0x1e90 fs/exec.c:1577
[<ffffffff814af422>] do_execve fs/exec.c:1683 [inline]
[<ffffffff814af422>] SYSC_execve fs/exec.c:1764 [inline]
[<ffffffff814af422>] SyS_execve+0x42/0x50 fs/exec.c:1759
[<ffffffff82718ef5>] stub_execve+0x5/0x5 arch/x86/entry/entry_64.S:440
binder_alloc: 13873: binder_alloc_buf, no vma
binder: 13873:13886 transaction failed 29189/-3, size 96-24 line 3137
binder: undelivered TRANSACTION_ERROR: 29189
binder: 13908:13912 unknown command 536871232
binder: 13908:13912 ioctl c0306201 20000040 returned -22
binder: 13908:13921 unknown command 536871232
binder: 13908:13921 ioctl c0306201 20000040 returned -22
binder: 13940:13942 got transaction with unaligned buffers size, 214
binder: 13940:13942 transaction failed 29201/-22, size 96-24 line 3181
binder: undelivered TRANSACTION_ERROR: 29201
binder: 13940:13942 got transaction with unaligned buffers size, 214
binder: 13940:13942 transaction failed 29201/-22, size 96-24 line 3181
binder: undelivered TRANSACTION_ERROR: 29201
binder_alloc: 13969: binder_alloc_buf size -413005597459674000 failed, no
address space
binder_alloc: allocated: 0 (num: 0 largest: 0), free: 8192 (num: 1 largest:
8192)
binder: 13969:13977 transaction failed 29201/-28, size 96-24 line 3137
binder: BINDER_SET_CONTEXT_MGR already set
binder: 13969:13977 ioctl 40046207 0 returned -16
binder: undelivered TRANSACTION_ERROR: 29201
binder: 13969:13984 transaction failed 29189/-22, size 96-24 line 3014
binder: undelivered TRANSACTION_ERROR: 29189
binder_alloc: 13996: binder_alloc_buf, no vma
binder: 13996:14003 transaction failed 29189/-3, size 96-24 line 3137
binder: undelivered TRANSACTION_ERROR: 29189
binder: 13996:14019 transaction failed 29189/-22, size 96-24 line 3014
binder: undelivered TRANSACTION_ERROR: 29189
binder: 14027:14029 got transaction with unaligned buffers size, 9
binder: 14027:14029 transaction failed 29201/-22, size 96-24 line 3181
binder: undelivered TRANSACTION_ERROR: 29201
binder: 14027:14034 got transaction with unaligned buffers size, 9
binder: 14027:14034 transaction failed 29201/-22, size 96-24 line 3181
binder: undelivered TRANSACTION_ERROR: 29201
binder_alloc: 14038: binder_alloc_buf size 3978709506094217136 failed, no
address space
binder_alloc: allocated: 0 (num: 0 largest: 0), free: 8192 (num: 1 largest:
8192)
binder: 14038:14042 transaction failed 29201/-28, size 96-24 line 3137
binder: undelivered TRANSACTION_ERROR: 29201
binder_alloc: 14038: binder_alloc_buf size 3978709506094217136 failed, no
address space
binder_alloc: allocated: 0 (num: 0 largest: 0), free: 8192 (num: 1 largest:
8192)
binder: 14038:14045 transaction failed 29201/-28, size 96-24 line 3137
binder: undelivered TRANSACTION_ERROR: 29201


---
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,
Jan 1, 2020, 11:43:05 AM1/1/20
to syzkaller-a...@googlegroups.com
Auto-closing this bug as obsolete.
Crashes did not happen for a while, no reproducer and no activity.
Reply all
Reply to author
Forward
0 new messages