🔍 CVE-2022-48797

7.1
CVSS Score
HIGH
2024-07-16
2026-08-04 10:17
✅ 완료

🇰🇷 한글 설명

Linux 커널의 메모리 관리(mm) 서브시스템에서 NUMA 밸런싱 기능 활성화 시 COW(Copy-on-Write) 페이지의 참조 횟수를 잘못 판단하여 데이터 손상이 발생하는 취약점입니다. 기존에는 페이지 매핑 수를 기준으로 NUMA 이동 여부를 결정했으나, GUP(Get User Pages)와 같은 다른 참조가 있는 경우 이를 제대로 식별하지 못해 문제가 발생했습니다.

💡 쉬운 설명

컴퓨터가 메모리를 효율적으로 나누어 쓰는 과정에서, 이미 사용 중인 데이터를 잘못 건드려 데이터가 깨지는 현상이 발생할 수 있습니다. 특정 가속기 장치를 사용할 때 메모리 관리 방식의 오류로 인해 시스템 데이터가 손상될 위험이 있습니다.

🇺🇸 원문 (English)

In the Linux kernel, the following vulnerability has been resolved: mm: don't try to NUMA-migrate COW pages that have other uses Oded Gabbay reports that enabling NUMA balancing causes corruption with his Gaudi accelerator test load: "All the details are in the bug, but the bottom line is that somehow, this patch causes corruption when the numa balancing feature is enabled AND we don't use process affinity AND we use GUP to pin pages so our accelerator can DMA to/from system memory. Either disabling numa balancing, using process affinity to bind to specific numa-node or reverting this patch causes the bug to disappear" and Oded bisected the issue to commit 09854ba94c6a ("mm: do_wp_page() simplification"). Now, the NUMA balancing shouldn't actually be changing the writability of a page, and as such shouldn't matter for COW. But it appears it does. Suspicious. However, regardless of that, the condition for enabling NUMA faults in change_pte_range() is nonsensical. It uses "page_mapcount(page)" to decide if a COW page should be NUMA-protected or not, and that makes absolutely no sense. The number of mappings a page has is irrelevant: not only does GUP get a reference to a page as in Oded's case, but the other mappings migth be paged out and the only reference to them would be in the page count. Since we should never try to NUMA-balance a page that we can't move anyway due to other references, just fix the code to use 'page_count()'. Oded confirms that that fixes his issue. Now, this does imply that something in NUMA balancing ends up changing page protections (other than the obvious one of making the page inaccessible to get the NUMA faulting information). Otherwise the COW simplification wouldn't matter - since doing the GUP on the page would make sure it's writable. The cause of that permission change would be good to figure out too, since it clearly results in spurious COW events - but fixing the nonsensical test that just happened to work before is obviously the CorrectThing(tm) to do regardless.

📍 영향받는 시스템

NUMA 밸런싱 기능이 활성화된 Linux 커널 (특정 커밋 09854ba94c6a 이후 버전 포함)

⚔️ 공격 벡터

직접적인 외부 공격보다는 특정 하드웨어 가속기(Gaudi 등)를 사용하며 NUMA 밸런싱과 프로세스 친화성을 사용하지 않는 환경에서 데이터 손상 유발

🛡️ 대응 방법

Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 page_mapcount 대신 page_count를 사용하도록 수정된 코드를 적용해야 합니다.

🔧 검증 코드

출력된 커널 버전을 확인하여 해당 취약점이 해결된 패치 버전 이상인지 확인합니다.

Shell / Script
uname -r

📊 CVSS Vector String

CVSS Vector
CVSS:3.1/AV:L/AC:L/PR:L/UI:N/S:U/C:N/I:H/A:H

💻 영향받는 소프트웨어

Linux Kernel