[syzbot] general protection fault in binder_alloc_new_buf

13 views
Skip to first unread message

syzbot

unread,
Aug 21, 2022, 2:04:27 AM8/21/22
to ar...@android.com, bra...@kernel.org, cmll...@google.com, gre...@linuxfoundation.org, jo...@joelfernandes.org, linux-...@vger.kernel.org, ma...@android.com, sur...@google.com, syzkall...@googlegroups.com, tk...@android.com
Hello,

syzbot found the following issue on:

HEAD commit: 8755ae45a9e8 Add linux-next specific files for 20220819
git tree: linux-next
console output: https://syzkaller.appspot.com/x/log.txt?x=12a879e3080000
kernel config: https://syzkaller.appspot.com/x/.config?x=ead6107a3bbe3c62
dashboard link: https://syzkaller.appspot.com/bug?extid=f7dc54e5be28950ac459
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1114a92d080000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17693aa5080000

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

binder: 3755:3755 ioctl c0306201 20001480 returned -14
general protection fault, probably for non-canonical address 0xdffffc0000000025: 0000 [#1] PREEMPT SMP KASAN
KASAN: null-ptr-deref in range [0x0000000000000128-0x000000000000012f]
CPU: 0 PID: 3755 Comm: syz-executor229 Not tainted 6.0.0-rc1-next-20220819-syzkaller #0
syz-executor229[3755] cmdline: ./syz-executor2294415195
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 07/22/2022
RIP: 0010:__lock_acquire+0xd83/0x56d0 kernel/locking/lockdep.c:4923
Code: 9b 0e 41 bf 01 00 00 00 0f 86 c8 00 00 00 89 05 63 56 9b 0e e9 bd 00 00 00 48 b8 00 00 00 00 00 fc ff df 4c 89 f2 48 c1 ea 03 <80> 3c 02 00 0f 85 4e 31 00 00 49 81 3e 60 84 51 8f 0f 84 4c f3 ff
RSP: 0018:ffffc90003c1f268 EFLAGS: 00010002
RAX: dffffc0000000000 RBX: 1ffff92000783e7c RCX: 0000000000000001
RDX: 0000000000000025 RSI: 0000000000000000 RDI: 0000000000000001
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
R10: fffffbfff1bbd792 R11: 0000000000000000 R12: 0000000000000000
R13: ffff88807a289d80 R14: 0000000000000128 R15: 0000000000000001
FS: 0000555556fed300(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fa1152711f0 CR3: 0000000072080000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
<TASK>
lock_acquire kernel/locking/lockdep.c:5666 [inline]
lock_acquire+0x1ab/0x570 kernel/locking/lockdep.c:5631
down_read+0x98/0x450 kernel/locking/rwsem.c:1499
mmap_read_lock include/linux/mmap_lock.h:117 [inline]
binder_alloc_new_buf_locked drivers/android/binder_alloc.c:405 [inline]
binder_alloc_new_buf+0xa5/0x19e0 drivers/android/binder_alloc.c:593
binder_transaction+0x242e/0x9a80 drivers/android/binder.c:3199
binder_thread_write+0x664/0x3220 drivers/android/binder.c:3986
binder_ioctl_write_read drivers/android/binder.c:5036 [inline]
binder_ioctl+0x3470/0x6d00 drivers/android/binder.c:5323
vfs_ioctl fs/ioctl.c:51 [inline]
__do_sys_ioctl fs/ioctl.c:870 [inline]
__se_sys_ioctl fs/ioctl.c:856 [inline]
__x64_sys_ioctl+0x193/0x200 fs/ioctl.c:856
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
RIP: 0033:0x7fa1151fd439
Code: 28 00 00 00 75 05 48 83 c4 28 c3 e8 11 15 00 00 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 73 01 c3 48 c7 c1 c0 ff ff ff f7 d8 64 89 01 48
RSP: 002b:00007ffc9354bf38 EFLAGS: 00000246 ORIG_RAX: 0000000000000010
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 00007fa1151fd439
RDX: 0000000020000380 RSI: 00000000c0306201 RDI: 0000000000000003
RBP: 0000000000000000 R08: 000000001526ae40 R09: 000000001526ae40
R10: 000000001526ae40 R11: 0000000000000246 R12: 000000000000c3f0
R13: 00007ffc9354bf60 R14: 00007ffc9354bf50 R15: 00007ffc9354bf44
</TASK>
Modules linked in:
---[ end trace 0000000000000000 ]---
RIP: 0010:__lock_acquire+0xd83/0x56d0 kernel/locking/lockdep.c:4923
Code: 9b 0e 41 bf 01 00 00 00 0f 86 c8 00 00 00 89 05 63 56 9b 0e e9 bd 00 00 00 48 b8 00 00 00 00 00 fc ff df 4c 89 f2 48 c1 ea 03 <80> 3c 02 00 0f 85 4e 31 00 00 49 81 3e 60 84 51 8f 0f 84 4c f3 ff
RSP: 0018:ffffc90003c1f268 EFLAGS: 00010002
RAX: dffffc0000000000 RBX: 1ffff92000783e7c RCX: 0000000000000001
RDX: 0000000000000025 RSI: 0000000000000000 RDI: 0000000000000001
RBP: 0000000000000000 R08: 0000000000000001 R09: 0000000000000000
R10: fffffbfff1bbd792 R11: 0000000000000000 R12: 0000000000000000
R13: ffff88807a289d80 R14: 0000000000000128 R15: 0000000000000001
FS: 0000555556fed300(0000) GS:ffff8880b9a00000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 00007fa1152711f0 CR3: 0000000072080000 CR4: 00000000003506f0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
----------------
Code disassembly (best guess), 2 bytes skipped:
0: 41 bf 01 00 00 00 mov $0x1,%r15d
6: 0f 86 c8 00 00 00 jbe 0xd4
c: 89 05 63 56 9b 0e mov %eax,0xe9b5663(%rip) # 0xe9b5675
12: e9 bd 00 00 00 jmpq 0xd4
17: 48 b8 00 00 00 00 00 movabs $0xdffffc0000000000,%rax
1e: fc ff df
21: 4c 89 f2 mov %r14,%rdx
24: 48 c1 ea 03 shr $0x3,%rdx
* 28: 80 3c 02 00 cmpb $0x0,(%rdx,%rax,1) <-- trapping instruction
2c: 0f 85 4e 31 00 00 jne 0x3180
32: 49 81 3e 60 84 51 8f cmpq $0xffffffff8f518460,(%r14)
39: 0f .byte 0xf
3a: 84 4c f3 ff test %cl,-0x1(%rbx,%rsi,8)


---
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

Hillf Danton

unread,
Aug 21, 2022, 8:30:42 AM8/21/22
to syzbot, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Date: Sat, 20 Aug 2022 23:04:26 -0700
> Hello,
>
> syzbot found the following issue on:
>
> HEAD commit: 8755ae45a9e8 Add linux-next specific files for 20220819
> git tree: linux-next
> console output: https://syzkaller.appspot.com/x/log.txt?x=12a879e3080000
> kernel config: https://syzkaller.appspot.com/x/.config?x=ead6107a3bbe3c62
> dashboard link: https://syzkaller.appspot.com/bug?extid=f7dc54e5be28950ac459
> compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
> syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1114a92d080000
> C reproducer: https://syzkaller.appspot.com/x/repro.c?x=17693aa5080000

See if the binder_alloc is fully initialized.

#syz test https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git 8755ae45a9e8

--- a/drivers/android/binder_alloc.c 2022-08-21 19:41:10.572060800 +0800
+++ b/drivers/android/binder_alloc.c 2022-08-21 20:03:53.241022700 +0800
@@ -402,6 +402,8 @@ static struct binder_buffer *binder_allo
size_t size, data_offsets_size;
int ret;

+ if (!alloc->vma_addr)
+ return ERR_PTR(-ESRCH);
mmap_read_lock(alloc->vma_vm_mm);
if (!binder_alloc_get_vma(alloc)) {
mmap_read_unlock(alloc->vma_vm_mm);
@@ -933,6 +935,8 @@ void binder_alloc_print_pages(struct seq
* read inconsistent state.
*/

+ if (!alloc->vma_addr)
+ goto uninitialized;
mmap_read_lock(alloc->vma_vm_mm);
if (binder_alloc_get_vma(alloc) == NULL) {
mmap_read_unlock(alloc->vma_vm_mm);
--

syzbot

unread,
Aug 21, 2022, 5:40:10 PM8/21/22
to hda...@sina.com, linux-...@vger.kernel.org, syzkall...@googlegroups.com
Hello,

syzbot has tested the proposed patch and the reproducer did not trigger any issue:

Reported-and-tested-by: syzbot+f7dc54...@syzkaller.appspotmail.com

Tested on:

commit: 8755ae45 Add linux-next specific files for 20220819
git tree: https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
console output: https://syzkaller.appspot.com/x/log.txt?x=12153aa5080000
kernel config: https://syzkaller.appspot.com/x/.config?x=ead6107a3bbe3c62
dashboard link: https://syzkaller.appspot.com/bug?extid=f7dc54e5be28950ac459
compiler: gcc (Debian 10.2.1-6) 10.2.1 20210110, GNU ld (GNU Binutils for Debian) 2.35.2
patch: https://syzkaller.appspot.com/x/patch.diff?x=17da1a3d080000

Note: testing is done by a robot and is best-effort only.
Reply all
Reply to author
Forward
0 new messages