🇰🇷 한글 설명
Linux 커널의 PowerPC 아키텍처에서 seccomp 또는 ptrace가 시스템 콜을 가로챘을 때, 반환 값을 처리하는 과정에서 오류가 발생하여 잘못된 에러 코드(-ENOSYS)가 반환되는 취약점입니다. 이를 해결하기 위해 스레드 플래그를 도입하여 seccomp가 설정한 반환 값이 시스템 콜 실행 전에 올바르게 전달되도록 수정되었습니다.
💡 쉬운 설명
컴퓨터의 보안 감시 기능이 특정 명령을 차단하고 대신 다른 결과를 알려주려 할 때, 시스템이 이를 무시하고 잘못된 에러를 내뱉는 문제입니다. 이로 인해 보안 설정이 의도한 대로 작동하지 않을 수 있었습니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
powerpc/syscall: Fix syscall skip handling for seccomp and ptrace
After enabling GENERIC_ENTRY on PowerPC, syscall_enter_from_user_mode()
returns -1 as a sentinel to signal that seccomp or ptrace has intercepted
the syscall and already set a return value via syscall_set_return_value().
system_call_exception() was not handling this sentinel, and since -1UL
is >= NR_syscalls, the code fell into the out-of-range path and returned
-ENOSYS, overwriting the errno already placed in regs->gpr[3].
The naive fix of checking r0 == -1L before the NR_syscalls bounds check
is ambiguous: a user legitimately calling syscall(-1) also produces r0 ==
-1L, and a tracer intercepting such a call would have its injected return
value silently discarded.
Fix this by introducing a thread flag that is set whenever
syscall_set_return_value() explicitly updates the return value. In
system_call_exception(), check and clear this flag before dispatching
the syscall, and return the preset value directly when it is present.
This ensures that an explicitly supplied return value always suppresses
syscall execution, regardless of the syscall number.
This handles all seccomp actions correctly:
- SECCOMP_RET_ERRNO, SECCOMP_RET_TRACE (no tracer), SECCOMP_RET_USER_NOTIF:
all call syscall_set_return_value(), flag is set, injected value returned.
- SECCOMP_RET_TRAP, SECCOMP_RET_KILL: call syscall_rollback() and deliver
a signal; flag is not set, but the process is dying so the return value
is irrelevant.
The fix covers both ppc32 and ppc64 with no #ifdefs.
📍 영향받는 시스템
GENERIC_ENTRY가 활성화된 PowerPC(ppc32, ppc64) 아키텍처 기반 Linux 커널
⚔️ 공격 벡터
직접적인 공격보다는 보안 필터링(seccomp/ptrace)의 논리적 오류를 이용해 시스템 콜의 반환 값을 조작하거나 우회할 가능성이 있음
🛡️ 대응 방법
해당 패치가 적용된 최신 버전의 Linux 커널로 업데이트
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 수정된 패치 버전 이후인지 확인