KMSAN: uninit-value in tomoyo_check_inet_address

12 views
Skip to first unread message

syzbot

unread,
May 16, 2019, 8:58:07 AM5/16/19
to gli...@google.com, jmo...@namei.org, linux-...@vger.kernel.org, linux-secu...@vger.kernel.org, penguin...@i-love.sakura.ne.jp, se...@hallyn.com, syzkall...@googlegroups.com, take...@nttdata.co.jp
Hello,

syzbot found the following crash on:

HEAD commit: 3b955a40 usb-fuzzer: main usb gadget fuzzer driver
git tree: kmsan
console output: https://syzkaller.appspot.com/x/log.txt?x=1027e608a00000
kernel config: https://syzkaller.appspot.com/x/.config?x=602468164ccdc30a
dashboard link: https://syzkaller.appspot.com/bug?extid=1018d578c410f9f37261
compiler: clang version 9.0.0 (/home/glider/llvm/clang
06d00afa61eef8f7f501ebdb4e8612ea43ec2d78)

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+1018d5...@syzkaller.appspotmail.com

==================================================================
BUG: KMSAN: uninit-value in tomoyo_check_inet_address+0x143/0xd10
security/tomoyo/network.c:508
CPU: 0 PID: 22966 Comm: syz-executor.2 Not tainted 5.1.0+ #3
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+0x191/0x1f0 lib/dump_stack.c:113
kmsan_report+0x130/0x2a0 mm/kmsan/kmsan.c:619
__msan_warning+0x75/0xe0 mm/kmsan/kmsan_instr.c:310
tomoyo_check_inet_address+0x143/0xd10 security/tomoyo/network.c:508
tomoyo_socket_bind_permission+0x343/0x3b0 security/tomoyo/network.c:741
tomoyo_socket_bind+0x8b/0xa0 security/tomoyo/tomoyo.c:471
security_socket_bind+0x127/0x200 security/security.c:1943
__sys_bind+0x536/0x7c0 net/socket.c:1623
__do_sys_bind net/socket.c:1638 [inline]
__se_sys_bind+0x8d/0xb0 net/socket.c:1636
__x64_sys_bind+0x4a/0x70 net/socket.c:1636
do_syscall_64+0xbc/0xf0 arch/x86/entry/common.c:291
entry_SYSCALL_64_after_hwframe+0x63/0xe7
RIP: 0033:0x458da9
Code: ad b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00 00 66 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 0f 83 7b b8 fb ff c3 66 2e 0f 1f 84 00 00 00 00
RSP: 002b:00007f4aeb5bbc78 EFLAGS: 00000246 ORIG_RAX: 0000000000000031
RAX: ffffffffffffffda RBX: 0000000000000003 RCX: 0000000000458da9
RDX: 0000000000000000 RSI: 0000000000000000 RDI: 0000000000000004
RBP: 000000000073bf00 R08: 0000000000000000 R09: 0000000000000000
R10: 0000000000000000 R11: 0000000000000246 R12: 00007f4aeb5bc6d4
R13: 00000000004bee1f R14: 00000000004cfe68 R15: 00000000ffffffff

Local variable description: ----address@__sys_bind
Variable was created at:
sockfd_lookup_light net/socket.c:488 [inline]
__sys_bind+0x8c/0x7c0 net/socket.c:1619
__do_sys_bind net/socket.c:1638 [inline]
__se_sys_bind+0x8d/0xb0 net/socket.c:1636
==================================================================


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

Tetsuo Handa

unread,
May 16, 2019, 9:13:06 AM5/16/19
to syzbot, gli...@google.com, jmo...@namei.org, linux-...@vger.kernel.org, linux-secu...@vger.kernel.org, se...@hallyn.com, syzkall...@googlegroups.com, take...@nttdata.co.jp
On 2019/05/16 21:58, syzbot wrote:
> Hello,
>
> syzbot found the following crash on:
>
> HEAD commit:    3b955a40 usb-fuzzer: main usb gadget fuzzer driver
> git tree:       kmsan
> console output: https://syzkaller.appspot.com/x/log.txt?x=1027e608a00000
> kernel config:  https://syzkaller.appspot.com/x/.config?x=602468164ccdc30a
> dashboard link: https://syzkaller.appspot.com/bug?extid=1018d578c410f9f37261
> compiler:       clang version 9.0.0 (/home/glider/llvm/clang 06d00afa61eef8f7f501ebdb4e8612ea43ec2d78)
>
> Unfortunately, I don't have any reproducer for this crash yet.

