Bug 1784911 (CVE-2019-19813) - CVE-2019-19813 kernel: use-after-free in __mutex_lock in kernel/locking/mutex.c
Summary: CVE-2019-19813 kernel: use-after-free in __mutex_lock in kernel/locking/mutex.c
Keywords:
Status: CLOSED NOTABUG
Alias: CVE-2019-19813
Product: Security Response
Classification: Other
Component: vulnerability
Version: unspecified
Hardware: All
OS: Linux
medium
medium
Target Milestone: ---
Assignee: Red Hat Product Security
QA Contact:
URL:
Whiteboard:
Depends On: 1784913
Blocks: 1784914
TreeView+ depends on / blocked
 
Reported: 2019-12-18 17:28 UTC by Guilherme de Almeida Suckevicz
Modified: 2023-03-24 16:31 UTC (History)
48 users (show)

Fixed In Version:
Doc Type: If docs needed, set a value
Doc Text:
Clone Of:
Environment:
Last Closed: 2020-03-31 16:31:56 UTC
Embargoed:


Attachments (Terms of Use)

Description Guilherme de Almeida Suckevicz 2019-12-18 17:28:58 UTC
In the Linux kernel 5.0.21, mounting a crafted btrfs filesystem image, performing some operations, and then making a syncfs system call can lead to a use-after-free in __mutex_lock in kernel/locking/mutex.c. This is related to mutex_can_spin_on_owner in kernel/locking/mutex.c, __btrfs_qgroup_free_meta in fs/btrfs/qgroup.c, and btrfs_insert_delayed_items in fs/btrfs/delayed-inode.c.

Reference:
https://github.com/bobfuzzer/CVE/tree/master/CVE-2019-19813

Comment 1 Guilherme de Almeida Suckevicz 2019-12-18 17:34:17 UTC
Created kernel tracking bugs for this issue:

Affects: fedora-all [bug 1784913]

Comment 2 Alex 2020-03-31 13:19:27 UTC
For Rhel8 the BTRFS not being used ("CONFIG_BTRFS_FS is not set"), so bug not actual for Rhel8.

Before Rhel8 this bug was not actual, because function mutex_can_spin_on_owner(..) was different:
the code in Rhel7 didn't contain "owner = __mutex_owner(lock)" yet and the bug is because of this line of code and then check "owner->on_cpu" where owner could be already freed even it was not NULL a moment before;

also __mutex_owner(..) could return NULL by design and should not be called directly;
for more details regarding __mutex_owner(..), see https://github.com/torvalds/linux/blob/master/kernel/locking/mutex.c , and example of usage in func mutex_is_locked(..).

The provided info above could be used to develop patch (since I didn't find ready to use patch).

Comment 3 Product Security DevOps Team 2020-03-31 16:31:56 UTC
This bug is now closed. Further updates for individual products will be reflected on the CVE page(s):

https://access.redhat.com/security/cve/cve-2019-19813

Comment 5 Justin M. Forbes 2020-10-08 19:03:23 UTC
This was fixed for Fedora with the 5.2 kernel rebases.


Note You need to log in before you can comment on or make changes to this bug.