🇰🇷 한글 설명
Linux 커널의 Intel PT 성능 모니터링 기능에서 stop/start 호출 시 AUX 출력 컨텍스트의 균형이 깨지는 취약점이 발견되었습니다. 그룹 스로틀링 기능 도입 이후 특정 조건에서 perf_aux_output_begin()이 중복 호출되어 커널 경고(WARNING)를 발생시킬 수 있습니다.
💡 쉬운 설명
컴퓨터의 성능을 측정하는 기능이 작동하는 과정에서, 내부적인 시작과 종료 신호가 맞지 않아 시스템에 오류 경고가 발생하는 문제입니다. 이는 특정 상황에서 성능 측정 도구가 중복으로 실행되려고 시도할 때 발생합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
perf/x86/intel/pt: Fix stop/start with no update
If pt_event_stop() is called without PERF_EF_UPDATE flag, then
perf_aux_output_end() is not called. A subsequent call to pt_event_start()
will call perf_aux_output_begin() again which violates the rule against
nesting and triggers a WARNING in perf_aux_output_begin().
Originally, pt_event_stop() was never called without PERF_EF_UPDATE,
because the only code paths to do so are from event overflow, and Intel PT
does not do that.
However the introduction of group throttling by commit 9734e25fbf5ae
("perf: Fix the throttle logic for a group") meant that an Intel PT event
could be throttled if it was part of a group. Throttling calls PMU
->stop() / ->start() callbacks without flags.
An example is when AUX area sampling is used. The following commands
hit the issue:
echo 10000 > /proc/sys/kernel/perf_event_max_sample_rate
perf record -F32000 --aux-sample -e '{intel_pt//u,cycles:u}' \
-- bash -c 'for i in `seq 1 100000` ; do true ; done'
Use PERF_HES_UPTODATE to track whether perf_aux_output_begin() and
perf_aux_output_end() are balanced. A cleared PERF_HES_UPTODATE bit
indicates that an AUX output context is still open.
Amend pt_event_start() / pt_event_stop() accordingly so that begin/end
stay balanced:
- In non-snapshot mode, stop() always closes the buffer (the buffer may
have run out of space, and that accounting is done by the update), so
a following start() opens a fresh one as before.
- In snapshot/overwrite mode, stop() without PERF_EF_UPDATE leaves the
buffer open so that pt_event_snapshot_aux() can still copy from it,
and start() then only re-enables tracing instead of calling
perf_aux_output_begin() again.
Note that pt_event_del() calls pt_event_stop() with PERF_EF_UPDATE flag set
(as is required by the documentation), so a final call to
perf_aux_output_end() is assured.
📍 영향받는 시스템
Intel PT 기능을 사용하는 Linux 커널 (그룹 스로틀링 기능이 도입된 이후 버전)
⚔️ 공격 벡터
로컬 사용자가 특정 perf 명령어를 사용하여 성능 측정 도구를 실행할 때 발생 (로컬 공격)
🛡️ 대응 방법
Intel PT의 start/stop 로직이 수정된 최신 Linux 커널 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 패치된 최신 보안 업데이트 버전인지 확인하십시오.