lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20230424135457.i6lmrznccvwv75up@quack3>
Date:   Mon, 24 Apr 2023 15:54:57 +0200
From:   Jan Kara <jack@...e.cz>
To:     Dmitry Vyukov <dvyukov@...gle.com>
Cc:     syzbot <syzbot+4a06d4373fd52f0b2f9c@...kaller.appspotmail.com>,
        amir73il@...il.com, jack@...e.cz, linux-fsdevel@...r.kernel.org,
        linux-kernel@...r.kernel.org, syzkaller-bugs@...glegroups.com
Subject: Re: [syzbot] [fs?] KCSAN: data-race in inotify_handle_inode_event /
 inotify_remove_from_idr

On Mon 24-04-23 10:27:46, Dmitry Vyukov wrote:
> On Mon, 24 Apr 2023 at 10:09, syzbot
> <syzbot+4a06d4373fd52f0b2f9c@...kaller.appspotmail.com> wrote:
> >
> > Hello,
> >
> > syzbot found the following issue on:
> >
> > HEAD commit:    622322f53c6d Merge tag 'mips-fixes_6.3_2' of git://git.ker..
> > git tree:       upstream
> > console output: https://syzkaller.appspot.com/x/log.txt?x=1482ffafc80000
> > kernel config:  https://syzkaller.appspot.com/x/.config?x=fa4baf7c6b35b5d5
> > dashboard link: https://syzkaller.appspot.com/bug?extid=4a06d4373fd52f0b2f9c
> > compiler:       Debian clang version 15.0.7, GNU ld (GNU Binutils for Debian) 2.35.2
> >
> > Unfortunately, I don't have any reproducer for this issue yet.
> >
> > Downloadable assets:
> > disk image: https://storage.googleapis.com/syzbot-assets/8b5f31d96315/disk-622322f5.raw.xz
> > vmlinux: https://storage.googleapis.com/syzbot-assets/adca7dc8daae/vmlinux-622322f5.xz
> > kernel image: https://storage.googleapis.com/syzbot-assets/ed78ddc31ccb/bzImage-622322f5.xz
> >
> > IMPORTANT: if you fix the issue, please add the following tag to the commit:
> > Reported-by: syzbot+4a06d4373fd52f0b2f9c@...kaller.appspotmail.com
> 
> If I am reading this correctly, userspace can get wd=-1 as the result
> of this race. Docs say wd must refer to a previously allocated
> descriptor, which is positive. I don't see any mentions of semantics
> of wd=-1.

Yeah, indeed this looks like a possible race when we detach the mark just
while we are generating the event. I'll send a fix.

								Honza

> > ==================================================================
> > BUG: KCSAN: data-race in inotify_handle_inode_event / inotify_remove_from_idr
> >
> > write to 0xffff888104e31368 of 4 bytes by task 3229 on cpu 1:
> >  inotify_remove_from_idr+0x106/0x310 fs/notify/inotify/inotify_user.c:511
> >  inotify_ignored_and_remove_idr+0x34/0x60 fs/notify/inotify/inotify_user.c:532
> >  inotify_freeing_mark+0x1d/0x30 fs/notify/inotify/inotify_fsnotify.c:133
> >  fsnotify_free_mark fs/notify/mark.c:490 [inline]
> >  fsnotify_destroy_mark+0x17a/0x190 fs/notify/mark.c:499
> >  __do_sys_inotify_rm_watch fs/notify/inotify/inotify_user.c:817 [inline]
> >  __se_sys_inotify_rm_watch+0xf7/0x170 fs/notify/inotify/inotify_user.c:794
> >  __x64_sys_inotify_rm_watch+0x31/0x40 fs/notify/inotify/inotify_user.c:794
> >  do_syscall_x64 arch/x86/entry/common.c:50 [inline]
> >  do_syscall_64+0x41/0xc0 arch/x86/entry/common.c:80
> >  entry_SYSCALL_64_after_hwframe+0x63/0xcd
> >
> > read to 0xffff888104e31368 of 4 bytes by task 3638 on cpu 0:
> >  inotify_handle_inode_event+0x17e/0x2c0 fs/notify/inotify/inotify_fsnotify.c:113
> >  fsnotify_handle_inode_event+0x19b/0x1f0 fs/notify/fsnotify.c:264
> >  fsnotify_handle_event fs/notify/fsnotify.c:316 [inline]
> >  send_to_group fs/notify/fsnotify.c:364 [inline]
> >  fsnotify+0x101c/0x1150 fs/notify/fsnotify.c:570
> >  __fsnotify_parent+0x307/0x480 fs/notify/fsnotify.c:230
> >  fsnotify_parent include/linux/fsnotify.h:77 [inline]
> >  fsnotify_file include/linux/fsnotify.h:99 [inline]
> >  fsnotify_close include/linux/fsnotify.h:341 [inline]
> >  __fput+0x4b0/0x570 fs/file_table.c:307
> >  ____fput+0x15/0x20 fs/file_table.c:349
> >  task_work_run+0x123/0x160 kernel/task_work.c:179
> >  resume_user_mode_work include/linux/resume_user_mode.h:49 [inline]
> >  exit_to_user_mode_loop+0xd1/0xe0 kernel/entry/common.c:171
> >  exit_to_user_mode_prepare+0x6c/0xb0 kernel/entry/common.c:204
> >  __syscall_exit_to_user_mode_work kernel/entry/common.c:286 [inline]
> >  syscall_exit_to_user_mode+0x26/0x140 kernel/entry/common.c:297
> >  do_syscall_64+0x4d/0xc0 arch/x86/entry/common.c:86
> >  entry_SYSCALL_64_after_hwframe+0x63/0xcd
> >
> > value changed: 0x00000060 -> 0xffffffff
> >
> > Reported by Kernel Concurrency Sanitizer on:
> > CPU: 0 PID: 3638 Comm: syz-executor.0 Not tainted 6.3.0-rc7-syzkaller-00191-g622322f53c6d #0
> > Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 04/14/2023
> > ==================================================================
> >
> >
> > ---
> > 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 syzkaller@...glegroups.com.
> >
> > syzbot will keep track of this issue. See:
> > https://goo.gl/tpsmEJ#status for how to communicate with syzbot.
> >
> > --
> > 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-bugs+unsubscribe@...glegroups.com.
> > To view this discussion on the web visit https://groups.google.com/d/msgid/syzkaller-bugs/000000000000c2e89505fa108749%40google.com.
-- 
Jan Kara <jack@...e.com>
SUSE Labs, CR

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