From owner-freebsd-bugs@freebsd.org Tue Oct 2 16:39:25 2018 Return-Path: Delivered-To: freebsd-bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 63B9A10A4734 for ; Tue, 2 Oct 2018 16:39:25 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mailman.ysv.freebsd.org (mailman.ysv.freebsd.org [IPv6:2001:1900:2254:206a::50:5]) by mx1.freebsd.org (Postfix) with ESMTP id ED09F727B8 for ; Tue, 2 Oct 2018 16:39:24 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: by mailman.ysv.freebsd.org (Postfix) id AD44310A4733; Tue, 2 Oct 2018 16:39:24 +0000 (UTC) Delivered-To: bugs@mailman.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2610:1c1:1:606c::19:1]) by mailman.ysv.freebsd.org (Postfix) with ESMTP id 88ABF10A4732 for ; Tue, 2 Oct 2018 16:39:24 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from mxrelay.ysv.freebsd.org (mxrelay.ysv.freebsd.org [IPv6:2001:1900:2254:206a::19:3]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "mxrelay.ysv.freebsd.org", Issuer "Let's Encrypt Authority X3" (verified OK)) by mx1.freebsd.org (Postfix) with ESMTPS id 22AC6727B4 for ; Tue, 2 Oct 2018 16:39:24 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org (kenobi.freebsd.org [IPv6:2001:1900:2254:206a::16:76]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client did not present a certificate) by mxrelay.ysv.freebsd.org (Postfix) with ESMTPS id 765CB1C1BC for ; Tue, 2 Oct 2018 16:39:23 +0000 (UTC) (envelope-from bugzilla-noreply@freebsd.org) Received: from kenobi.freebsd.org ([127.0.1.118]) by kenobi.freebsd.org (8.15.2/8.15.2) with ESMTP id w92GdNk5067269 for ; Tue, 2 Oct 2018 16:39:23 GMT (envelope-from bugzilla-noreply@freebsd.org) Received: (from www@localhost) by kenobi.freebsd.org (8.15.2/8.15.2/Submit) id w92GdNtP067268 for bugs@FreeBSD.org; Tue, 2 Oct 2018 16:39:23 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 231881] boot0cfg can not configutr "version 1.0" boot0 due to bug in gpart_mbr bootcode Date: Tue, 02 Oct 2018 16:39:23 +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 Only Me X-Bugzilla-Who: lev@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 MIME-Version: 1.0 X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.27 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Tue, 02 Oct 2018 16:39:25 -0000 https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=3D231881 Bug ID: 231881 Summary: boot0cfg can not configutr "version 1.0" boot0 due to bug in gpart_mbr bootcode Product: Base System Version: CURRENT Hardware: Any OS: Any Status: New Severity: Affects Only Me Priority: --- Component: kern Assignee: bugs@FreeBSD.org Reporter: lev@FreeBSD.org boot0/boot0sio have disk serial number compiled-in by default. It is named "version 2" boot block by boot0cfg(8) and this format places 4 byte Disk Se= rial Number where "version 1" boot block contains options. Support for disk serial number in boot0/boot0sio is optional, and could be turned off to save some bytes, needed for other options. boot0cfg(8) properly supports old placement of boot block options, properly detect boot block without disk serial number support and properly prepare options for it. Problem is, boot0cfg(8) uses "gpart bootcode" command to wriet boot block w= ith new options back to disk. And gmart_mbr always try to save disk serial number, which kills options if boot block is "version 1": static int g_part_mbr_bootcode(struct g_part_table *basetable, struct g_part_parms *gp= p) { struct g_part_mbr_table *table; uint32_t dsn; if (gpp->gpp_codesize !=3D MBRSIZE) return (ENODEV); table =3D (struct g_part_mbr_table *)basetable; dsn =3D *(uint32_t *)(table->mbr + DOSDSNOFF); bcopy(gpp->gpp_codeptr, table->mbr, DOSPARTOFF); if (dsn !=3D 0) *(uint32_t *)(table->mbr + DOSDSNOFF) =3D dsn; return (0); } Sometimes, it leads to complete bogus options written which kill boot0/boot= 0sio (it have invalid slice mask, for example, and is unable to boot at all) and sometimes it simply didn't give user ability to change boot0/boot0sio optio= ns. --=20 You are receiving this mail because: You are the assignee for the bug.=