From nobody Tue May 7 08:44:52 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 4VYX050BNWz5KMpT for ; Tue, 07 May 2024 08:44:53 +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 4VYX044HMyz4XpS for ; Tue, 7 May 2024 08:44:52 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) ARC-Seal: i=1; s=dkim; d=freebsd.org; t=1715071492; a=rsa-sha256; cv=none; b=Aj6fPbSbr9PDpmqESvPTOeO7dNeJ65Eu8ygmlzlf3u8OJUtVGtVibuJhOwW5j7ztDCWZg8 vg/pkzWT4QdR4ygpjcVXcO/N14N34mK9Ngt6Vr+qMkaB4RiEjgt25XR/LXzufT5A/L+pr2 GC4YuBaGFJvnoBjQ3EzkQhsATwVFR/g2TsL9LzqyJrtVG6ryEDzoZNkiIqoWl1pspcom9D K2X6ujkq/5sgY4cuzJAtVUeNWtbQEthmRel7JuimA599CApRDAuHIMkpOfYLXvSyV0MPPi kEDIgqzrsFJH5fSn7ZtxU3Bulw8B4eNPoieLlPJd+trG8evVo5NJ37JJIpVBdg== 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=1715071492; 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=lS4rsOll+68ILpWGkm0W5kMVYho2gwToIp9R9kwnPcg=; b=uTDS0XFxgmmX2upEgoUrH/vwiuNKuU5NeRWOkygdiYvHUdUaKEB9flrtbTWpiIccySqh0x 2F7vWMlXWiYwCJTNCS3cnyJFViqNbQjFgGe8MsjWKq+GVQ/TOnvVomi+rUi0dmDKVYD7EW W33nsFy+H/+SAe8uhxmofsuVBf2yiTA5QNuwBCNxXUhSYM9Ey/4KnVK/5n0kRoT5oR/LPz POVfoKGY+zexhQTQ3PTL1MBzKILledhLfkDaU2HgEkmW5995Ipk46hjT/N3SoXfEldIWDd lChGjJK36mIC998cOfCC5k5aVTCPe1y8ZcipkERjD3TyTmV7zi+S8YjsdcE17A== 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 4VYX043tdtzZTd for ; Tue, 7 May 2024 08:44:52 +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 4478iqlH030521 for ; Tue, 7 May 2024 08:44:52 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id 4478iqMU030519 for bugs@FreeBSD.org; Tue, 7 May 2024 08:44:52 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 278828] panic when writing to geli device after running attach twice Date: Tue, 07 May 2024 08:44:52 +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: 14.0-STABLE X-Bugzilla-Keywords: X-Bugzilla-Severity: Affects Some People X-Bugzilla-Who: mail@fbsd2.e4m.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 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D278828 Bug ID: 278828 Summary: panic when writing to geli device after running attach twice Product: Base System Version: 14.0-STABLE Hardware: Any OS: Any Status: New Severity: Affects Some People Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: mail@fbsd2.e4m.org kernel panics if we have no geli devices attached, attach a device, try to attach it again (which fails) and then write to (the attached) .eli. Steps to reproduce: kldload geom_eli.ko dd if=3D/dev/zero of=3D/tmp/testcrash bs=3D64k count=3D160 mdconfig -a -t vnode -f /tmp/testcrash geli init -P -K /bin/ls /dev/md0 geli attach -k /bin/ls -p /dev/md0 geli attach -k /bin/ls -p /dev/md0 (this fails) newfs /dev/md0.eli !!! Crash !!! The second "geli attach" makes g_eli_create() die at this point: ... dcw =3D (sc->sc_flags & G_ELI_FLAG_RO) ? 0 : 1; error =3D g_access(cp, 1, dcw, 1); if (error !=3D 0) { ... goto failed; } ... ... g_eli_init_uma(); ... failed: ... g_eli_fini_uma(); ... g_eli_fini_uma() will find geli_devs being set to 1 (because we already have a device attached but have not called g_eli_init_uma() in this context), decrements it and calls g_eli_destroy_uma(). So we will be left with g_eli_uma being NULL despite the fact that we still have a device attached. I don't know the correct fix. I changed g_eli_create() so it calls g_eli_fini_uma() only if it has called g_eli_init_uma() before. This seems to work... --=20 You are receiving this mail because: You are the assignee for the bug.=