🇰🇷 한글 설명
Linux 커널의 fcntl 서브시스템에서 fasync 신호 전달 시 SOFTIRQ 환경에서 안전하지 않은 잠금 순서로 인해 데드락이 발생할 수 있는 취약점입니다. 프로세스 그룹에 신호를 보낼 때 tasklist_lock을 사용함으로써, 쓰기 대기 중인 프로세스와 소프트 인터럽트 간의 충돌로 시스템이 멈출 수 있습니다.
💡 쉬운 설명
컴퓨터의 핵심 운영체제(커널)에서 작업 순서가 꼬여 시스템이 완전히 멈춰버리는 현상이 발생할 수 있습니다. 특히 네트워크 신호를 처리하는 과정에서 특정 상황이 겹치면 컴퓨터가 응답하지 않게 됩니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
fs/fcntl: fix SOFTIRQ-unsafe lock order in fasync signaling
A SOFTIRQ-safe to SOFTIRQ-unsafe lock order deadlock can occur in
send_sigio() and send_sigurg() when a process group receives a signal.
When FASYNC is configured for a process group (PIDTYPE_PGID), both
functions use read_lock(&tasklist_lock) to traverse the task list.
However, they are frequently called from softirq context:
- send_sigio() via input_inject_event -> kill_fasync
- send_sigurg() via tcp_check_urg -> sk_send_sigurg (NET_RX_SOFTIRQ)
The deadlock is caused by the rwlock writer fairness mechanism:
1. CPU 0 (process context) holds read_lock(&tasklist_lock) in do_wait().
2. CPU 1 (process context) attempts write_lock(&tasklist_lock) in
fork() or exit() and spins, which blocks all new readers.
3. CPU 0 is interrupted by a softirq (e.g., TCP URG packet reception).
4. The softirq calls send_sigurg() and attempts to acquire
read_lock(&tasklist_lock), deadlocking because CPU 1 is waiting.
Since PID hashing and do_each_pid_task() traversals are already
RCU-protected, the read_lock on tasklist_lock is no longer strictly
required for safe traversal. Fix this by replacing tasklist_lock with
rcu_read_lock(), aligning the process group signaling path with the
single-PID path. This also mitigates a potential remote denial of
service vector via TCP URG packets.
Lockdep splat:
=====================================================
WARNING: SOFTIRQ-safe -> SOFTIRQ-unsafe lock order detected
[...]
Chain exists of:
&dev->event_lock --> &f_owner->lock --> tasklist_lock
Possible interrupt unsafe locking scenario:
CPU0 CPU1
---- ----
lock(tasklist_lock);
local_irq_disable();
lock(&dev->event_lock);
lock(&f_owner->lock);
<Interrupt>
lock(&dev->event_lock);
*** DEADLOCK ***
📍 영향받는 시스템
Linux Kernel (fasync/fcntl 관련 모듈 사용 시스템)
⚔️ 공격 벡터
원격에서 TCP URG 패킷을 전송하여 시스템 데드락(DoS) 유발 가능
🛡️ 대응 방법
tasklist_lock 대신 RCU(Read-Copy-Update) 잠금 메커니즘을 사용하도록 커널 패치 적용
🔧 검증 코드
현재 실행 중인 커널 버전을 확인하여 해당 취약점이 수정된 최신 패치 버전인지 확인합니다.