From nobody Fri Mar 01 14:53:30 2024 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 4TmWLM1DHHz5CWhq for ; Fri, 1 Mar 2024 14:53:31 +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 4TmWLL6DBMz4D0q for ; Fri, 1 Mar 2024 14:53:30 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1709304810; a=rsa-sha256; cv=none; b=uLKvjkKD4w8CIFevXMRTG0Ng/hvUA/0IswNaTNn+TrDBj4RPWaD9ur9EiToTRI5VJexNuM 9EAUtpqBdY8T4COtw8Lx2RmFpVHlurw24QOBlXU8pMPKA/UoCvA/SoBG6l6PpMa8K0UdGU V7sQYSRiW0LQvmtiIJkDSIgXC0Spw1UCqGk8LM8C0T64wF8JtfeC//fDsQX1CD4JvSevwV spS6+tJGj3KaHkS5cH/xNOuad74cyM1MOkh05h34D+96/qlD9kVw2YMmngmD2A6QhX17M0 mvTLMTKwKXLM2RTB+p3WZppe3BsM8aGE9YYP2RKsau/YeTlPpi9mh2Pyuww7Ug== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1709304810; h=from:from:reply-to:subject:subject:date:date:message-id:message-id: to:to:cc:mime-version:mime-version:content-type:content-type: content-transfer-encoding:content-transfer-encoding; bh=DdvPp4nhaic3p0cRhy/2LuQBcwTfKSugqTCjv0S5Y/Y=; b=l0Al9UcX4ayBanYr3zxHiVLLHLUmilFJU/c6fPSsD8ArLpW4P7CYvSzLIRqq0eGZAsPD8s pB3BOyMVjgpQBRHun7TIXeduyEt4t9ZSC38JVu+TNuK7QPccicGqSAbUZLf8XcHr1Zpxxg CHptNN4yQz0GDA9YqYd/iPUKF/gYVB3ttJC4wYczRXZnz9OP2ADpSBeds0Y6NeImpeRDIn CBUmJuPavXw1/VFhxQETcRP+j8OKxxO+dgfg8h6KhXzC9zZBP+ItPBuZOtkftOd9qlaR13 vWeY5ucMXM0Bswk9Ajo6DrZ6fv5jPDOyrS/jyc8Z2sgtIVCOMtDRn2A5sV3iCA== 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 4TmWLL5r4nzW2G for ; Fri, 1 Mar 2024 14:53:30 +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 421ErU4a042343 for ; Fri, 1 Mar 2024 14:53:30 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 421ErUGw042342 for bugs@FreeBSD.org; Fri, 1 Mar 2024 14:53:30 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 277414] FAT SecPerClust=128 can cause crash Date: Fri, 01 Mar 2024 14:53:30 +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 Some People 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 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D277414 Bug ID: 277414 Summary: FAT SecPerClust=3D128 can cause crash Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: rtm@lcs.mit.edu Created attachment 248848 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D248848&action= =3Dedit FAT file system image with SecPerClust=3D128, causes crash The attached FAT image specifies a SecPerClust of 128. This causes readep() in msdosfs_lookup.c to call bread() with size of 65536. getblkx() calculates a maxsize that's somewhat larger, 69120: maxsize =3D size + (offset & PAGE_MASK); and bufkva_alloc() on an INVARIANTS kernel thinks that's too big: KASSERT(maxsize <=3D maxbcachebuf, ("bufkva_alloc kva too large %d %u", maxsize, maxbcachebuf)); On a non-INVARIANTS kernel, something gets corrupted and the system eventually crashes. # uname -a FreeBSD stock14 15.0-CURRENT FreeBSD 15.0-CURRENT #18 main-n268497-3562b7b1eb80: Fri Feb 23 07:08:37 AST 2024=20=20=20=20 root@stock14:/usr/obj/usr/src/amd64.amd64/sys/GENERIC amd64 # cp fat3d.img junk # mdconfig -f junk # mount_msdosfs /dev/md0 /mnt # cat < /mnt/d/y > /dev/null panic: bufkva_alloc kva too large 81920 65536 cpuid =3D 8 time =3D 1709302796 KDB: stack backtrace: db_trace_self_wrapper() at db_trace_self_wrapper+0x2b/frame 0xfffffe012559c= 2f0 vpanic() at vpanic+0x135/frame 0xfffffe012559c420 panic() at panic+0x43/frame 0xfffffe012559c480 bufkva_alloc() at bufkva_alloc+0x13c/frame 0xfffffe012559c4c0 getnewbuf() at getnewbuf+0x4b1/frame 0xfffffe012559c530 getblkx() at getblkx+0x655/frame 0xfffffe012559c5f0 breadn_flags() at breadn_flags+0x44/frame 0xfffffe012559c660 readep() at readep+0xc1/frame 0xfffffe012559c6d0 deget() at deget+0x341/frame 0xfffffe012559c770 msdosfs_lookup_ino() at msdosfs_lookup_ino+0xa9d/frame 0xfffffe012559c9c0 vfs_cache_lookup() at vfs_cache_lookup+0xa6/frame 0xfffffe012559ca10 vfs_lookup() at vfs_lookup+0x457/frame 0xfffffe012559caa0 namei() at namei+0x2d1/frame 0xfffffe012559cb00 vn_open_cred() at vn_open_cred+0x505/frame 0xfffffe012559cc80 openatfp() at openatfp+0x287/frame 0xfffffe012559cdd0 sys_openat() at sys_openat+0x45/frame 0xfffffe012559ce00 amd64_syscall() at amd64_syscall+0x153/frame 0xfffffe012559cf30 fast_syscall_common() at fast_syscall_common+0xf8/frame 0xfffffe012559cf30 --- syscall (499, FreeBSD ELF64, openat), rip =3D 0x1462c90d3fa, rsp =3D 0x14629bb7308, rbp =3D 0x14629bb73e0 --- --=20 You are receiving this mail because: You are the assignee for the bug.=