GNU bug report logs - #18289
libparted ped_disk_clobber() overwrites firmware on some arm systems

Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.

Package: parted; Reported by: Karsten Merker <merker@HIDDEN>; dated Mon, 18 Aug 2014 06:42:02 UTC; Maintainer for parted is bug-parted@HIDDEN.

Message received at 18289 <at> debbugs.gnu.org:


Received: (at 18289) by debbugs.gnu.org; 27 Aug 2014 22:16:58 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 27 18:16:58 2014
Received: from localhost ([127.0.0.1]:53916 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XMlWT-0006v9-Mx
	for submit <at> debbugs.gnu.org; Wed, 27 Aug 2014 18:16:58 -0400
Received: from mx1.redhat.com ([209.132.183.28]:18596)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <bcl@HIDDEN>) id 1XMlWQ-0006uz-FW
 for 18289 <at> debbugs.gnu.org; Wed, 27 Aug 2014 18:16:55 -0400
Received: from int-mx13.intmail.prod.int.phx2.redhat.com
 (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7RMGmJZ022266
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Wed, 27 Aug 2014 18:16:48 -0400
Received: from lister.brianlane.com (ovpn-113-194.phx2.redhat.com
 [10.3.113.194])
 by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
 s7RMGkov014300
 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO);
 Wed, 27 Aug 2014 18:16:47 -0400
Date: Wed, 27 Aug 2014 15:16:46 -0700
From: "Brian C. Lane" <bcl@HIDDEN>
To: Karsten Merker <merker@HIDDEN>
Subject: Re: bug#18289: libparted ped_disk_clobber() overwrites firmware on
 some arm systems
Message-ID: <20140827221646.GD2635@HIDDEN>
References: <20140818061917.GA4599@HIDDEN>
 <20140818165949.GX27864@HIDDEN>
 <20140818200759.GA4756@HIDDEN>
 <20140827220621.GA7619@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20140827220621.GA7619@HIDDEN>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: 18289
Cc: Colin Watson <cjwatson@HIDDEN>, 751704@HIDDEN,
 Ian Campbell <ijc@HIDDEN>, 18289 <at> debbugs.gnu.org,
 Jim Meyering <meyering@HIDDEN>,
 Lennart Sorensen <lsorense@HIDDEN>,
 parted-devel <parted-devel@HIDDEN>,
 Otavio Salvador <otavio@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

On Thu, Aug 28, 2014 at 12:06:21AM +0200, Karsten Merker wrote:
> On Mon, Aug 18, 2014 at 10:07:59PM +0200, Karsten Merker wrote:
> 
> > You are fully right that normally a bootloader should be
> > installed after partitioning.  This works well for the case of a
> > bootloader that uses universally available BIOS functions and is
> > not hardware-specific, such as is the case on PCs.  In the case
> > of u-boot on the other hand, in PC-lingo we would have to provide
> > the installer with the ability to flash the BIOS for every PC
> > model on the market as part of the operating system installation,
> > which is not feasible.  We might be able to do that for a small
> > selection of devices, but not for all of them --> we need to keep
> > the u-boot image that is on the device even when creating a new
> > disklabel, but we are unsure what is the best way to handle this.
> > 
> > The approach in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=751704#60
> > (setting PedDisk.needs_clobber to 0 before calling ped_disk_commit
> > for specific devices) works in practice, but the question was
> > whether it is ok for the calling application to fiddle around with
> > the needs_clobber flag, or whether we should take some other
> > approach.
> 
> Hello Brian,
> 
> may I ping you again regarding the last paragraph? The question
> whether this approach is ok from a libparted point of view is
> still open and I would very much apprechiate your feedback on it.

Oops, sorry about that. I think that's probably ok. I'm not sure what
other option you have.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)




Information forwarded to bug-parted@HIDDEN:
bug#18289; Package parted. Full text available.

Message received at 18289 <at> debbugs.gnu.org:


Received: (at 18289) by debbugs.gnu.org; 27 Aug 2014 22:07:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Wed Aug 27 18:07:03 2014
Received: from localhost ([127.0.0.1]:53912 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XMlMs-0006gx-Hx
	for submit <at> debbugs.gnu.org; Wed, 27 Aug 2014 18:07:02 -0400
Received: from mout.kundenserver.de ([212.227.17.13]:49795)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <karsten@HIDDEN>) id 1XMlMp-0006gN-Sj
 for 18289 <at> debbugs.gnu.org; Wed, 27 Aug 2014 18:07:01 -0400
