general protection fault in ebitmap_destroy (2)

14 views
Skip to first unread message

syzbot

unread,
Mar 14, 2019, 4:52:07 PM3/14/19
to adob...@gmail.com, ak...@linux-foundation.org, dave....@intel.com, epa...@parisplace.org, kent.ov...@gmail.com, linux-...@vger.kernel.org, marcelo...@gmail.com, nho...@tuxdriver.com, pa...@paul-moore.com, peter.e...@sony.com, psh...@ovn.org, s...@tycho.nsa.gov, sel...@vger.kernel.org, sh...@kernel.org, syzkall...@googlegroups.com, torv...@linux-foundation.org, vi...@zeniv.linux.org.uk, vyas...@gmail.com, wi...@infradead.org
Hello,

syzbot found the following crash on:

HEAD commit: ebc551f2 Merge tag 'nfsd-5.1' of git://linux-nfs.org/~bfie..
git tree: upstream
console output: https://syzkaller.appspot.com/x/log.txt?x=105c28d7200000
kernel config: https://syzkaller.appspot.com/x/.config?x=f05902bca21d8935
dashboard link: https://syzkaller.appspot.com/bug?extid=a57b2aff60832666fc28
compiler: gcc (GCC) 9.0.0 20181231 (experimental)
userspace arch: amd64
syz repro: https://syzkaller.appspot.com/x/repro.syz?x=1510bd5f200000
C reproducer: https://syzkaller.appspot.com/x/repro.c?x=1405dd6f200000

The crash was bisected to:

commit acdf52d97f824019888422842757013b37441dd1
Author: Kent Overstreet <kent.ov...@gmail.com>
Date: Tue Mar 12 06:31:10 2019 +0000

selinux: convert to kvmalloc

bisection log: https://syzkaller.appspot.com/x/bisect.txt?x=12b2b093200000
final crash: https://syzkaller.appspot.com/x/report.txt?x=11b2b093200000
console output: https://syzkaller.appspot.com/x/log.txt?x=16b2b093200000

IMPORTANT: if you fix the bug, please add the following tag to the commit:
Reported-by: syzbot+a57b2a...@syzkaller.appspotmail.com
Fixes: acdf52d9 ("selinux: convert to kvmalloc")