This should be already fixed in linux.git.

#syz fix: tomoyo: Check address length before reading address family

commit e6193f78bb689f3f424559bb45f4a091c8b314df
Author: Tetsuo Handa <penguin...@I-love.SAKURA.ne.jp>
Date: Fri Apr 12 19:59:36 2019 +0900

tomoyo: Check address length before reading address family

KMSAN will complain if valid address length passed to bind()/connect()/
sendmsg() is shorter than sizeof("struct sockaddr"->sa_family) bytes.

Signed-off-by: Tetsuo Handa <penguin...@I-love.SAKURA.ne.jp>
Signed-off-by: James Morris <jamo...@linux.microsoft.com>

Alexander Potapenko

unread,
May 16, 2019, 9:20:00 AM5/16/19
to Tetsuo Handa, syzbot, James Morris, LKML, linux-security-module, Serge E. Hallyn, syzkaller-bugs, take...@nttdata.co.jp
From: Tetsuo Handa <penguin...@i-love.sakura.ne.jp>
Date: Thu, May 16, 2019 at 3:13 PM
To: syzbot
Cc: <gli...@google.com>, <jmo...@namei.org>,
<linux-...@vger.kernel.org>,
<linux-secu...@vger.kernel.org>, <se...@hallyn.com>,
<syzkall...@googlegroups.com>, <take...@nttdata.co.jp>
Apparently the fix didn't make it to 5.1, I'll cherry-pick it to KMSAN tree.
OOC, how did you know about this bug?
> --
> 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/2b0b9d18-6773-f2dc-ecb2-9f8782d0962a%40i-love.sakura.ne.jp.
> For more options, visit https://groups.google.com/d/optout.



--
Alexander Potapenko
Software Engineer

Google Germany GmbH
Erika-Mann-Straße, 33
80636 München

Geschäftsführer: Paul Manicle, Halimah DeLaine Prado
Registergericht und -nummer: Hamburg, HRB 86891
Sitz der Gesellschaft: Hamburg

Tetsuo Handa

unread,
May 16, 2019, 9:37:32 AM5/16/19
to Alexander Potapenko, syzbot, James Morris, LKML, linux-security-module, Serge E. Hallyn, syzkaller-bugs, take...@nttdata.co.jp
On 2019/05/16 22:19, Alexander Potapenko wrote:
>> commit e6193f78bb689f3f424559bb45f4a091c8b314df
>> Author: Tetsuo Handa <penguin...@I-love.SAKURA.ne.jp>
>> Date: Fri Apr 12 19:59:36 2019 +0900
>>
>> tomoyo: Check address length before reading address family
>>
>> KMSAN will complain if valid address length passed to bind()/connect()/
>> sendmsg() is shorter than sizeof("struct sockaddr"->sa_family) bytes.
>>
>> Signed-off-by: Tetsuo Handa <penguin...@I-love.SAKURA.ne.jp>
>> Signed-off-by: James Morris <jamo...@linux.microsoft.com>
> Apparently the fix didn't make it to 5.1, I'll cherry-pick it to KMSAN tree.

Together with three more patches listed bottom, please.

> OOC, how did you know about this bug?

I did a tree-wide check when writing a patch for

KMSAN: uninit-value in rds_bind
KMSAN: uninit-value in rds_connect

reports. Patches for LSM part just did not make it to 5.1.



commit b9ef5513c99bf9c8bfd9c9e8051b67f52b2dee1e
Author: Tetsuo Handa <penguin...@I-love.SAKURA.ne.jp>
Date: Fri Apr 12 19:59:35 2019 +0900

smack: Check address length before reading address family

commit 619ae03e922b65a1a5d4269ceae1e9e13a058d6b
Author: Casey Schaufler <ca...@schaufler-ca.com>
Date: Tue Apr 30 14:13:32 2019 -0700

Smack: Fix kbuild reported build error

commit c750e6929d3c76d13d1d0ba475989d6dd74785d5
Author: Tetsuo Handa <penguin...@i-love.sakura.ne.jp>
Date: Fri Apr 12 19:59:34 2019 +0900

selinux: Check address length before reading address family
Reply all
Reply to author
Forward
0 new messages