From nobody Sat May 07 20:55:59 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 C36F71AB8139 for ; Sat, 7 May 2022 20:55: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 4Kwfq33XM4z3Pxm for ; Sat, 7 May 2022 20:55: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 559F517BBC for ; Sat, 7 May 2022 20:55: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 247KtxB4063117 for ; Sat, 7 May 2022 20:55:59 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 247Ktxjl063116 for bugs@FreeBSD.org; Sat, 7 May 2022 20:55: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 263853] jmicron RAID taste code can panic if conf is garbage Date: Sat, 07 May 2022 20:55: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: 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=1651956959; 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=4UTLM+FUR7fQ3H1bOWLYAbTpUWoHYiZ1oiYmjIVFkNs=; b=itRqshLJoOICQmOga8fXvFoTMhoR6UBQx5lGG935uAihO3Iwu6ngICP79fW8neLvP1GmE2 muKunejtKScQNlPGv/sgxwQkqoNAW19TZM85nr9SLULFWIv+aDlPiwr0k5OUQtCCbJciDf FnYhJ3UKn9UKsmB/00tQ2fcg+yqX+eUhgMRh0tRj0Wg/d9/Xa1eART47nRl9nuz1CDoKCk qcZJ/CWwOnCLSl7YlWdGJHJ0dpD2cXNGXtWKxmWhUYuohUj8Zr+KrcQUlXjHBhXxwXWASV lERN5Z1amKP5Bmrv9+d82XgcbDQWBnN1a5iXr6/HDvpqp+ZoNMVvFM677goKIg== ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1651956959; a=rsa-sha256; cv=none; b=nfIIKu11E3CWqDOfR7X8jzfuR4SqOqnVb2PJSM362ABZyWsKi20O+DoE61eHyfr6YYaVMm 0UJC9OYyCfAHjccinHYx3054QFBe5B/+fue5iYnUSTQRSFe+BoJ+j/HFEFnmJpmdqqX0He nSSPUXe4fGsV1lTTvc+NwrGK79xgUcfsg3XmS7mJQTGjlvhs6xEV3fPwSL4W2GZkv2U2jQ YhD1TbgsyLTN0F/iAVjrq4hyiAdnX1NaXckfh+Ma9KL/V8pOwA5qmOK18/UMN6jsOwafUc VJ71uiLC29cpA3cpz5tiK47F9MV6ht+3VM/lCJ69ZduNtO1SQufqPcPlUbAFFg== ARC-Authentication-Results: i=1; mx1.freebsd.org; none X-ThisMailContainsUnwantedMimeParts: N https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D263853 Bug ID: 263853 Summary: jmicron RAID taste code can panic if conf is garbage 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 233800 --> https://bugs.freebsd.org/bugzilla/attachment.cgi?id=3D233800&action= =3Dedit disk image that causes jmicron taste code to panic During tasting, if the last sector of a newly attached drive looke enough like a jmicron_raid_conf but meta->disks[] contains no disks, and meta->spare[] contains one disk, g_raid_md_jmicron_new_disk() may call g_raid_md_jmicron_start() anyway, leading to a panic. I've attached a demo disk image, which causes this code in g_raid_md_jmicron_new_disk() to execute with disks_present =3D 1 (the disk being tasted), total_disks =3D zero (from meta->disks[]), and total_spare() =3D one (from meta->spare[]): /* If we collected all needed disks - start array. */ if (mdi->mdio_disks_present =3D=3D mdi->mdio_total_disks + jmicron_meta_total_spare(mdi->mdio_meta)) g_raid_md_jmicron_start(sc); Mounting the demo disk image: # uname -a FreeBSD 14.0-CURRENT FreeBSD 14.0-CURRENT #219 main-n250919-29f81bc20825-dirty: Sat May 7 16:30:27 EDT 2022=20=20=20=20 rtm@xxx:/usr/obj/usr/rtm/symbsd/src/riscv.riscv64/sys/RTM riscv # mdconfig -f taste8a.img GEOM_RAID: JMicron-0000000: Array JMicron-0000000 created. GEOM_RAID: JMicron-0000000: No transformation module found for =C3=AF=C2=BF= =C2=BD=C3=AF=C2=BF=C2=BD. GEOM_RAID: JMicron-0000000: Volume =C3=AF=C2=BF=C2=BD=C3=AF=C2=BF=C2=BD sta= te changed from STARTING to UNSUPPORTED=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20= =20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20=20 panic: No disk at position 0! cpuid =3D 0 time =3D 1651920087 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_raid_md_jmicron_start_disk() at g_raid_md_jmicron_start_disk+0x350 g_raid_md_jmicron_start() at g_raid_md_jmicron_start+0x1c2 g_raid_md_jmicron_new_disk() at g_raid_md_jmicron_new_disk+0x110 g_raid_md_taste_jmicron() at g_raid_md_taste_jmicron+0x39a G_RAID_MD_TASTE() at G_RAID_MD_TASTE+0x5a g_raid_taste() at g_raid_taste+0x15c 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.=