From nobody Sat Apr 01 21:11:16 2023 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 4PpqZr6Tqpz43MHx for ; Sat, 1 Apr 2023 21:11:16 +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 4PpqZr5TNjz4SMY for ; Sat, 1 Apr 2023 21:11:16 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1680383476; 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=Py1gMXZIGmGZ6Up4f0fi09KbFn0s6ALi9oXVUBi+7JI=; b=HJPrd0oQ/1Kt6JfcEpoJ2cAyf7IFL+JnrzpQEeTx6iSnf7GBkDgVe389FjDxNldNxfvGlh kMEc3kKTj5hezZXIsUNL4YeS3olEqZAx1uxs99SmIHa5VRhGdCQa9dVegPknzjVqVcc3NP 79KrXDEvNhmqFZ524470Ekvy68VFBIvgKM3tnbZbdtxVmyylFGm3aXiSbjgHy7SlLw4IP2 pkQL+uj03f4Ba54IF28n1Nwx/tAGcCXzCnwo4uhb/V9Lddsa7KqQTJufXv6l11+vYGxSyT pm2U96ImQwkvcHd1ebKdZrmC7cdGGWDqCqG7SArLs+SivaCdh7hv5AgYo9pj8w== ARC-Authentication-Results: i=1; mx1.freebsd.org; none ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1680383476; a=rsa-sha256; cv=none; b=MDiy4l43P3SO0M1V12yrmHaErOMcqQZNuWp7XQPdPt9XZ6aUHR0anOGytrvl0HPTfGHywc cTJ94ke/tTWZkfd56TGeHJfcwz5tReKsbFj7doL/124q06h8YRG4EC0MietvugIK38Sq3n v3/lCGo9Lzxsk4vY5rYxc2Lyh9jShHx7sba2JmXDWASkNH55PHLtWGTWL7fpmzxvLv+zaR q2JbDJddYWiaFuz+/JHBWzkj4Dcgm+KnOPSVhQpIlmYQ4XJA60Ao295intoO/NNrrzGiwf 1+EAwM2FODJ3e7Hp9Ujk1rFPtCQYssakBN4g4KpHcrQio1eVcqCWRb6abUtXWw== 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 4PpqZr4YMvzrGv for ; Sat, 1 Apr 2023 21:11:16 +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 331LBGfA074093 for ; Sat, 1 Apr 2023 21:11:16 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 331LBGr2074092 for bugs@FreeBSD.org; Sat, 1 Apr 2023 21:11:16 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 270587] FAT12 with non-default parameters panics on mount Date: Sat, 01 Apr 2023 21:11:16 +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: se@FreeBSD.org 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 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=3D270587 Bug ID: 270587 Summary: FAT12 with non-default parameters panics on mount Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: se@FreeBSD.org The following sequence of commands leads to a panic due to a page fault in = the kernel: # mdconfig -s 64m md0 # newfs_msdos -F 12 -n 2 -e 128 -S 4096 -c 2 md0 newfs_msdos: cannot get number of sectors per track: Operation not supported newfs_msdos: cannot get number of heads: Operation not supported newfs_msdos: debug: cls=3D4084 x1=3D6 SecPerClust=3D2 newfs_msdos: warning: FAT type limits file system to 8175 sectors /dev/md0: 8168 sectors in 4084 FAT12 clusters (8192 bytes/cluster) BytesPerSec=3D4096 SecPerClust=3D2 ResSectors=3D1 FATs=3D2 RootDirEnts=3D12= 8 Sectors=3D8175 Media=3D0xf0 FATsecs=3D2 SecPerTrack=3D63 Heads=3D1 HiddenSecs=3D0 # mount -t msdosfs /dev/md0 /mnt The cause is the fact that a FAT entry crosses the boundary between the 1st= and 2nd FAT sector (byte offset 4095 is the last byte in the 1st sector and 4096 the first byte in the 2nd sector). This reads 1 byte beyond the page alloca= ted for the 1st sector. There are other issues, with less drastic consequences, e.g.: # newfs_msdos -F 12 -s 64m -n 2 -e 1024 -S 512 newfs_msdos: cannot get number of sectors per track: Operation not supported newfs_msdos: cannot get number of heads: Operation not supported newfs_msdos: warning: FAT type limits file system to 32768 sectors /dev/md1: 32672 sectors in 4084 FAT12 clusters (4096 bytes/cluster) BytesPerSec=3D512 SecPerClust=3D8 ResSectors=3D1 FATs=3D2 RootDirEnts=3D1024 Sectors=3D32768 Media=3D0xf0 FATsecs=3D12 SecPerTrack=3D63 Heads=3D16 Hidde= nSecs=3D0 # df -i /mnt Filesystem 1K-blocks Used Avail Capacity iused ifree %iused Mounted on /dev/md1 12288 8 12280 0% 0 1024 0% /mnt # mount -t msdosfs /dev/md0 /mnt # ls -lsd /mnt 32 drwxr-xr-x 1 root wheel 32768 Jan 1 1980 /mnt/ # dd if=3D/dev/zero of=3D/mnt/TEST.DAT bs=3D1k count=3D12288 dd: /mnt/TEST.DAT: No space left on device 12281+0 records in 12280+0 records out 12574720 bytes transferred in 0.013075 secs (961691614 bytes/sec) This file system has 4084 clusters of 4 KB (or roughly 16 MB), but df shows= the total size of the data area as only 12288 KB (12 MB), but trying to write a file of size 12 MB results in an error since apparently 8 KB have already b= een allocated (for the FAT sectors that actually exist outside the data area), = and "ls -lask /mnt" shows a "." entry with an apparent size of 32 KB (which also are allocated outside the data area). --=20 You are receiving this mail because: You are the assignee for the bug.=