Received: from excalibur.cnev.de (cable-78-34-112-59.netcologne.de
 [78.34.112.59])
 by mrelayeu.kundenserver.de (node=mreue103) with ESMTP (Nemesis)
 id 0Lmel1-1WnQXV1f7r-00aIMK; Thu, 28 Aug 2014 00:06:22 +0200
Received: from karsten by excalibur.cnev.de with local (Exim 4.80)
 (envelope-from <karsten@HIDDEN>)
 id 1XMlMD-0001zR-RN; Thu, 28 Aug 2014 00:06:21 +0200
Date: Thu, 28 Aug 2014 00:06:21 +0200
From: Karsten Merker <merker@HIDDEN>
To: "Brian C. Lane" <bcl@HIDDEN>, 18289 <at> debbugs.gnu.org,
 751704@HIDDEN
Subject: Re: bug#18289: libparted ped_disk_clobber() overwrites firmware on
 some arm systems
Message-ID: <20140827220621.GA7619@HIDDEN>
References: <20140818061917.GA4599@HIDDEN>
 <20140818165949.GX27864@HIDDEN>
 <20140818200759.GA4756@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20140818200759.GA4756@HIDDEN>
X-No-Archive: yes
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Provags-ID: V02:K0:x7JLlQAnPpIzqNLoIxqRTD5ksJbOhN289ML8dnQp3S0
 F+Q3qyxbybzFkQXs//Hso50qK+4MIwqWnPtkmRVSHO27e8hQ8m
 /rscHvQE7cAjEd6e0f7OwwLJVWJrsVrqohYELHLlZVRsOOxWan
 loLFcyDTAETtenohGql7XRZ7RO4yCOWPeHBP7F1AgSG/xbwKkB
 os0o3yXqliJVEvMq1kL/2Xf7D2jeZohVUfjSlNSUyFT78aV996
 ViSAW+xNeOJkVbTwYDsQzGwOJ2WR7QGoLaIyjwm3BGbjONi3u2
 N4nMlXBNxXZvslBzM1PsRDu7B1/l7gViIds5cRCYsjr8nixfFH
 PRg+zfg5L8KgLAMx3NwF0eY9V5BrliYEHHwcT7pC9
X-UI-Out-Filterresults: notjunk:1;
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 18289
Cc: Colin Watson <cjwatson@HIDDEN>, Ian Campbell <ijc@HIDDEN>,
 Jim Meyering <meyering@HIDDEN>,
 Lennart Sorensen <lsorense@HIDDEN>,
 Karsten Merker <merker@HIDDEN>,
 parted-devel <parted-devel@HIDDEN>,
 Otavio Salvador <otavio@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

On Mon, Aug 18, 2014 at 10:07:59PM +0200, Karsten Merker wrote:

> You are fully right that normally a bootloader should be
> installed after partitioning.  This works well for the case of a
> bootloader that uses universally available BIOS functions and is
> not hardware-specific, such as is the case on PCs.  In the case
> of u-boot on the other hand, in PC-lingo we would have to provide
> the installer with the ability to flash the BIOS for every PC
> model on the market as part of the operating system installation,
> which is not feasible.  We might be able to do that for a small
> selection of devices, but not for all of them --> we need to keep
> the u-boot image that is on the device even when creating a new
> disklabel, but we are unsure what is the best way to handle this.
> 
> The approach in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=751704#60
> (setting PedDisk.needs_clobber to 0 before calling ped_disk_commit
> for specific devices) works in practice, but the question was
> whether it is ok for the calling application to fiddle around with
> the needs_clobber flag, or whether we should take some other
> approach.

Hello Brian,

may I ping you again regarding the last paragraph? The question
whether this approach is ok from a libparted point of view is
still open and I would very much apprechiate your feedback on it.

Kind regards,
Karsten
-- 
Gem. Par. 28 Abs. 4 Bundesdatenschutzgesetz widerspreche ich der Nutzung
sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der
Werbung sowie der Markt- oder Meinungsforschung.




Information forwarded to bug-parted@HIDDEN:
bug#18289; Package parted. Full text available.

Message received at 18289 <at> debbugs.gnu.org:


