🇰🇷 한글 설명
Linux 커널의 crypto/zstd 모듈에서 여러 개의 tfm(transform)이 할당 및 해제될 때 per-CPU 스트림이 중복 해제되는 double-free 취약점이 발견되었습니다. zstd_streams가 모듈 수준이 아닌 각 tfm 파괴 시마다 해제되면서 발생하는 문제로, 이를 모듈 정리 시에만 한 번 해제되도록 생명주기 관리를 수정하였습니다.
💡 쉬운 설명
컴퓨터가 데이터를 압축할 때 사용하는 메모리 공간을 정리하는 과정에서, 이미 정리된 공간을 또 정리하려고 시도하여 시스템 오류를 일으키는 버그입니다. 이로 인해 시스템이 불안정해지거나 예기치 않게 멈출 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
crypto: zstd - fix double-free in per-CPU stream cleanup
The crypto/zstd module has a double-free bug that occurs when multiple
tfms are allocated and freed.
The issue happens because zstd_streams (per-CPU contexts) are freed in
zstd_exit() during every tfm destruction, rather than being managed at
the module level. When multiple tfms exist, each tfm exit attempts to
free the same shared per-CPU streams, resulting in a double-free.
This leads to a stack trace similar to:
BUG: Bad page state in process kworker/u16:1 pfn:106fd93
page: refcount:0 mapcount:0 mapping:0000000000000000 index:0x0 pfn:0x106fd93
flags: 0x17ffffc0000000(node=0|zone=2|lastcpupid=0x1fffff)
page_type: 0xffffffff()
raw: 0017ffffc0000000 dead000000000100 dead000000000122 0000000000000000
raw: 0000000000000000 0000000000000000 00000000ffffffff 0000000000000000
page dumped because: nonzero entire_mapcount
Modules linked in: ...
CPU: 3 UID: 0 PID: 2506 Comm: kworker/u16:1 Kdump: loaded Tainted: G B
Hardware name: ...
Workqueue: btrfs-delalloc btrfs_work_helper
Call Trace:
<TASK>
dump_stack_lvl+0x5d/0x80
bad_page+0x71/0xd0
free_unref_page_prepare+0x24e/0x490
free_unref_page+0x60/0x170
crypto_acomp_free_streams+0x5d/0xc0
crypto_acomp_exit_tfm+0x23/0x50
crypto_destroy_tfm+0x60/0xc0
...
Change the lifecycle management of zstd_streams to free the streams only
once during module cleanup.
📍 영향받는 시스템
zstd 모듈을 사용하는 Linux 커널 (패치 적용 전 버전)
⚔️ 공격 벡터
로컬 공격자가 특정 압축 작업을 반복적으로 수행하여 커널 메모리 오류를 유도할 수 있음
🛡️ 대응 방법
zstd 스트림의 생명주기 관리가 수정된 최신 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전을 확인하여 해당 취약점이 해결된 최신 보안 패치 버전인지 확인합니다.