🇰🇷 한글 설명
Linux 커널의 posix-cpu-timers에서 32비트 시스템 사용 시 RLIMIT_CPU 값을 나노초로 변환하는 과정에서 정수 오버플로가 발생합니다. 이로 인해 CPU 제한 시간이 5초 이상일 경우 타이머 만료 시간이 잘못 계산되어 조기에 트리거될 수 있습니다.
💡 쉬운 설명
32비트 컴퓨터에서 CPU 사용 시간을 계산할 때 숫자가 너무 커져서 계산 오류가 발생하는 문제입니다. 이 오류로 인해 프로그램이 정해진 시간보다 일찍 강제 종료될 수 있지만, 실제 제한 규칙 자체가 깨지는 것은 아닙니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
posix-cpu-timers: Use u64 multiplication in update_rlimit_cpu()
update_rlimit_cpu() converts the RLIMIT_CPU value to nanoseconds with
u64 nsecs = rlim_new * NSEC_PER_SEC;
On 32-bit kernels both rlim_new (unsigned long) and NSEC_PER_SEC
(1000000000L) are 32-bit, so the multiplication is performed in unsigned
long and truncated for rlim_new > 4 seconds before being widened to u64.
The same file already casts to u64 for the matching computation in
check_process_timers():
u64 softns = (u64)soft * NSEC_PER_SEC;
As a result, the truncated value is installed into the CPUCLOCK_PROF
expiry cache (nextevt), causing the process CPU timer to be programmed
to fire prematurely for any RLIMIT_CPU soft limit >= 5 seconds. The
actual SIGXCPU/SIGKILL decision in check_process_timers() already casts
to u64 and is therefore correct, so limit enforcement is not broken;
only the expiry-cache programming is wrong. Apply the same cast here so
both paths convert rlim_cur identically.
64-bit kernels are unaffected.
📍 영향받는 시스템
32-bit Linux kernel (64-bit kernels are unaffected)
⚔️ 공격 벡터
Local (사용자가 RLIMIT_CPU 값을 5초 이상으로 설정할 수 있는 환경)
🛡️ 대응 방법
Linux 커널을 최신 패치가 적용된 버전으로 업데이트하여 update_rlimit_cpu() 함수의 u64 캐스팅을 적용해야 합니다.
🔧 검증 코드
출력 결과가 x86 또는 arm 등 32비트 아키텍처인 경우 해당 취약점에 노출될 가능성이 있습니다.