Received: (at 18289) by debbugs.gnu.org; 18 Aug 2014 20:08:24 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 18 16:08:24 2014
Received: from localhost ([127.0.0.1]:46473 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XJTE7-0004ke-DK
	for submit <at> debbugs.gnu.org; Mon, 18 Aug 2014 16:08:23 -0400
Received: from mout.kundenserver.de ([212.227.126.130]:53734)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <karsten@HIDDEN>) id 1XJTE5-0004kK-F7
 for 18289 <at> debbugs.gnu.org; Mon, 18 Aug 2014 16:08:22 -0400
Received: from excalibur.cnev.de (cable-84-44-148-71.netcologne.de
 [84.44.148.71])
 by mrelayeu.kundenserver.de (node=mreue003) with ESMTP (Nemesis)
 id 0MY20C-1WocYi1FgG-00UpQa; Mon, 18 Aug 2014 22:08:00 +0200
Received: from karsten by excalibur.cnev.de with local (Exim 4.80)
 (envelope-from <karsten@HIDDEN>)
 id 1XJTDj-0001pB-OI; Mon, 18 Aug 2014 22:07:59 +0200
Date: Mon, 18 Aug 2014 22:07:59 +0200
From: Karsten Merker <merker@HIDDEN>
To: "Brian C. Lane" <bcl@HIDDEN>, 18289 <at> debbugs.gnu.org,
 751704@HIDDEN
Subject: Re: bug#18289: libparted ped_disk_clobber() overwrites firmware on
 some arm systems
Message-ID: <20140818200759.GA4756@HIDDEN>
References: <20140818061917.GA4599@HIDDEN>
 <20140818165949.GX27864@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
In-Reply-To: <20140818165949.GX27864@HIDDEN>
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Provags-ID: V02:K0:m2d5sxZ5SvkUXpgKa1lQiYqWec8OK6wbslB4Ld37z4M
 rlk7F8j2BYvKCJMTVqY85D/SR80yv4ozKqCk3ZD+Xc4RGepUJo
 IrP7NA7IuxzbyX3076IHkkoGpML8oP9t2WHuGU+5xheECQTT/U
 IoH+fqMK5L4giffKZ4GqJndeWRM2Pr6eZ+02gNEiymMlgJjrkr
 h1h4xdWHIuaafTe51vWmXUwvxAddhU5Ut/gtW4L2lEJoOfV7Ri
 MiP6Gv4RIA4traUjtoUdDQnBMWWyhKK/cuNLqb6K2FvYVpJqQE
 S0VgJFx5RO6aTHj/boIbFw7tl5Tn17hdQJZvJQIqYX+n93hGMm
 hBRZWOe+adDCim0Xx9sDc3x0e4Kp6LIiwmiJkaIJE
X-UI-Out-Filterresults: notjunk:1;
X-Spam-Score: 0.0 (/)
X-Debbugs-Envelope-To: 18289
Cc: Colin Watson <cjwatson@HIDDEN>, Ian Campbell <ijc@HIDDEN>,
 Jim Meyering <meyering@HIDDEN>,
 Lennart Sorensen <lsorense@HIDDEN>,
 parted-devel <parted-devel@HIDDEN>,
 Otavio Salvador <otavio@HIDDEN>
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: 0.0 (/)

On Mon, Aug 18, 2014 at 09:59:49AM -0700, Brian C. Lane wrote:
> On Mon, Aug 18, 2014 at 08:19:17AM +0200, Karsten Merker wrote:
> > Hello,
> > 
> > the following is a discussion from the Debian bugtracking system regarding
> > Debian Bug#751704 (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=751704).
> > It needs involvement from parted upstream, therefore I am forwarding it to 
> > bug-parted@HIDDEN
> 
> Thanks for forwarding this. parted should only be clobbering these extra
> sectors when a new disklabel is applied (eg. mklabel in the ui) which, I
> think, is the appropriate thing to do.
> 
> If you are operating on an existing disklabel and want to preserver a
> boot loader in the space before the 1st partition you shouldn't be
> calling ped_disk_new_fresh(). If you are creating a new disklabel then
> any boot loader code should be installed after partitioning.
> 
> I don't think parted needs any changes.

Hello,

thanks for your swift reply. I fully understand your position,
but unfortunately things on arm are fundamentally different from
the PC world.  U-Boot is more of a BIOS than a bootloader like
GRUB; it is highly board specific and handles low-level stuff
such as setting the IO pinmuxing for the specific board and
configuring the DRAM controller.  Without it, the board is
completely dead from a user perspective.

