CVE-2024-50182

Source
https://nvd.nist.gov/vuln/detail/CVE-2024-50182
Import Source
https://storage.googleapis.com/osv-test-cve-osv-conversion/osv-output/CVE-2024-50182.json
JSON Data
https://api.test.osv.dev/v1/vulns/CVE-2024-50182
Downstream
Related
Published
2024-11-08T05:38:23.528Z
Modified
2025-11-27T02:32:37.901205Z
Severity
  • 5.5 (Medium) CVSS_V3 - CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:N/A:H CVSS Calculator
Summary
secretmem: disable memfd_secret() if arch cannot set direct map
Details

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

secretmem: disable memfd_secret() if arch cannot set direct map

Return -ENOSYS from memfdsecret() syscall if !cansetdirectmap(). This is the case for example on some arm64 configurations, where marking 4k PTEs in the direct map not present can only be done if the direct map is set up at 4k granularity in the first place (as ARM's break-before-make semantics do not easily allow breaking apart large/gigantic pages).

More precisely, on arm64 systems with !cansetdirectmap(), setdirectmapinvalidnoflush() is a no-op, however it returns success (0) instead of an error. This means that memfdsecret will seemingly "work" (e.g. syscall succeeds, you can mmap the fd and fault in pages), but it does not actually achieve its goal of removing its memory from the direct map.

Note that with this patch, memfdsecret() will start erroring on systems where cansetdirectmap() returns false (arm64 with CONFIGRODATAFULLDEFAULTENABLED=n, CONFIGDEBUGPAGEALLOC=n and CONFIGKFENCE=n), but that still seems better than the current silent failure. Since CONFIGRODATAFULLDEFAULTENABLED defaults to 'y', most arm64 systems actually have a working memfdsecret() and aren't be affected.

From going through the iterations of the original memfdsecret patch series, it seems that disabling the syscall in these scenarios was the intended behavior [1] (preferred over having setdirectmapinvalid_noflush return an error as that would result in SIGBUSes at page-fault time), however the check for it got dropped between v16 [2] and v17 [3], when secretmem moved away from CMA allocations.

Database specific
{
    "cna_assigner": "Linux",
    "osv_generated_from": "https://github.com/CVEProject/cvelistV5/blob/cc431b3424123d84bcd7afd4de150b33f117a8ef/cves/2024/50xxx/CVE-2024-50182.json"
}
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
1507f51255c9ff07d75909a84e7c0d7f3c4b2f49
Fixed
d0ae6ffa1aeb297aef89f49cfb894a83c329ebad
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
1507f51255c9ff07d75909a84e7c0d7f3c4b2f49
Fixed
5ea0b7af38754d2b45ead9257bca47e84662e926
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
1507f51255c9ff07d75909a84e7c0d7f3c4b2f49
Fixed
7caf966390e6e4ebf42775df54e7ee1f280ce677
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
1507f51255c9ff07d75909a84e7c0d7f3c4b2f49
Fixed
757786abe4547eb3d9d0e8350a63bdb0f9824af2
Type
GIT
Repo
https://git.kernel.org/pub/scm/linux/kernel/git/stable/linux.git
Events
Introduced
1507f51255c9ff07d75909a84e7c0d7f3c4b2f49
Fixed
532b53cebe58f34ce1c0f34d866f5c0e335c53c6

Linux / Kernel

Package

Name
Kernel

Affected ranges

Type
ECOSYSTEM
Events
Introduced
5.14.0
Fixed
5.15.169
Type
ECOSYSTEM
Events
Introduced
5.16.0
Fixed
6.1.113
Type
ECOSYSTEM
Events
Introduced
6.2.0
Fixed
6.6.57
Type
ECOSYSTEM
Events
Introduced
6.7.0
Fixed
6.11.4