From nobody Sat May 07 10:02:37 2022 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 2E83B1AC3114 for ; Sat, 7 May 2022 10:02:38 +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 4KwNK96SZXz4mBb for ; Sat, 7 May 2022 10:02:37 +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 BDC6F66ED for ; Sat, 7 May 2022 10:02:37 +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 247A2bKk012817 for ; Sat, 7 May 2022 10:02:37 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 247A2bXc012816 for bugs@FreeBSD.org; Sat, 7 May 2022 10:02:37 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 263836] panic or hang in taste call to ffs_sbget() if not an FFS superblock Date: Sat, 07 May 2022 10:02:37 +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: Unspecified 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 ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=freebsd.org; s=dkim; t=1651917757; 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=msH21M9TK6bGFKYZwccQzh82SSJNdgoxDNJHfpneb/k=; b=rAhQHi/1ytDEw0Iz5gxgzvn9gFS0r4k+Wm2ablLbtjYC1SPFE7y9ClKTUM4vTtPcyLojro DGzXfW2xEimL3cbGZPU9pFwDfPCzR4kTAvZC4c7BcCvzTWeW0djnZ9vRbmJ6ai5WTsK/O4 QLqvyfzJtjgkuzy4OkSopw+AWHR9XrM01a6z+inoRHg7h5GJn89hZz16VyC+29LtmYv8Bl Uj3CH8++Xd3Grs5X7S8C586e8QALfJhqmsO8DhL0E3gHSdsnD4RIvlX0Bok0pl48WnptMY 0oQOCevm6a2T0aB14a20gneEuvthCrm3gmLeEMcKCMPuS/MBoYVhNosqqueJag== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651917757; a=rsa-sha256; cv=none; b=Q/LqTiITjVZJyAb20UiqZfm5KHClpEZ7SEBJEC/RQfBmsMQCL6/0VX5LmCDPddOWUA3HPJ NjNhdxuryPfZOH9VR6WZAbNnq2Ew28OoMbvR7yA4uXq5ApJJzKMFkPK5eWQhTXp12wZ1cr 5TSzcjR0n7SlurV81XfjMg7QvI6ajz1g8zC63tACSiy9/9AIZV+iMA2e3ibiy6Vf4W5+c6 qOUYR8AUlaKpLpCDRYUt62oND8wgdwem/mgMtVyFRIIGBENqyRBYLcru+WTAExbl6uImRd Jm66zIbZR43SUQtGOGLxTD/1pXoWxeBX0RaVuDy+jS0KbGAxqDtzG1X4ObqqUA== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D263836 Bug ID: 263836 Summary: panic or hang in taste call to ffs_sbget() if not an FFS superblock Product: Base System Version: Unspecified Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: rtm@lcs.mit.edu Created attachment 233786 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D233786&action= =3Dedit disk image that causes taste panic in ffs_bget() due to bad fs_fsize When tasting, ffs_bget() tries to read the superblock summary information, calculating the read size from fs_bsize and fs_fsize without checking that they are plausible for FFS. This can cause an INVARIANTS kernel to panic, and a non-INVARIANTS kernel to hang. size =3D fs->fs_bsize; if (i + fs->fs_frag > blks) size =3D (blks - i) * fs->fs_fsize; buf =3D NULL; error =3D (*readfunc)(devfd, dbtob(fsbtodb(fs, fs->fs_csaddr + i)), (void **)&buf, size); This may be a duplicate of https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D244342 I've attached a demo disk image, containing garbage, with 49152 at the place where fs_bsize would be if it were an FFS file system, and -268744963 for fs_fsize. # uname -a FreeBSD 14.0-CURRENT FreeBSD 14.0-CURRENT #215 main-n250917-440e36e68279-dirty: Sat May 7 05:32:48 EDT 2022=20=20=20=20 rtm@xxx:/usr/obj/usr/rtm/symbsd/src/riscv.riscv64/sys/RTM riscv # mdconfig -f taste6a.img panic: g_read_data(): invalid length -268744963 cpuid =3D 0 time =3D 1651872649 KDB: stack backtrace: db_trace_self() at db_trace_self db_trace_self_wrapper() at db_trace_self_wrapper+0x38 kdb_backtrace() at kdb_backtrace+0x2c vpanic() at vpanic+0x16e panic() at panic+0x2a g_read_data() at g_read_data+0xd8 g_use_g_read_data() at g_use_g_read_data+0x26 ffs_sbget() at ffs_sbget+0x1ee g_label_ufs_taste_common() at g_label_ufs_taste_common+0x6c g_label_ufs_id_taste() at g_label_ufs_id_taste+0xe g_label_taste() at g_label_taste+0x198 g_new_provider_event() at g_new_provider_event+0xb8 one_event() at one_event+0x106 g_run_events() at g_run_events+0x8a g_event_procbody() at g_event_procbody+0x56 fork_exit() at fork_exit+0x80 fork_trampoline() at fork_trampoline+0xa KDB: enter: panic [ thread pid 13 tid 100017 ] Stopped at breakpoint+0xa: c.ldsp s0,0(sp) db> --=20 You are receiving this mail because: You are the assignee for the bug.=