On a PC, the BIOS is always available in ROM/Flash even when all
disk devices have been wiped and the user can still select some
other device (such as the network, a CDROM drive or a USB memory
stick) to boot from.  On the arm systems we are talking about,
there is no ROM BIOS and the u-boot image on the SD card (or on
an eMMC chip) is the only way to interact with the system at all. 
The usual case is that the u-boot image is written raw onto the
storage medium, i.e. there is no partition table or filesystem
on it by default, so we need to create a new disklabel in the
installer.

You are fully right that normally a bootloader should be
installed after partitioning.  This works well for the case of a
bootloader that uses universally available BIOS functions and is
not hardware-specific, such as is the case on PCs.  In the case
of u-boot on the other hand, in PC-lingo we would have to provide
the installer with the ability to flash the BIOS for every PC
model on the market as part of the operating system installation,
which is not feasible.  We might be able to do that for a small
selection of devices, but not for all of them --> we need to keep
the u-boot image that is on the device even when creating a new
disklabel, but we are unsure what is the best way to handle this.

The approach in https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=751704#60
(setting PedDisk.needs_clobber to 0 before calling ped_disk_commit
for specific devices) works in practice, but the question was
whether it is ok for the calling application to fiddle around with
the needs_clobber flag, or whether we should take some other
approach.

Kind Regards,
Karsten
-- 
Gem. Par. 28 Abs. 4 Bundesdatenschutzgesetz widerspreche ich der Nutzung
sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der
Werbung sowie der Markt- oder Meinungsforschung.




Information forwarded to bug-parted@HIDDEN:
bug#18289; Package parted. Full text available.

Message received at 18289 <at> debbugs.gnu.org:


Received: (at 18289) by debbugs.gnu.org; 18 Aug 2014 17:00:03 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 18 13:00:02 2014
Received: from localhost ([127.0.0.1]:46403 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XJQHp-00084j-5T
	for submit <at> debbugs.gnu.org; Mon, 18 Aug 2014 13:00:01 -0400
Received: from mx1.redhat.com ([209.132.183.28]:57882)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <bcl@HIDDEN>) id 1XJQHm-00084Y-4M
 for 18289 <at> debbugs.gnu.org; Mon, 18 Aug 2014 12:59:58 -0400
Received: from int-mx13.intmail.prod.int.phx2.redhat.com
 (int-mx13.intmail.prod.int.phx2.redhat.com [10.5.11.26])
 by mx1.redhat.com (8.14.4/8.14.4) with ESMTP id s7IGxp5H003796
 (version=TLSv1/SSLv3 cipher=DHE-RSA-AES256-GCM-SHA384 bits=256 verify=OK);
 Mon, 18 Aug 2014 12:59:51 -0400
Received: from lister.brianlane.com (ovpn-113-96.phx2.redhat.com [10.3.113.96])
 by int-mx13.intmail.prod.int.phx2.redhat.com (8.14.4/8.14.4) with ESMTP id
 s7IGxnnp011081
 (version=TLSv1/SSLv3 cipher=AES128-GCM-SHA256 bits=128 verify=NO);
 Mon, 18 Aug 2014 12:59:51 -0400
Date: Mon, 18 Aug 2014 09:59:49 -0700
From: "Brian C. Lane" <bcl@HIDDEN>
To: Karsten Merker <merker@HIDDEN>
Subject: Re: bug#18289: libparted ped_disk_clobber() overwrites firmware on
 some arm systems
Message-ID: <20140818165949.GX27864@HIDDEN>
References: <20140818061917.GA4599@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Disposition: inline
In-Reply-To: <20140818061917.GA4599@HIDDEN>
User-Agent: Mutt/1.5.23 (2014-03-12)
X-Scanned-By: MIMEDefang 2.68 on 10.5.11.26
X-Spam-Score: -5.7 (-----)
X-Debbugs-Envelope-To: 18289
Cc: 751704@HIDDEN, 18289 <at> debbugs.gnu.org
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.7 (-----)

On Mon, Aug 18, 2014 at 08:19:17AM +0200, Karsten Merker wrote:
> Hello,
> 
> the following is a discussion from the Debian bugtracking system regarding
> Debian Bug#751704 (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=751704).
> It needs involvement from parted upstream, therefore I am forwarding it to 
> bug-parted@HIDDEN

