From owner-freebsd-bugs@FreeBSD.ORG Mon Jan 7 07:00:01 2013 Return-Path: Delivered-To: freebsd-bugs@smarthost.ysv.freebsd.org Received: from mx1.freebsd.org (mx1.FreeBSD.org [8.8.178.115]) by hub.freebsd.org (Postfix) with ESMTP id 0F40FE66 for ; Mon, 7 Jan 2013 07:00:01 +0000 (UTC) (envelope-from gnats@FreeBSD.org) Received: from freefall.freebsd.org (freefall.freebsd.org [IPv6:2001:1900:2254:206c::16:87]) by mx1.freebsd.org (Postfix) with ESMTP id E7915DF4 for ; Mon, 7 Jan 2013 07:00:00 +0000 (UTC) Received: from freefall.freebsd.org (localhost [127.0.0.1]) by freefall.freebsd.org (8.14.6/8.14.6) with ESMTP id r07700vX037274 for ; Mon, 7 Jan 2013 07:00:00 GMT (envelope-from gnats@freefall.freebsd.org) Received: (from gnats@localhost) by freefall.freebsd.org (8.14.6/8.14.6/Submit) id r07700Qq037270; Mon, 7 Jan 2013 07:00:00 GMT (envelope-from gnats) Resent-Date: Mon, 7 Jan 2013 07:00:00 GMT Resent-Message-Id: <201301070700.r07700Qq037270@freefall.freebsd.org> Resent-From: FreeBSD-gnats-submit@FreeBSD.org (GNATS Filer) Resent-To: freebsd-bugs@FreeBSD.org Resent-Reply-To: FreeBSD-gnats-submit@FreeBSD.org, Andre Albsmeier Received: from mx1.freebsd.org (mx1.freebsd.org [IPv6:2001:1900:2254:206a::19:1]) by hub.freebsd.org (Postfix) with ESMTP id A62FED5F for ; Mon, 7 Jan 2013 06:55:07 +0000 (UTC) (envelope-from Andre.Albsmeier@siemens.com) Received: from thoth.sbs.de (thoth.sbs.de [192.35.17.2]) by mx1.freebsd.org (Postfix) with ESMTP id 42769D4E for ; Mon, 7 Jan 2013 06:55:06 +0000 (UTC) Received: from mail2.siemens.de (localhost [127.0.0.1]) by thoth.sbs.de (8.13.6/8.13.6) with ESMTP id r076ndoJ027106 for ; Mon, 7 Jan 2013 07:49:39 +0100 Received: from curry.mchp.siemens.de (curry.mchp.siemens.de [139.25.40.130]) by mail2.siemens.de (8.13.6/8.13.6) with ESMTP id r076nd2T017471 for ; Mon, 7 Jan 2013 07:49:39 +0100 Received: (from localhost) by curry.mchp.siemens.de (8.14.5/8.14.5) id r076nda4017288 for FreeBSD-gnats-submit@freebsd.org; Mon, 7 Jan 2013 07:49:39 +0100 (CET) Message-Id: <201301070649.r076nd7q018805@curry.mchp.siemens.de> Date: Mon, 7 Jan 2013 07:49:39 +0100 (CET) From: Andre Albsmeier To: FreeBSD-gnats-submit@freebsd.org X-Send-Pr-Version: 3.114 Subject: bin/175086: 9.1 does not boot from GPT partition that can have more that 128 partition entries (worked under 7.4-STABLE, bug in sys/boot/common/gpt.c) X-BeenThere: freebsd-bugs@freebsd.org X-Mailman-Version: 2.1.14 Precedence: list List-Id: Bug reports List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-List-Received-Date: Mon, 07 Jan 2013 07:00:01 -0000 >Number: 175086 >Category: bin >Synopsis: 9.1 does not boot from GPT partition that can have more that 128 partition entries (worked under 7.4-STABLE, bug in sys/boot/common/gpt.c) >Confidential: no >Severity: critical >Priority: high >Responsible: freebsd-bugs >State: open >Quarter: >Keywords: >Date-Required: >Class: sw-bug >Submitter-Id: current-users >Arrival-Date: Mon Jan 07 07:00:00 UTC 2013 >Closed-Date: >Last-Modified: >Originator: Andre Albsmeier >Release: FreeBSD 9.1-PRERELEASE i386 >Organization: >Environment: System: FreeBSD 9.1-PRERELEASE >Description: Booting from a GPT partitioned disk that can have more than 128 parition entries (e.g. 248 in this case) fails under 9.1 but worked under 7.4. This is due to a test that was introduced in sys/boot/common/gpt.c: ... #define MAXTBLENTS 128 ... if (bcmp(hdr->hdr_sig, GPT_HDR_SIG, sizeof(hdr->hdr_sig)) != 0 || hdr->hdr_lba_self != hdrlba || hdr->hdr_revision < 0x00010000 || hdr->hdr_entsz < sizeof(struct gpt_ent) || hdr->hdr_entries > MAXTBLENTS || DEV_BSIZE % hdr->hdr_entsz != 0) { printf("%s: invalid %s GPT header\n", BOOTPROG, which); return (-1); } >How-To-Repeat: Create a disk using gpart create -s gpt -n 248 $disk and add bootcode and system to it. Add some delay into gptinit() of sys/boot/i386/gptboot/gptboot.c so you can read the error messages before reset occurs: invalid primary GPT header invalid backup GPT header unable to load GPT >Fix: The check should be removed since a GPT header with more than 128 possible parition entries is not invalid and can legally be created with gpart. >Release-Note: >Audit-Trail: >Unformatted: