🇰🇷 한글 설명
Linux 커널의 ptp: netc 드라이버에서 주기 계산 시 max_period 값이 U32_MAX를 초과하여 발생하는 정수 절단 및 0으로 나누기 오류입니다. 이로 인해 period 값이 0이 될 경우 시스템에서 divide-by-zero 오류가 발생하거나 하드웨어 레지스터가 잘못 설정될 수 있습니다.
💡 쉬운 설명
시간을 측정하는 장치 설정 과정에서 숫자가 너무 커져서 0으로 잘못 계산되는 버그가 발견되었습니다. 이 버그가 발생하면 시스템이 계산 오류로 인해 멈추거나 오작동할 수 있습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
ptp: netc: fix period truncation and potential divide-by-zero in PEROUT
The max_period bound in net_timer_enable_perout() was computed as:
max_period = (u64)NETC_TMR_DEFAULT_FIPER + integral_period;
which exceeds U32_MAX when integral_period > 0 (e.g. 0x100000002 for
the default 333333333 Hz clock). A period_ns that passes this check but
exceeds U32_MAX is then silently truncated when stored into the u32
struct netc_pp::period field.
A truncated value of zero can reach netc_timer_set_perout_alarm(), where
the local u32 period variable would also be 0, causing a divide-by-zero
in roundup_u64(delta, period) whenever the stime < min_time branch is
taken (which always happens for a start time of {0, 0}).
Additionally, netc_timer_enable_periodic_pulse() and
netc_timer_enable_fiper() both compute:
fiper = pp->period - integral_period;
A zero pp->period results in an unsigned wraparound to 0xFFFFFFFD,
mis-programming the FIPER hardware register.
Fix all three issues by capping max_period at NETC_TMR_DEFAULT_FIPER
(0xFFFFFFFF). This ensures that any period_ns passing the range check
fits in a u32 without truncation, so the stored value is always valid
and non-zero. The accepted range is reduced by integral_period ns
(typically only a few nanoseconds), which is negligible in practice.
📍 영향받는 시스템
Linux Kernel (ptp: netc 드라이버 포함 버전)
⚔️ 공격 벡터
특정 네트워크 타이밍 설정(PTP)을 통해 매우 큰 주기 값을 입력하여 시스템 오류 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하여 max_period 범위를 제한해야 함
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인