🇰🇷 한글 설명
Linux 커널의 powerpc/pseries 아키텍처에서 hcall 결과 버퍼의 유효성과 크기를 검증하지 못하는 취약점이 발견되었습니다. 이로 인해 잘못된 크기의 버퍼를 사용할 경우 런타임 시 스택 손상이 발생할 수 있습니다.
💡 쉬운 설명
컴퓨터 프로그램이 데이터를 담을 그릇(버퍼)을 준비할 때, 실제 데이터보다 너무 작은 그릇을 사용하면 데이터가 넘쳐서 시스템이 고장 날 수 있는 문제입니다. 이번 수정은 그릇의 크기가 적절한지 미리 확인하여 이런 사고를 방지합니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
powerpc/pseries: Enforce hcall result buffer validity and size
plpar_hcall(), plpar_hcall9(), and related functions expect callers to
provide valid result buffers of certain minimum size. Currently this
is communicated only through comments in the code and the compiler has
no idea.
For example, if I write a bug like this:
long retbuf[PLPAR_HCALL_BUFSIZE]; // should be PLPAR_HCALL9_BUFSIZE
plpar_hcall9(H_ALLOCATE_VAS_WINDOW, retbuf, ...);
This compiles with no diagnostics emitted, but likely results in stack
corruption at runtime when plpar_hcall9() stores results past the end
of the array. (To be clear this is a contrived example and I have not
found a real instance yet.)
To make this class of error less likely, we can use explicitly-sized
array parameters instead of pointers in the declarations for the hcall
APIs. When compiled with -Warray-bounds[1], the code above now
provokes a diagnostic like this:
error: array argument is too small;
is of size 32, callee requires at least 72 [-Werror,-Warray-bounds]
60 | plpar_hcall9(H_ALLOCATE_VAS_WINDOW, retbuf,
| ^ ~~~~~~
[1] Enabled for LLVM builds but not GCC for now. See commit
0da6e5fd6c37 ("gcc: disable '-Warray-bounds' for gcc-13 too") and
related changes.
📍 영향받는 시스템
Linux kernel (powerpc/pseries 아키텍처 사용 시스템)
⚔️ 공격 벡터
잘못된 크기의 버퍼를 사용하는 커널 함수 호출을 통한 스택 손상 유도
🛡️ 대응 방법
Linux 커널을 최신 보안 패치가 적용된 버전으로 업데이트하십시오.
🔧 검증 코드
출력된 커널 버전이 해당 취약점이 해결된 패치 버전 이후인지 확인하십시오.