From nobody Tue Oct 12 19:00:59 2021 X-Original-To: bugs@mlmmj.nyi.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mlmmj.nyi.freebsd.org (Postfix) with ESMTP id C8CC112D83E7 for ; Tue, 12 Oct 2021 19:00:59 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.nyi.freebsd.org (mxrelay.nyi.freebsd.org [IPv6:2610:1c1:1:606c::19:3]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256 client-signature RSA-PSS (4096 bits) client-digest SHA256) (Client CN "mxrelay.nyi.freebsd.org", Issuer "R3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 4HTQ3v4rWFz4V6H for ; Tue, 12 Oct 2021 19:00:59 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2610:1c1:1:606c::50:1d]) (using TLSv1.3 with cipher TLS_AES_256_GCM_SHA384 (256/256 bits) key-exchange X25519 server-signature RSA-PSS (4096 bits) server-digest SHA256) (Client did not present a certificate) by mxrelay.nyi.freebsd.org (Postfix) with ESMTPS id 867E719D8F for ; Tue, 12 Oct 2021 19:00:59 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.5]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id 19CJ0xWZ071772 for ; Tue, 12 Oct 2021 19:00:59 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 19CJ0xIA071771 for bugs@FreeBSD.org; Tue, 12 Oct 2021 19:00:59 GMT (envelope-from bugzilla-noreply@freebsd.org) X-Authentication-Warning: kenobi.freebsd.org: www set sender to bugzilla-noreply@freebsd.org using -f From: bugzilla-noreply@freebsd.org To: bugs@FreeBSD.org Subject: [Bug 259112] A damaged ext3 inode with bad extents can cause a kernel page fault. Date: Tue, 12 Oct 2021 19:00:59 +0000 X-Bugzilla-Reason: AssignedTo X-Bugzilla-Type: new X-Bugzilla-Watch-Reason: None X-Bugzilla-Product: Base System X-Bugzilla-Component: kern X-Bugzilla-Version: CURRENT X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Only Me X-Bugzilla-Who: rtm@lcs.mit.edu X-Bugzilla-Status: New X-Bugzilla-Resolution: X-Bugzilla-Priority: --- X-Bugzilla-Assigned-To: bugs@FreeBSD.org X-Bugzilla-Flags: X-Bugzilla-Changed-Fields: bug_id short_desc product version rep_platform op_sys bug_status bug_severity priority component assigned_to reporter attachments.created Message-ID: Content-Type: text/plain; charset="UTF-8" Content-Transfer-Encoding: quoted-printable X-Bugzilla-URL: https://bugs.freebsd.org/bugzilla/ Auto-Submitted: auto-generated List-Id: Bug reports List-Archive: https://lists.freebsd.org/archives/freebsd-bugs List-Help: List-Post: List-Subscribe: List-Unsubscribe: Sender: owner-freebsd-bugs@freebsd.org MIME-Version: 1.0 X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D259112 Bug ID: 259112 Summary: A damaged ext3 inode with bad extents can cause a kernel page fault. Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: rtm@lcs.mit.edu Created attachment 228634 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D228634&action= =3Dedit A damaged ext3 file system that causes a kernel page fault. If a damaged ext3 inode claims to have extents with depth greater than 5, ext4_ext_find_extent() &c can run off the end of the paths array. ext4_ext_check_header() should probably check eh_depth. I've attached a demo: # uname -a FreeBSD stock14 14.0-CURRENT FreeBSD 14.0-CURRENT #0 main-n248636-d20e9e02d= b3: Thu Aug 12 05:47:18 UTC 2021=20=20=20=20 root@releng1.nyi.freebsd.org:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 # gunzip ext310.img.gz=20 # mdconfig -f ext310.img # mount -t ext2fs -o ro /dev/md0 /mnt # cp /mnt/a /dev/null Fatal trap 12: page fault while in kernel mode cpuid =3D 0; apic id =3D 00 fault virtual address =3D 0xffff80403fffc000 fault code =3D supervisor read data, page not present instruction pointer =3D 0x20:0xffffffff810c2d23 stack pointer =3D 0x28:0xfffffe009bba7350 frame pointer =3D 0x28:0xfffffe009bba7350 code segment =3D base 0x0, limit 0xfffff, type 0x1b =3D DPL 0, pres 1, long 1, def32 0, gran 1 processor eflags =3D interrupt enabled, resume, IOPL =3D 0 current process =3D 871 (cp) trap number =3D 12 panic: page fault cpuid =3D 0 time =3D 1634064958 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe009bba6= ff0 vpanic() at vpanic+0x187/frame 0xfffffe009bba7050 panic() at panic+0x43/frame 0xfffffe009bba70b0 trap_fatal() at trap_fatal+0x387/frame 0xfffffe009bba7110 trap_pfault() at trap_pfault+0x99/frame 0xfffffe009bba7170 trap() at trap+0x2a7/frame 0xfffffe009bba7280 calltrap() at calltrap+0x8/frame 0xfffffe009bba7280 --- trap 0xc, rip =3D 0xffffffff810c2d23, rsp =3D 0xfffffe009bba7350, rbp = =3D 0xfffffe009bba7350 --- pmap_kextract() at pmap_kextract+0x1d3/frame 0xfffffe009bba7350 free() at free+0x52/frame 0xfffffe009bba7380 ext4_ext_find_extent() at ext4_ext_find_extent+0x45f/frame 0xfffffe009bba74= 00 ext4_bmapext() at ext4_bmapext+0x97/frame 0xfffffe009bba7460 ext2_strategy() at ext2_strategy+0x5b/frame 0xfffffe009bba7490 bufstrategy() at bufstrategy+0x3e/frame 0xfffffe009bba74c0 breadn_flags() at breadn_flags+0x1a3/frame 0xfffffe009bba7530 ext2_blkatoff() at ext2_blkatoff+0x56/frame 0xfffffe009bba75b0 ext2_lookup_ino() at ext2_lookup_ino+0x2af/frame 0xfffffe009bba76c0 vfs_cache_lookup() at vfs_cache_lookup+0xa6/frame 0xfffffe009bba7710 lookup() at lookup+0x4a1/frame 0xfffffe009bba77b0 namei() at namei+0x358/frame 0xfffffe009bba7870 kern_statat() at kern_statat+0x12d/frame 0xfffffe009bba79c0 sys_fstatat() at sys_fstatat+0x2f/frame 0xfffffe009bba7ac0 amd64_syscall() at amd64_syscall+0x12e/frame 0xfffffe009bba7bf0 fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe009bba7bf0 --=20 You are receiving this mail because: You are the assignee for the bug.=