🇰🇷 한글 설명
Linux 커널의 hugetlbfs 파일시스템에서 hugetlbfs_parse_param() 함수가 param->string을 검사하지 않고 역참조하여 널 포인터 역참조가 발생하는 문제입니다. 'size=,' 같은 잘못된 마운트 파라미터로 커널 패닉 또는 서비스 거부가 유발될 수 있으며, 이 패치는 해당 문자열 포인터에 대한 검사를 추가합니다.
💡 쉬운 설명
잘못된 형식의 마운트 옵션을 입력하면 리눅스 커널이 비정상 종료될 수 있는 결함입니다. 수정 패치를 적용하면 이 문제가 해결됩니다.
🇺🇸 원문 (English)
In the Linux kernel, the following vulnerability has been resolved:
hugetlbfs: fix null-ptr-deref in hugetlbfs_parse_param()
Syzkaller reports a null-ptr-deref bug as follows:
======================================================
KASAN: null-ptr-deref in range [0x0000000000000000-0x0000000000000007]
RIP: 0010:hugetlbfs_parse_param+0x1dd/0x8e0 fs/hugetlbfs/inode.c:1380
[...]
Call Trace:
<TASK>
vfs_parse_fs_param fs/fs_context.c:148 [inline]
vfs_parse_fs_param+0x1f9/0x3c0 fs/fs_context.c:129
vfs_parse_fs_string+0xdb/0x170 fs/fs_context.c:191
generic_parse_monolithic+0x16f/0x1f0 fs/fs_context.c:231
do_new_mount fs/namespace.c:3036 [inline]
path_mount+0x12de/0x1e20 fs/namespace.c:3370
do_mount fs/namespace.c:3383 [inline]
__do_sys_mount fs/namespace.c:3591 [inline]
__se_sys_mount fs/namespace.c:3568 [inline]
__x64_sys_mount+0x27f/0x300 fs/namespace.c:3568
do_syscall_x64 arch/x86/entry/common.c:50 [inline]
do_syscall_64+0x35/0xb0 arch/x86/entry/common.c:80
entry_SYSCALL_64_after_hwframe+0x63/0xcd
[...]
</TASK>
======================================================
According to commit "vfs: parse: deal with zero length string value",
kernel will set the param->string to null pointer in vfs_parse_fs_string()
if fs string has zero length.
Yet the problem is that, hugetlbfs_parse_param() will dereference the
param->string, without checking whether it is a null pointer. To be more
specific, if hugetlbfs_parse_param() parses an illegal mount parameter,
such as "size=,", kernel will constructs struct fs_parameter with null
pointer in vfs_parse_fs_string(), then passes this struct fs_parameter to
hugetlbfs_parse_param(), which triggers the above null-ptr-deref bug.
This patch solves it by adding sanity check on param->string
in hugetlbfs_parse_param().
📍 영향받는 시스템
패치 이전 Linux 커널을 사용하는 hugetlbfs 지원 시스템 (정확한 영향 버전은 해당 수정 커밋 기준으로 확인 필요)
⚔️ 공격 벡터
로컬 사용자가 hugetlbfs에 'size=,' 같은 잘못된 마운트 파라미터를 전달하는 mount 시스콜을 호출하여 널 포인터 역참조를 유발
🛡️ 대응 방법
배포판 제공 최신 커널로 업데이트하거나 CVE-2022-50334 관련 수정 커밋을 포함한 커널을 설치 후 재부팅
🔧 검증 코드
커널 버전을 확인하고 hugetlbfs 지원 여부를 보여줍니다; 버전이 해당 배포판의 수정된 패키지 버전 이전이면 취약할 가능성이 있으므로 배포판 보안 공지와 대조하세요.
uname -r && grep -i hugetlb /proc/filesystems 2>/dev/null