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: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAKYAXd-+_M=7b-E7RyJj+S3w=_WF8VDRyunYdXPdpD1dTtRA=Q@mail.gmail.com>
Date:   Sat, 15 Jul 2023 08:36:06 +0900
From:   Namjae Jeon <linkinjeon@...nel.org>
To:     Sungjong Seo <sj1557.seo@...sung.com>
Cc:     linux-fsdevel@...r.kernel.org, linux-kernel@...r.kernel.org,
        stable@...r.kernel.org,
        syzbot+1741a5d9b79989c10bdc@...kaller.appspotmail.com
Subject: Re: [PATCH] exfat: release s_lock before calling dir_emit()

2023-07-14 17:43 GMT+09:00, Sungjong Seo <sj1557.seo@...sung.com>:
> There is a potential deadlock reported by syzbot as below:
>
> ======================================================
> WARNING: possible circular locking dependency detected
> 6.4.0-next-20230707-syzkaller #0 Not tainted
> ------------------------------------------------------
> syz-executor330/5073 is trying to acquire lock:
> ffff8880218527a0 (&mm->mmap_lock){++++}-{3:3}, at: mmap_read_lock_killable
> include/linux/mmap_lock.h:151 [inline]
> ffff8880218527a0 (&mm->mmap_lock){++++}-{3:3}, at: get_mmap_lock_carefully
> mm/memory.c:5293 [inline]
> ffff8880218527a0 (&mm->mmap_lock){++++}-{3:3}, at:
> lock_mm_and_find_vma+0x369/0x510 mm/memory.c:5344
> but task is already holding lock:
> ffff888019f760e0 (&sbi->s_lock){+.+.}-{3:3}, at: exfat_iterate+0x117/0xb50
> fs/exfat/dir.c:232
>
> which lock already depends on the new lock.
>
> Chain exists of:
>   &mm->mmap_lock --> mapping.invalidate_lock#3 --> &sbi->s_lock
>
>  Possible unsafe locking scenario:
>
>        CPU0                    CPU1
>        ----                    ----
>   lock(&sbi->s_lock);
>                                lock(mapping.invalidate_lock#3);
>                                lock(&sbi->s_lock);
>   rlock(&mm->mmap_lock);
>
> Let's try to avoid above potential deadlock condition by moving dir_emit*()
> out of sbi->s_lock coverage.
>
> Fixes: ca06197382bd ("exfat: add directory operations")
> Cc: stable@...r.kernel.org #v5.7+
> Reported-by: syzbot+1741a5d9b79989c10bdc@...kaller.appspotmail.com
> Link:
> https://lore.kernel.org/lkml/00000000000078ee7e060066270b@google.com/T/#u
> Signed-off-by: Sungjong Seo <sj1557.seo@...sung.com>
Applied it to #dev, Thanks for your patch!

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