CVE-2024-27070

Source
https://nvd.nist.gov/vuln/detail/CVE-2024-27070
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-27070.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2024-27070
Downstream
Published
2024-05-01T13:04:26Z
Modified
2025-10-09T04:38:54.906628Z
Summary
f2fs: fix to avoid use-after-free issue in f2fs_filemap_fault
Details

In the Linux kernel, the following vulnerability has been resolved:

f2fs: fix to avoid use-after-free issue in f2fsfilemapfault

syzbot reports a f2fs bug as below:

BUG: KASAN: slab-use-after-free in f2fsfilemapfault+0xd1/0x2c0 fs/f2fs/file.c:49 Read of size 8 at addr ffff88807bb22680 by task syz-executor184/5058

CPU: 0 PID: 5058 Comm: syz-executor184 Not tainted 6.7.0-syzkaller-09928-g052d534373b7 #0 Hardware name: Google Google Compute Engine/Google Compute Engine, BIOS Google 11/17/2023 Call Trace: <TASK> _dumpstack lib/dumpstack.c:88 [inline] dumpstacklvl+0x1e7/0x2d0 lib/dumpstack.c:106 printaddressdescription mm/kasan/report.c:377 [inline] printreport+0x163/0x540 mm/kasan/report.c:488 kasanreport+0x142/0x170 mm/kasan/report.c:601 f2fsfilemapfault+0xd1/0x2c0 fs/f2fs/file.c:49 _dofault+0x131/0x450 mm/memory.c:4376 dosharedfault mm/memory.c:4798 [inline] dofault mm/memory.c:4872 [inline] doptemissing mm/memory.c:3745 [inline] handleptefault mm/memory.c:5144 [inline] _handlemmfault+0x23b7/0x72b0 mm/memory.c:5285 handlemmfault+0x27e/0x770 mm/memory.c:5450 douseraddrfault arch/x86/mm/fault.c:1364 [inline] handlepagefault arch/x86/mm/fault.c:1507 [inline] excpagefault+0x456/0x870 arch/x86/mm/fault.c:1563 asmexcpagefault+0x26/0x30 arch/x86/include/asm/idtentry.h:570

The root cause is: in f2fsfilemapfault(), vmf->vma may be not alive after filemapfault(), so it may cause use-after-free issue when accessing vmf->vma->vmflags in tracef2fsfilemapfault(). So it needs to keep vmflags in separated temporary variable for tracepoint use.

References

Affected packages

Git / git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git

Affected ranges

Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
b43c3050d21196e5e7024872e3048dba83e31751
Fixed
897761d16564e899faecb9381b4818858705081f
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
87f3afd366f7c668be0269efda8a89741a3ea6b3
Fixed
8186e16a766d709a08f188d2f4e84098f364bea1
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
87f3afd366f7c668be0269efda8a89741a3ea6b3
Fixed
eb70d5a6c932d9d23f4bb3e7b83782c21ac4b064

Affected versions

v6.*

v6.7
v6.7-rc2
v6.7-rc3
v6.7-rc4
v6.7-rc5
v6.7-rc6
v6.7-rc7
v6.7-rc8
v6.8
v6.8-rc1
v6.8-rc2
v6.8-rc3
v6.8-rc4
v6.8-rc5
v6.8-rc6
v6.8-rc7
v6.8.1

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
6.8.0
Fixed
6.8.2