Thanks for forwarding this. parted should only be clobbering these extra
sectors when a new disklabel is applied (eg. mklabel in the ui) which, I
think, is the appropriate thing to do.

If you are operating on an existing disklabel and want to preserver a
boot loader in the space before the 1st partition you shouldn't be
calling ped_disk_new_fresh(). If you are creating a new disklabel then
any boot loader code should be installed after partitioning.

I don't think parted needs any changes.

-- 
Brian C. Lane | Anaconda Team | IRC: bcl #anaconda | Port Orchard, WA (PST8PDT)




Information forwarded to bug-parted@HIDDEN:
bug#18289; Package parted. Full text available.

Message received at submit <at> debbugs.gnu.org:


Received: (at submit) by debbugs.gnu.org; 18 Aug 2014 06:41:43 +0000
From debbugs-submit-bounces <at> debbugs.gnu.org Mon Aug 18 02:41:43 2014
Received: from localhost ([127.0.0.1]:45916 helo=debbugs.gnu.org)
	by debbugs.gnu.org with esmtp (Exim 4.80)
	(envelope-from <debbugs-submit-bounces <at> debbugs.gnu.org>)
	id 1XJGdR-00057Q-Hf
	for submit <at> debbugs.gnu.org; Mon, 18 Aug 2014 02:41:42 -0400
Received: from eggs.gnu.org ([208.118.235.92]:33912)
 by debbugs.gnu.org with esmtp (Exim 4.80)
 (envelope-from <karsten@HIDDEN>) id 1XJGIF-0004Qu-SA
 for submit <at> debbugs.gnu.org; Mon, 18 Aug 2014 02:19:49 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <karsten@HIDDEN>) id 1XJGI4-0007ge-RZ
 for submit <at> debbugs.gnu.org; Mon, 18 Aug 2014 02:19:42 -0400
X-Spam-Checker-Version: SpamAssassin 3.3.2 (2011-06-06) on eggs.gnu.org
X-Spam-Level: 
X-Spam-Status: No, score=0.8 required=5.0 tests=BAYES_50 autolearn=disabled
 version=3.3.2
Received: from lists.gnu.org ([208.118.235.17]:59284)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <karsten@HIDDEN>) id 1XJGI4-0007ga-OG
 for submit <at> debbugs.gnu.org; Mon, 18 Aug 2014 02:19:36 -0400
Received: from eggs.gnu.org ([2001:4830:134:3::10]:35623)
 by lists.gnu.org with esmtp (Exim 4.71)
 (envelope-from <karsten@HIDDEN>) id 1XJGHz-0004jo-ER
 for bug-parted@HIDDEN; Mon, 18 Aug 2014 02:19:36 -0400
Received: from Debian-exim by eggs.gnu.org with spam-scanned (Exim 4.71)
 (envelope-from <karsten@HIDDEN>) id 1XJGHu-0007cH-8t
 for bug-parted@HIDDEN; Mon, 18 Aug 2014 02:19:31 -0400
Received: from mout.kundenserver.de ([212.227.126.187]:57229)
 by eggs.gnu.org with esmtp (Exim 4.71)
 (envelope-from <karsten@HIDDEN>) id 1XJGHt-0007XQ-VK
 for bug-parted@HIDDEN; Mon, 18 Aug 2014 02:19:26 -0400
Received: from excalibur.cnev.de (cable-84-44-148-71.netcologne.de
 [84.44.148.71])
 by mrelayeu.kundenserver.de (node=mreue004) with ESMTP (Nemesis)
 id 0LnFph-1WiWxn266X-00hNcE; Mon, 18 Aug 2014 08:19:18 +0200
Received: from karsten by excalibur.cnev.de with local (Exim 4.80)
 (envelope-from <karsten@HIDDEN>)
 id 1XJGHl-0001PP-VT; Mon, 18 Aug 2014 08:19:18 +0200
