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: <20230620-abfertigung-notlage-8b1c217bddf3@brauner>
Date:   Tue, 20 Jun 2023 11:44:17 +0200
From:   Christian Brauner <brauner@...nel.org>
To:     Li Dong <lidong@...o.com>
Cc:     Alexander Viro <viro@...iv.linux.org.uk>,
        "open list:FILESYSTEMS (VFS and infrastructure)" 
        <linux-fsdevel@...r.kernel.org>,
        open list <linux-kernel@...r.kernel.org>,
        opensource.kernel@...o.com
Subject: Re: [PATCH] fs: Fix bug in lock_rename_child that can cause deadlock

On Mon, Jun 19, 2023 at 09:37:14PM +0800, Li Dong wrote:
> Function xx causes a deadlock,because s_vfs_rename_mutex was not released when return
> 
> Signed-off-by: Li Dong <lidong@...o.com>
> ---

This is a cross-directory rename which requires s_vfs_rename_mutex to be
held. You're suggesting to drop it, violating basic locking assumptions
with dire consequences:

lock_rename_child()
{
        c1->d_parent != p2
        -> acquire s_vfs_rename_mutex
}

pairs with

old_parent = c1->d_parent;
unlock_rename(old_parent, p2)
{
        if (old_parent != p2)
        -> release s_vfs_rename_mutex
}

See the usage in ksmbd:

trap = lock_rename_child(old_child, new_path.dentry);
old_parent = dget(old_child->d_parent);
unlock_rename(old_parent, new_path.dentry);

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