From nobody Fri Sep 25 18:21:16 2026 Received: from m16.mail.163.com (m16.mail.163.com [117.135.210.5]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 468CF582B8A for ; Wed, 9 Sep 2026 13:34:17 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=117.135.210.5 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788960862; cv=none; b=KgWtOIY+79tns3utWT9p4/qNQwE6GXFn2Qz5Y6PtI+jEsTw3dZ0KzkTju9+vXLEcG2d8n0f+Pet8qQb/Ri1HvITsWsQA5J7DvjIM0zjezhO6vpFlMwo+ZH4E319cbSLfsq9YPK0DbCQmxchFnWPci8Vam/ipz8wp968tRx19i1M= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1788960862; c=relaxed/simple; bh=4su4DqQYMnVIN5ctUhNBs87iw5tUTSE0DpJpve2mjgM=; h=Date:From:To:Cc:Subject:Content-Type:MIME-Version:Message-ID; b=Ivt9BeBd9MdEzaNm1cSEuD0OkRwzJDoQGPug+w9TKWrsdaDQ3WyVMMahXFTxBn5UwZ7BUQiWvmF0wAcw6cC5jZUxCSSs04vRGON9hkYntPjhyeA99J0uSbnDbd6WfOwj2qE49YnNxhPhZFnlBOauna3RQ13j0I8no63lSci1+l8= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com; spf=pass smtp.mailfrom=163.com; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b=hxDamS79; arc=none smtp.client-ip=117.135.210.5 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=163.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=163.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (1024-bit key) header.d=163.com header.i=@163.com header.b="hxDamS79" DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=Date:From:To:Subject:Content-Type:MIME-Version: Message-ID; bh=4su4DqQYMnVIN5ctUhNBs87iw5tUTSE0DpJpve2mjgM=; b=h xDamS79YF1fJgpFnCy9h6D0b1fLtT4bFtAXvmWsLjCAf7fm5aLZpYIcEszR2VoFo WAsOUxebUbWM4KQThCGpyk0Xd+FFV1KBX9ofe+B+mGfSBlq0Q+ntBQps44QvL1YM EPy4fE3kHRMyMB84Z/bmykkyJ+BKPEWQ2zSDViUG2c= Date: Wed, 9 Sep 2026 21:33:58 +0800 (CST) From: Shawn To: almaz.alexandrovich@paragon-software.com Cc: ntfs3@lists.linux.dev, linux-kernel@vger.kernel.org Subject: [PATCH] fs/ntfs3: reject short restart table entries X-Priority: 3 X-Mailer: Coremail Webmail Server Version 2023.4-cmXT build 20260511(2e539873) Copyright (c) 2002-2026 www.mailtech.cn 163com X-NTES-SC: AL_Qu2TCvWdv0Ao7iGcY+kdmEgXg+s9XsSysvog1YZXc+sEpgL39SAKRXtcJmHHycOKFhyotSCKbT1r68FafodJA/+iCU/1lvn7DZlrehsoXA== Content-Transfer-Encoding: quoted-printable Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Message-ID: <72bf4f2c.9eb3.1a08660120d.Coremail.shawnq1@163.com> X-Coremail-Locale: zh_CN X-CM-TRANSID: ZCgvCgD3Px1GYKFqw1xDAA--.9709W X-CM-SenderInfo: pvkd40jtr6il2tof0z/xtbCzwYsOmqhYEbXmAAA39 X-Coremail-Antispam: 1U5529EdanIXcx71UUUUU7vcSsGvfC2KfnxnUU== Content-Type: text/plain; charset="utf-8" Hello, check_rstbl() in fs/ntfs3/fslog.c accepts a restart-table entry size smaller than the four bytes it unconditionally reads for every entry. A crafted NT= FS $LogFile can therefore cause a kernel heap out-of-bounds read while mountin= g a read-only filesystem image. This is a manually constructed reproducer and does not use syzkaller. HEAD commit: 940de590b839f71d6dc846160534bf202401b8b7 git tree: upstream Linux checkout, local branch master source version: Linux 7.3.0-rc1-00101-g940de590b839 compiler: gcc (Ubuntu 11.4.0-1ubuntu1~22.04.3), GNU ld 2.38 console output: https://gist.githubusercontent.com/shaos26/a7382d96d2a86c51c279fd994d9a2a1c= /raw/6dce660d99e244275dcc87ef79391e10ab66b9f3/console-output.txt kernel config: https://gist.githubusercontent.com/shaos26/a7382d96d2a86c51c279fd994d9a2a1c= /raw/6dce660d99e244275dcc87ef79391e10ab66b9f3/kernel-config.txt reproducer: https://gist.githubusercontent.com/shaos26/a7382d96d2a86c51c279fd994d9a2a1c= /raw/6dce660d99e244275dcc87ef79391e10ab66b9f3/poc.c The experiment uses QEMU TCG only. No hardware, kernel module, kprobe, address leak, or modified kernel code is required for the trigger. To reproduce, create a clean NTFS image on the host and apply the on-disk l= og mutation with poc.c: cc -O2 -Wall -Wextra -o ntfs3_make_restart poc.c truncate -s 32M ntfs3-candidate-base.img mkntfs -F -Q ntfs3-candidate-base.img cp ntfs3-candidate-base.img ntfs3-candidate.img ./ntfs3_make_restart ntfs3-candidate.img --candidate Boot the unpatched KASAN kernel in a disposable QEMU guest, pass ntfs3-candidate.img as a read-only second virtio disk, and run: mount -t proc proc /proc mount -t tmpfs tmpfs /tmp mkdir -p /tmp/ntfs mount -o ro -t ntfs3 /dev/vdb /tmp/ntfs Use the following QEMU command for the disposable guest: qemu-img create -f qcow2 -F raw \ -b /tmp/ntfs3-repro-root.qcow2 qemu-system-x86_64 -m 2G -smp 1 \ -kernel /arch/x86/boot/bzImage \ -append 'quiet loglevel=3D1 acpi=3Doff console=3DttyS0 root=3D/dev/vd= a1 init=3D/bin/sh' \ -drive file=3D/tmp/ntfs3-repro-root.qcow2,format=3Dqcow2,if=3Dvirtio \ -drive file=3D/tmp/ntfs3-candidate.img,format=3Draw,if=3Dvirtio,reado= nly=3Don \ -nographic -monitor none -machine pc -no-reboot \ -virtfs local,path=3D,mount_tag=3Dresearch,security_mo= del=3Dnone Replace , , and with local paths. The second virtio disk is /dev/vdb in the guest. The vulnerable kernel reports: BUG: KASAN: slab-out-of-bounds in log_replay+0x6fc8/0xf290 Read of size 4 at addr ffff88802a5cfec4 by task mount/4914 Call Trace: log_replay ntfs_loadlog_and_replay ntfs_fill_super get_tree_bdev_flags vfs_get_tree path_mount __x64_sys_mount The buggy address belongs to the cache kmalloc-64 of size 64 The buggy address is located 4 bytes to the right of allocated 64-byte region The access is reached through the normal mount path: mount(2) -> ntfs_fill_super() -> ntfs_loadlog_and_replay() -> log_replay() -> read_log_rec_lcb() -> find_log_rec() -> check_rstbl() -> 4-byte out-of-bounds read The crafted DPT restart table has these relevant fields: client_data_len =3D 0x40 restart-table bytes =3D 0x20 restart-table size =3D 1 restart-table used =3D 8 restart-table total =3D 8 entries =3D 0xff x 8 check_rstbl() computes: ts =3D 1 * 8 + sizeof(struct RESTART_TABLE) =3D 0x20 The existing checks reject size =3D=3D 0, but accept size =3D=3D 1. The lo= op then advances by one byte while loading a __le32 from each entry. For the final entry, the four-byte load extends beyond the allocated kmalloc-64 object. This is distinct from the existing restart-table growth and DPT-specific page_lcns[] capacity checks: the generic check_rstbl() four-byte load happe= ns before those later validations. Impact and privilege boundary: This is a kernel heap out-of-bounds read caused by a malicious NTFS filesys= tem image. A read-only mount is sufficient; the image does not need to be writable and no special hardware is required. The current reproducer used root/CAP_SYS_ADMIN in the disposable guest to attach the block image and mo= unt it. An unprivileged direct mount path has not been established. No privil= ege escalation, information disclosure, or code execution has been demonstrated. Reject restart-table entry sizes smaller than the width used by the validat= ion loop: Fixes: b46acd6a6a62 ("fs/ntfs3: Add NTFS journal") Cc: stable@vger.kernel.org Signed-off-by: shaos --- fs/ntfs3/fslog.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/fs/ntfs3/fslog.c b/fs/ntfs3/fslog.c index ed50c1d0c23e3..c24a0713b8599 100644 --- a/fs/ntfs3/fslog.c +++ b/fs/ntfs3/fslog.c @@ -745,7 +745,7 @@ static bool check_rstbl(const struct RESTART_TABLE *rt,= size_t bytes) =20 ts =3D rsize * ne + sizeof(struct RESTART_TABLE); =20 - if (!rsize || rsize > bytes || + if (rsize < sizeof(__le32) || rsize > bytes || rsize + sizeof(struct RESTART_TABLE) > bytes || bytes < ts || le16_to_cpu(rt->total) > ne || ff > ts - sizeof(__le32) || lf > ts - sizeof(__le32) || Validation results: unfixed KASAN kernel: 1/1 trigger, KASAN slab-out-of-bounds unfixed stability: 20/20 mount/umount entries completed; one same-s= ite KASAN report fixed KASAN kernel: 1/1 A/B run, mount_exit=3D0, no KASAN/OOB/BUG r= eport The 20/20 figure is the successful mount/umount entry count, not 20 independent KASAN reports; KASAN suppresses repeated reports from the same site. Thanks, shaos