Date: Mon, 18 Aug 2014 08:19:17 +0200
From: Karsten Merker <merker@HIDDEN>
To: bug-parted@HIDDEN
Subject: libparted ped_disk_clobber() overwrites firmware on some arm systems
Message-ID: <20140818061917.GA4599@HIDDEN>
MIME-Version: 1.0
Content-Type: text/plain; charset=utf-8
Content-Disposition: inline
Content-Transfer-Encoding: 8bit
User-Agent: Mutt/1.5.21 (2010-09-15)
X-Provags-ID: V02:K0:BKEqLRrIDlj7EltKSNhUtgEtAgfxs6NkV9OKaiXPzDU
 VUTp5rXtUEJFdw8o+kt1M4NfpeECYqPEoiqp9brtmGTlNZFOWd
 bh0uLU2YvP9hAkSAfTqThx4RF5uex+gs+VpJrkevEe96t9OCQ/
 j3X07n8dWLpHKToZFGFnEPurNofdVEAxl83UOR7wsxNs7pagwt
 IywYbn5T3cNmmFEKOkKzEgPxqYbkfSFhah3Ntp/xkDQzyfaYG1
 yQ/OfkTc/Y0IpXHDTTEUz3foeGWjMlWk0Hm5L+JFIoCR3BRjUa
 5mC9WiSyyTVmEI6UUp66AjTFmGlm8WFPZIOEtPBrT9f+QiKDdx
 Im54NT1XTPaQ1OEAKytRDs8vb1ovcf7Eg76nCBqWJ
X-UI-Out-Filterresults: notjunk:1;
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 3.x [generic]
X-detected-operating-system: by eggs.gnu.org: GNU/Linux 2.6.x
X-Received-From: 208.118.235.17
X-Spam-Score: -5.0 (-----)
X-Debbugs-Envelope-To: submit
X-Mailman-Approved-At: Mon, 18 Aug 2014 02:41:39 -0400
Cc: 751704@HIDDEN
X-BeenThere: debbugs-submit <at> debbugs.gnu.org
X-Mailman-Version: 2.1.15
Precedence: list
List-Id: <debbugs-submit.debbugs.gnu.org>
List-Unsubscribe: <http://debbugs.gnu.org/cgi-bin/mailman/options/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=unsubscribe>
List-Archive: <http://debbugs.gnu.org/cgi-bin/mailman/private/debbugs-submit/>
List-Post: <mailto:debbugs-submit <at> debbugs.gnu.org>
List-Help: <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=help>
List-Subscribe: <http://debbugs.gnu.org/cgi-bin/mailman/listinfo/debbugs-submit>, 
 <mailto:debbugs-submit-request <at> debbugs.gnu.org?subject=subscribe>
Errors-To: debbugs-submit-bounces <at> debbugs.gnu.org
Sender: "Debbugs-submit" <debbugs-submit-bounces <at> debbugs.gnu.org>
X-Spam-Score: -5.0 (-----)

Hello,

the following is a discussion from the Debian bugtracking system regarding
Debian Bug#751704 (https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=751704).
It needs involvement from parted upstream, therefore I am forwarding it to 
bug-parted@HIDDEN

Kind regards,
Karsten

----- Forwarded message from Jim Meyering <jim@HIDDEN> -----

Date: Sun, 17 Aug 2014 14:51:41 -0700
From: Jim Meyering <jim@HIDDEN>
Subject: Bug#751704: libparted questions (was: Bug#751704: partman-base 173: partman overwrites
	parts of u-boot)

