🇰🇷 한글 설명
Linux 커널의 secretmem 서브시스템에서 특정 arm64 구성 시 memfd_secret() 시스템 호출이 메모리를 다이렉트 맵에서 제거하지 못하는 결함이 발견되었습니다. 이로 인해 시스템 호출은 성공한 것처럼 보이지만 실제로는 보안 목적을 달성하지 못하는 침묵적 실패(silent failure)가 발생할 수 있습니다.
💡 쉬운 설명
보안을 위해 메모리를 숨겨야 하는 기능이 특정 환경에서 작동하는 척하면서 실제로는 숨기지 못하는 문제가 있었습니다. 이로 인해 중요한 데이터가 메모리 상에 노출될 위험이 있습니다.
🇺🇸 원문 (English)
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/
[email protected]/
[2]: https://lore.kernel.org/lkml/
[email protected]/#t
[3]: https://lore.kernel.org/lkml/
[email protected]/
📍 영향받는 시스템
특정 arm64 구성(CONFIG_RODATA_FULL_DEFAULT_ENABLED=n, CONFIG_DEBUG_PAGEALLOC=n, CONFIG_KFENCE=n)을 사용하는 Linux 커널
⚔️ 공격 벡터
직접적인 공격보다는 보안 기능의 무력화를 통한 정보 노출 위험이 존재함
🛡️ 대응 방법
해당 결함이 수정된 최신 Linux 커널 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 버전인지 커널 배포판의 보안 공지를 통해 확인