kasan: CONFIG_KASAN_INLINE enabled
kasan: GPF could be caused by NULL-ptr deref or user memory access
general protection fault: 0000 [#1] PREEMPT SMP KASAN
CPU: 1 PID: 8151 Comm: syz-executor646 Not tainted 5.0.0+ #20
Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS
Google 01/01/2011
RIP: 0010:ebitmap_destroy+0x32/0xf0 security/selinux/ss/ebitmap.c:334
Code: 49 89 fd 41 54 53 e8 6d f6 7f fe 4d 85 ed 0f 84 99 00 00 00 e8 5f f6
7f fe 4c 89 ea 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80> 3c 02 00 0f
85 98 00 00 00 49 be 00 00 00 00 00 fc ff df 4d 8b
RSP: 0018:ffff8880918478c8 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: ffff8880a15c93e8 RCX: ffffffff82f1b92c
RDX: 0000000000000002 RSI: ffffffff82f06dd1 RDI: 0000000000000010
RBP: ffff8880918478e8 R08: ffff88807c05c080 R09: ffff88807c05c948
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000002
R13: 0000000000000010 R14: ffffed10142b92b2 R15: 0000000000000401
FS: 0000000000f65880(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000140 CR3: 000000007e591000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400
Call Trace:
policydb_destroy+0x62c/0x7f0 security/selinux/ss/policydb.c:832
policydb_read+0xe27/0x52c0 security/selinux/ss/policydb.c:2522
security_load_policy+0x36d/0x1170 security/selinux/ss/services.c:2147
sel_write_load+0x25a/0x470 security/selinux/selinuxfs.c:565
__vfs_write+0x8d/0x110 fs/read_write.c:485
vfs_write+0x20c/0x580 fs/read_write.c:549
ksys_write+0xea/0x1f0 fs/read_write.c:598
__do_sys_write fs/read_write.c:610 [inline]
__se_sys_write fs/read_write.c:607 [inline]
__x64_sys_write+0x73/0xb0 fs/read_write.c:607
do_syscall_64+0x103/0x610 arch/x86/entry/common.c:290
entry_SYSCALL_64_after_hwframe+0x49/0xbe
RIP: 0033:0x4401f9
Code: 18 89 d0 c3 66 2e 0f 1f 84 00 00 00 00 00 0f 1f 00 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 fb 13 fc ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007fff747a42f8 EFLAGS: 00000246 ORIG_RAX: 0000000000000001
RAX: ffffffffffffffda RBX: 00000000004002c8 RCX: 00000000004401f9
RDX: 0000000000000050 RSI: 0000000020000180 RDI: 0000000000000003
RBP: 00000000006ca018 R08: 0000000000000000 R09: 00000000004002c8
R10: 0000000000000000 R11: 0000000000000246 R12: 0000000000401a80
R13: 0000000000401b10 R14: 0000000000000000 R15: 0000000000000000
Modules linked in:
---[ end trace c9a4ce516f33c859 ]---
RIP: 0010:ebitmap_destroy+0x32/0xf0 security/selinux/ss/ebitmap.c:334
Code: 49 89 fd 41 54 53 e8 6d f6 7f fe 4d 85 ed 0f 84 99 00 00 00 e8 5f f6
7f fe 4c 89 ea 48 b8 00 00 00 00 00 fc ff df 48 c1 ea 03 <80> 3c 02 00 0f
85 98 00 00 00 49 be 00 00 00 00 00 fc ff df 4d 8b
RSP: 0018:ffff8880918478c8 EFLAGS: 00010202
RAX: dffffc0000000000 RBX: ffff8880a15c93e8 RCX: ffffffff82f1b92c
RDX: 0000000000000002 RSI: ffffffff82f06dd1 RDI: 0000000000000010
RBP: ffff8880918478e8 R08: ffff88807c05c080 R09: ffff88807c05c948
R10: 0000000000000000 R11: 0000000000000000 R12: 0000000000000002
R13: 0000000000000010 R14: ffffed10142b92b2 R15: 0000000000000401
FS: 0000000000f65880(0000) GS:ffff8880ae900000(0000) knlGS:0000000000000000
CS: 0010 DS: 0000 ES: 0000 CR0: 0000000080050033
CR2: 0000000020000140 CR3: 000000007e591000 CR4: 00000000001406e0
DR0: 0000000000000000 DR1: 0000000000000000 DR2: 0000000000000000
DR3: 0000000000000000 DR6: 00000000fffe0ff0 DR7: 0000000000000400


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

Kent Overstreet

unread,
Mar 21, 2019, 12:59:48 PM3/21/19
to syzbot, syzkall...@googlegroups.com

syzbot

unread,
Mar 21, 2019, 12:59:49 PM3/21/19
to Kent Overstreet, kent.ov...@gmail.com, syzkall...@googlegroups.com
unknown command "test"

syzbot

unread,
Mar 21, 2019, 12:59:49 PM3/21/19
to Kent Overstreet, kent.ov...@gmail.com, syzkall...@googlegroups.com
unknown command "test"
> --
> You received this message because you are subscribed to the Google
> Groups "syzkaller-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to syzkaller-bug...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/syzkaller-bugs/20190321165944.GB11352%40kmo-pixel.
> For more options, visit https://groups.google.com/d/optout.

Dmitry Vyukov

unread,
Mar 21, 2019, 1:22:46 PM3/21/19
to syzbot, Kent Overstreet, syzkaller-bugs
Hi Kent,

I will look into relaxing parsing somewhat tomorrow, but meanwhile
it's "test:" with a colon at the end.
> --
> You received this message because you are subscribed to the Google Groups "syzkaller-bugs" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to syzkaller-bug...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/0000000000007a45d105849daa00%40google.com.

Kent Overstreet

unread,
Mar 21, 2019, 2:58:39 PM3/21/19
to syzbot, adob...@gmail.com, ak...@linux-foundation.org, dave....@intel.com, epa...@parisplace.org, linux-...@vger.kernel.org, marcelo...@gmail.com, nho...@tuxdriver.com, pa...@paul-moore.com, peter.e...@sony.com, psh...@ovn.org, s...@tycho.nsa.gov, sel...@vger.kernel.org, sh...@kernel.org, syzkall...@googlegroups.com, torv...@linux-foundation.org, vi...@zeniv.linux.org.uk, vyas...@gmail.com, wi...@infradead.org

Paul Moore

unread,
Mar 21, 2019, 3:01:57 PM3/21/19
to Kent Overstreet, syzbot, adob...@gmail.com, ak...@linux-foundation.org, dave....@intel.com, Eric Paris, linux-...@vger.kernel.org, marcelo...@gmail.com, nho...@tuxdriver.com, peter.e...@sony.com, psh...@ovn.org, Stephen Smalley, sel...@vger.kernel.org, sh...@kernel.org, syzkall...@googlegroups.com, Linus Torvalds, vi...@zeniv.linux.org.uk, Vlad Yasevich, wi...@infradead.org
On Thu, Mar 21, 2019 at 2:58 PM Kent Overstreet
<kent.ov...@gmail.com> wrote:
>
> #syz test: http://evilpiepirate.org/git/bcachefs.git syzbot-fix

FYI, I just sent a PR to Linus this morning with a patch to fix this problem.

https://lore.kernel.org/selinux/CAHC9VhRoo4_A0fg+Gp-Qsn_X...@mail.gmail.com

--
paul moore
www.paul-moore.com

syzbot

unread,
Mar 21, 2019, 6:20:01 PM3/21/19
to adob...@gmail.com, ak...@linux-foundation.org, dave....@intel.com, epa...@parisplace.org, kent.ov...@gmail.com, linux-...@vger.kernel.org, marcelo...@gmail.com, nho...@tuxdriver.com, pa...@paul-moore.com, peter.e...@sony.com, psh...@ovn.org, s...@tycho.nsa.gov, sel...@vger.kernel.org, sh...@kernel.org, syzkall...@googlegroups.com, torv...@linux-foundation.org, vi...@zeniv.linux.org.uk, vyas...@gmail.com, wi...@infradead.org
Hello,

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

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

Tested on:

commit: 9a03b23d selinux: fix calling ebitmap_destroy() on null ptr
git tree: http://evilpiepirate.org/git/bcachefs.git syzbot-fix
kernel config: https://syzkaller.appspot.com/x/.config?x=2f8e9856965eaf03
compiler: gcc (GCC) 9.0.0 20190115 (experimental)

Note: testing is done by a robot and is best-effort only.

Dmitry Vyukov

unread,
Mar 23, 2019, 4:59:11 AM3/23/19
to syzbot, Kent Overstreet, syzkaller-bugs
On Thu, Mar 21, 2019 at 6:22 PM Dmitry Vyukov <dvy...@google.com> wrote:
>
> Hi Kent,
>
> I will look into relaxing parsing somewhat tomorrow, but meanwhile
> it's "test:" with a colon at the end.

syzbot will now accept "test" without colon as well:
https://github.com/google/syzkaller/commit/9ad9ef29caa52714dd5faff167e4b61643e40a7e
Reply all
Reply to author
Forward
0 new messages