🇰🇷 한글 설명
Linux 커널의 Btrfs 파일 시스템에서 read_extent_buffer_pages() 함수 내에 레이스 컨디션(경쟁 상태) 취약점이 발견되었습니다. 이로 인해 데이터가 완전히 읽히기 전에 읽기 완료 상태로 오인될 수 있으며, 결과적으로 파일 시스템 노드가 손상될 수 있습니다.
💡 쉬운 설명
여러 작업이 동시에 파일 데이터를 읽으려고 할 때, 데이터가 아직 준비되지 않았음에도 준비되었다고 착각하여 잘못된 데이터를 읽는 문제입니다. 이로 인해 저장된 파일이나 시스템 데이터가 깨질 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
btrfs: fix race in read_extent_buffer_pages()
There are reports from tree-checker that detects corrupted nodes,
without any obvious pattern so possibly an overwrite in memory.
After some debugging it turns out there's a race when reading an extent
buffer the uptodate status can be missed.
To prevent concurrent reads for the same extent buffer,
read_extent_buffer_pages() performs these checks:
/* (1) */
if (test_bit(EXTENT_BUFFER_UPTODATE, &eb->bflags))
return 0;
/* (2) */
if (test_and_set_bit(EXTENT_BUFFER_READING, &eb->bflags))
goto done;
At this point, it seems safe to start the actual read operation. Once
that completes, end_bbio_meta_read() does
/* (3) */
set_extent_buffer_uptodate(eb);
/* (4) */
clear_bit(EXTENT_BUFFER_READING, &eb->bflags);
Normally, this is enough to ensure only one read happens, and all other
callers wait for it to finish before returning. Unfortunately, there is
a racey interleaving:
Thread A | Thread B | Thread C
---------+----------+---------
(1) | |
| (1) |
(2) | |
(3) | |
(4) | |
| (2) |
| | (1)
When this happens, thread B kicks of an unnecessary read. Worse, thread
C will see UPTODATE set and return immediately, while the read from
thread B is still in progress. This race could result in tree-checker
errors like this as the extent buffer is concurrently modified:
BTRFS critical (device dm-0): corrupted node, root=256
block=8550954455682405139 owner mismatch, have 11858205567642294356
expect [256, 18446744073709551360]
Fix it by testing UPTODATE again after setting the READING bit, and if
it's been set, skip the unnecessary read.
[ minor update of changelog ]
📍 영향받는 시스템
Linux kernel (Btrfs 파일 시스템을 사용하는 시스템)
⚔️ 공격 벡터
로컬 공격자가 특정 파일 시스템 작업 패턴을 유도하여 메모리 오버라이트 및 데이터 손상을 유발할 수 있음
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 최신 패치 버전인지 확인하십시오.