On Wed, Aug 13, 2014 at 12:07 PM, Karsten Merker <merker@HIDDEN> wrote:
> [CCing Otavio Salvador and Jim Meyering; the following is a short summary
>  of the situation; the full history can be read in bug #751704:
>
>  Debian-Installer uses partman for partitioning, which in turn is
>  based on libparted. On sunxi-based systems, upon writing the partition
>  table, partman/libparted overwrites parts of u-boot which are
>  located between the end of the partition table and the beginning of the
>  first partition which results in an unbootable system.
>  An attempt to solve this problem has been to conditionally set
>  PedDisk.needs_clobber to 0 in partman when it detects that it is
>  trying to write to a boot device on sunxi-based systems.]
>
> Colin Watson <cjwatson@HIDDEN> wrote:
>> PedDisk.needs_clobber is marked as "office use only" in parted; I
>> interpret that as meaning that it really shouldn't be fiddled with
>> outside parted, even though it's technically exposed.  Could you please
>> look at fixing parted to avoid clobbering the firmware area instead?  I
>> think that would be more correct.
>
> I have no idea what is really meant with the comment
>
>   /* office use only ;-) */
>           int                 needs_clobber;
>
> in /usr/include/parted/disk.h, so I would like to ask upstream
> for clarification. Otavio, Jim: you are listed as parted
> upstream maintainers on http://www.gnu.org/software/parted/ - could
> you shed some light on this? Is it ok for an application to fiddle
> with the needs_clobber element or is this to be considered
> strictly libparted-internal?
>
>
> @Colin: If the solution is to be completely encapsulated in
> libparted, I see a large problem in how to solve the conflict between
> space after the partition table being very differently used by
> firmware for different SoCs on one side, and libparted trying to make
> sure that there are no remains of other partition table formats in
> the respective area on the other side - at least with the
> prerequisite of keeping both the current defaults (clobbering) as
> well as keeping the libparted API unchanged.  With the current "there
> is one erase size for all platforms" method in ped_disk_clobber() in
> libparted/disk.c, we inevitably end up with conflicting requirements.
> An example: the source for ped_disk_clobber() states:
>
>         /* How many sectors to zero out at each end.
>            This must be large enough to zero out the magic bytes
>            starting at offset 8KiB on a DASD partition table.
>            Doing the same from the end of the disk is probably
>            overkill, but at least on GPT, we do need to zero out
>            the final sector.  */
>
> So for at least one platform (according to Wikipedia DASD seems to be
> some s/390 format), the area at offset 8KiB has to be wiped out while
> for another (armhf/sunxi) it may not be wiped out as the u-boot SPL is
> located there and cannot be relocated because its sector address is
> hardcoded in the SoC.
>
> According to https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=751704#25,
> similar problems (but at other offsets) come up for other SoCs.
> According to the examples listed there, for TI SoCs libparted would
> have to stop clobbering the GPT header after writing a DOS MBR, but
> could wipe the DASD area.  For a Freescale i.MX SoC libparted could
> legally clobber the GPT header, but would have to refrain from
> clobbering the areas behind it.  If you extrapolate this to the large
> number of different SoC families, to handle this completely inside
> libparted, the library would have to know what exactly is the target
> system for which it writes a partition table and special-case the
> handling for each of them.  While one might assume that the partition
> table is for an s/390 system when a DASD partition table is
> generated, this does not work as easily for the plethora of different
> architectures and systems that use DOS MBR partition tables.  This
> gets even more complicated by the fact that libparted may run on one
> platform but modify partition tables for another platform, such as
> when operating on disk images for use with emulators or when
> operating on hd-media images for different arm platforms (with
> different firmware/bootloader requirements) on one autobuild host, so
> trying to do runtime detection of the host system would still not cover
> all use cases. In the case of creating images from scratch, the problem
> can be circumvented by (re-)writing the bootloader at the end of the
> process, but when the task is to modify existing images with unknown
> content, this workaround is not available.
>
> As a conclusion, I think that the decision whether to clobber the
> area between the partition table and the beginning of the first
> partition has to be taken by the calling application and not
> internally by the library.
>
> Kind Regards,
> Karsten
> --
> Gem. Par. 28 Abs. 4 Bundesdatenschutzgesetz widerspreche ich der Nutzung
> sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der
> Werbung sowie der Markt- oder Meinungsforschung.

Thanks for the analysis and report.

I have not had much time for parted in the last 18 months.
During that time, Phillip Susi and Brian C. Lane have been doing most
of the work.  Would you please repost this message to the debbug-based
bug-parted@HIDDEN mailing list, so that this issue will automatically
be assigned a parted bug number, and so that they will see it?

Thanks,
Jim

----- End forwarded message -----

-- 
Gem. Par. 28 Abs. 4 Bundesdatenschutzgesetz widerspreche ich der Nutzung
sowie der Weitergabe meiner personenbezogenen Daten für Zwecke der
Werbung sowie der Markt- oder Meinungsforschung.




Acknowledgement sent to Karsten Merker <merker@HIDDEN>:
New bug report received and forwarded. Copy sent to bug-parted@HIDDEN. Full text available.
Report forwarded to bug-parted@HIDDEN:
bug#18289; Package parted. Full text available.
Please note: This is a static page, with minimal formatting, updated once a day.
Click here to see this page with the latest information and nicer formatting.
Last modified: Fri, 31 Oct 2014 17:00:04 UTC

GNU bug tracking system
Copyright (C) 1999 Darren O. Benham, 1997 nCipher Corporation Ltd, 1994-97 Ian Jackson.