CVE-2024-50182

In the Linux kernel, the following vulnerability has been resolved: secretmem: disable memfd_secret() if arch cannot set direct map Return -ENOSYS from memfd_secret() syscall if !can_set_direct_map(). 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 !can_set_direct_map(), set_direct_map_invalid_noflush() is a no-op, however it returns success (0) instead of an error. This means that memfd_secret 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, memfd_secret() will start erroring on systems where can_set_direct_map() returns false (arm64 with CONFIG_RODATA_FULL_DEFAULT_ENABLED=n, CONFIG_DEBUG_PAGEALLOC=n and CONFIG_KFENCE=n), but that still seems better than the current silent failure. Since CONFIG_RODATA_FULL_DEFAULT_ENABLED defaults to 'y', most arm64 systems actually have a working memfd_secret() and aren't be affected. From going through the iterations of the original memfd_secret patch series, it seems that disabling the syscall in these scenarios was the intended behavior [1] (preferred over having set_direct_map_invalid_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. [1]: https://lore.kernel.org/lkml/20201124164930.GK8537@kernel.org/ [2]: https://lore.kernel.org/lkml/20210121122723.3446-11-rppt@kernel.org/#t [3]: https://lore.kernel.org/lkml/20201125092208.12544-10-rppt@kernel.org/
Configurations

Configuration 1 (hide)

OR cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.12:rc1:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.12:rc2:*:*:*:*:*:*

History

29 Nov 2024, 20:38

Type Values Removed Values Added
CPE cpe:2.3:o:linux:linux_kernel:6.12:rc1:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:6.12:rc2:*:*:*:*:*:*
cpe:2.3:o:linux:linux_kernel:*:*:*:*:*:*:*:*
First Time Linux linux Kernel
Linux
References () https://git.kernel.org/stable/c/532b53cebe58f34ce1c0f34d866f5c0e335c53c6 - () https://git.kernel.org/stable/c/532b53cebe58f34ce1c0f34d866f5c0e335c53c6 - Patch
References () https://git.kernel.org/stable/c/5ea0b7af38754d2b45ead9257bca47e84662e926 - () https://git.kernel.org/stable/c/5ea0b7af38754d2b45ead9257bca47e84662e926 - Patch
References () https://git.kernel.org/stable/c/757786abe4547eb3d9d0e8350a63bdb0f9824af2 - () https://git.kernel.org/stable/c/757786abe4547eb3d9d0e8350a63bdb0f9824af2 - Patch
References () https://git.kernel.org/stable/c/7caf966390e6e4ebf42775df54e7ee1f280ce677 - () https://git.kernel.org/stable/c/7caf966390e6e4ebf42775df54e7ee1f280ce677 - Patch
References () https://git.kernel.org/stable/c/d0ae6ffa1aeb297aef89f49cfb894a83c329ebad - () https://git.kernel.org/stable/c/d0ae6ffa1aeb297aef89f49cfb894a83c329ebad - Patch
CVSS v2 : unknown
v3 : unknown
v2 : unknown
v3 : 5.5
CWE NVD-CWE-noinfo

08 Nov 2024, 19:01

Type Values Removed Values Added
Summary
  • (es) En el kernel de Linux, se ha resuelto la siguiente vulnerabilidad: secretmem: deshabilitar memfd_secret() si arch no puede establecer el mapa directo Devolver -ENOSYS de la llamada al sistema memfd_secret() si !can_set_direct_map(). Este es el caso, por ejemplo, de algunas configuraciones arm64, donde marcar 4k PTE en el mapa directo como no presentes solo se puede hacer si el mapa directo se configura con una granularidad de 4k en primer lugar (ya que la semántica break-before-make de ARM no permite dividir fácilmente páginas grandes/gigantescas). Más precisamente, en sistemas arm64 con !can_set_direct_map(), set_direct_map_invalid_noflush() es una operación sin efecto, sin embargo, devuelve éxito (0) en lugar de un error. Esto significa que memfd_secret aparentemente "funcionará" (por ejemplo, la llamada al sistema tiene éxito, puede mmap el fd y el error en las páginas), pero en realidad no logra su objetivo de eliminar su memoria del mapa directo. Tenga en cuenta que con este parche, memfd_secret() comenzará a generar errores en sistemas donde can_set_direct_map() devuelve falso (arm64 con CONFIG_RODATA_FULL_DEFAULT_ENABLED=n, CONFIG_DEBUG_PAGEALLOC=n y CONFIG_KFENCE=n), pero eso parece mejor que el error silencioso actual. Dado que CONFIG_RODATA_FULL_DEFAULT_ENABLED tiene como valor predeterminado 'y', la mayoría de los sistemas arm64 tienen en realidad un memfd_secret() en funcionamiento y no se ven afectados. Al revisar las iteraciones de la serie de parches memfd_secret originales, parece que deshabilitar la llamada al sistema en estos escenarios era el comportamiento previsto [1] (preferible a que set_direct_map_invalid_noflush devuelva un error ya que eso generaría SIGBUS en el momento de la falla de la página); sin embargo, la verificación se abandonó entre v16 [2] y v17 [3], cuando secretmem se alejó de las asignaciones de CMA. [1]: https://lore.kernel.org/lkml/20201124164930.GK8537@kernel.org/ [2]: https://lore.kernel.org/lkml/20210121122723.3446-11-rppt@kernel.org/#t [3]: https://lore.kernel.org/lkml/20201125092208.12544-10-rppt@kernel.org/

08 Nov 2024, 06:15

Type Values Removed Values Added
New CVE

Information

Published : 2024-11-08 06:15

Updated : 2024-11-29 20:38


NVD link : CVE-2024-50182

Mitre link : CVE-2024-50182

CVE.ORG link : CVE-2024-50182


JSON object : View

Products Affected

linux

  • linux_kernel