[maemo-community] backup-menu in Extras-devel: extremely dangerous

From: Frantisek Dufka dufkaf at seznam.cz
Date: Fri Oct 8 11:04:39 EEST 2010
On 8.10.2010 0:43, Andrew Flegg wrote:
> Hi,
>
> I've got a couple of reports (completely hearsay, but from reputable
> people) about backup-menu being incredibly dangerous due to it `dd'ing
> the MTD directly, and so not taking into account bad/erase blocks:

dd should never be used for writing the NAND, see e.g.

http://www.linux-mtd.infradead.org/faq/nand.html#L_nand_copyimg
http://www.linux-mtd.infradead.org/doc/general.html#L_mtdblock

one should use nanddump for dumping NAND and flash_eraseall + nandwrite 
for writing when using jffs2 over mtd devices (that's what bootmenu 
flasher does for 770/N8x0)

or for ubifs there are other tools 
http://www.linux-mtd.infradead.org/doc/ubi.html#L_usptools as the 
situation is more complex - see e.g.
http://www.linux-mtd.infradead.org/doc/ubi.html#L_format


>
> It's been suggested it is removed from Extras-devel.

If it is writing to nand via dd to /dev/mtd* then it is quite dangerous 
in many ways. If it is reading it then it is just broken. I believe dd 
returns I/O error when reading bad block from /dev/mtd  so hopefully it 
does not silently produce broken images.

Hmm, when checking the source now ( 
http://repository.maemo.org/extras-devel/pool/fremantle/free/source/b/backupmenu/backupmenu_0.31-2.tar.gz 
), the part with

#Restore the RootFS from $backupRootFile
dd of='/dev/mtd5' if="$backupRootFile" bs=4096 2> /tmp/ddstderr & pid=$!

is indeed quite bad :-(
More information about the maemo-community mailing list