🇰🇷 한글 설명
Linux 커널의 BPF 인터프리터에서 32비트 정수의 최소값(INT_MIN)을 처리할 때 발생하는 정의되지 않은 동작(Undefined Behavior) 취약점입니다. 이로 인해 검증기(Verifier)와 인터프리터 간의 계산 불일치가 발생하여, 공격자가 메모리 경계를 벗어난 맵 값에 접근할 수 있습니다.
💡 쉬운 설명
컴퓨터가 아주 작은 숫자를 나누는 계산을 할 때 수학적으로 틀린 결과를 내놓는 버그가 발견되었습니다. 이 계산 오류를 이용하면 해커가 허용되지 않은 메모리 영역을 훔쳐보거나 조작할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
bpf: Fix undefined behavior in interpreter sdiv/smod for INT_MIN
The BPF interpreter's signed 32-bit division and modulo handlers use
the kernel abs() macro on s32 operands. The abs() macro documentation
(include/linux/math.h) explicitly states the result is undefined when
the input is the type minimum. When DST contains S32_MIN (0x80000000),
abs((s32)DST) triggers undefined behavior and returns S32_MIN unchanged
on arm64/x86. This value is then sign-extended to u64 as
0xFFFFFFFF80000000, causing do_div() to compute the wrong result.
The verifier's abstract interpretation (scalar32_min_max_sdiv) computes
the mathematically correct result for range tracking, creating a
verifier/interpreter mismatch that can be exploited for out-of-bounds
map value access.
Introduce abs_s32() which handles S32_MIN correctly by casting to u32
before negating, avoiding signed overflow entirely. Replace all 8
abs((s32)...) call sites in the interpreter's sdiv32/smod32 handlers.
s32 is the only affected case -- the s64 division/modulo handlers do
not use abs().
📍 영향받는 시스템
Linux kernel (BPF interpreter using s32 division/modulo handlers)
⚔️ 공격 벡터
특수하게 조작된 BPF 프로그램을 로드하여 인터프리터의 계산 오류를 유도하고 Out-of-bounds 접근 수행
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 abs_s32() 수정 사항 반영
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인