🇰🇷 한글 설명
Linux 커널의 ftrace 기능에서 trace_parser 구조체에 대한 동시 접근을 제어하는 메커니즘이 부족하여 발생하는 취약점입니다. 여러 스레드가 동일한 트레이스 파일을 공유할 경우, 내부 상태 필드인 idx, cont, buffer가 경합 상태(Race Condition)에 빠져 데이터가 손상되거나 정의되지 않은 동작이 발생할 수 있습니다.
💡 쉬운 설명
리눅스 시스템의 기록 도구(ftrace)를 여러 명이 동시에 조작하려고 할 때, 내부 데이터가 엉키면서 시스템이 오작동할 수 있는 문제입니다. 이를 방지하기 위해 한 번에 한 명씩만 접근할 수 있도록 잠금 장치를 추가하여 해결했습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ftrace: Add global mutex to serialize trace_parser access
In ftrace, the trace_parser structure is allocated and initialized when
a trace file is opened, and is subsequently used across write and release
handlers to parse user input.
The affected handler paths and their specific functions are:
- Open paths: ftrace_regex_open(), ftrace_graph_open()
- Write paths: ftrace_regex_write(), ftrace_graph_write()
- Release paths: ftrace_regex_release(), ftrace_graph_release()
If userspace opens a trace file descriptor and shares it across multiple
threads, concurrent write calls will race on the parser's internal state,
specifically the 'idx', 'cont', and 'buffer' fields, leading to corrupted
input or undefined behavior.
Fix this by adding a global mutex, parser_lock, to serialize all access
to trace_parser across write and release paths, preventing concurrent
corruption of parser state.
📍 영향받는 시스템
ftrace 기능을 사용하는 Linux 커널 (패치 적용 전 버전)
⚔️ 공격 벡터
사용자 공간에서 트레이스 파일 디스크립터를 생성한 후, 여러 스레드를 통해 동시에 쓰기(write) 작업을 수행하여 경합 유도
🛡️ 대응 방법
커널 업데이트를 통해 trace_parser 접근을 직렬화하는 parser_lock(global mutex)이 적용된 최신 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인