🇰🇷 한글 설명
Linux 커널의 btrfs 파일 시스템에서 __btrfs_run_delayed_refs() 함수 호출 시 잘못된 포인터 역참조가 발생하는 취약점입니다. btrfs_select_ref_head()가 -EAGAIN 에러를 반환할 때 locked_ref 변수가 NULL로 초기화되지 않아, 에러 포인터에 대해 스핀락을 시도하면서 시스템 충돌이 발생할 수 있습니다.
💡 쉬운 설명
파일 시스템을 관리하는 프로그램이 잘못된 주소를 참조하여 컴퓨터가 갑자기 멈추거나 오류를 일으킬 수 있는 문제입니다. 특정 상황에서 시스템이 처리할 수 없는 잘못된 값을 사용하려고 시도할 때 발생합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix invalid pointer dereference in __btrfs_run_delayed_refs()
In the beginning of the loop, we try to obtain a locked delayed ref head,
if 'locked_ref' is currently NULL, by calling btrfs_select_ref_head(),
which can return an error pointer. If the error pointer is -EAGAIN we do
a continue and go back to the beginning of the loop, which will not try
again to call btrfs_select_ref_head() since 'locked_ref' is no longer
NULL but it's ERR_PTR(-EAGAIN), and then we do:
spin_lock(&locked_ref->lock);
against a ERR_PTR(-EAGAIN) value, generating an invalid pointer
dereference.
Fix this by ensuring that 'locked_ref' is set to NULL when
btrfs_select_ref_head() returns ERR_PTR(-EAGAIN) and incrementing 'count'
as well, to prevent infinite looping. We do this by doing a goto to the
bottom of the loop that already sets 'locked_ref' to NULL and does a
cond_resched(), with an increment to 'count' right before the goto.
These measures were in place before the refactoring in commit 0110a4c43451
("btrfs: refactor __btrfs_run_delayed_refs loop") but were unintentionally
lost afterwards.
📍 영향받는 시스템
btrfs 파일 시스템을 사용하는 Linux 커널 버전 (리팩토링 이후 버전)
⚔️ 공격 벡터
로컬 공격자가 특수하게 조작된 btrfs 파일 시스템 작업을 수행하여 커널 패닉 유도
🛡️ 대응 방법
해당 취약점이 수정된 최신 Linux 커널 버전으로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인