Subject: Parted molests system firmware partitions.

From: "Laurence Perkins (OE)" <[email-masked]>
Date: Tue, 10 Jul 2018 18:27:30 +0000

A few of the cheaper devices I work with have the system firmware, the
RPMB, and the primary block device all backed by the same onboard eMMC
flash chip.  The special ones show up as /dev/mmcblk1boot0 and
/dev/mmcblk1rpmb respectively.

The kernel drivers for the eMMC device automatically detect this
situation and write-protect these special devices unless you
specifically enable writes via a switch in /proc.

Calling parted -l however attempts to open these devices read-write. 
Which fails and generates a dmesg entry that, prior to the 4.14 kernel,
was difficult to distinguish from the messages generated by a failing
eMMC device.

To keep the logs clean and for safety in the case of someone enabling
writes to these devices for various reasons, parted should probably do
what it can to leave them alone unless specifically instructed to do
otherwise.  Poking these devices in the wrong way can potentially brick
the motherboard, so an extra layer of defense around them would seem
prudent.

For my own purposes I will simply remove these device nodes from my
system as I have no need of them, so I do not personally consider this
to be a critical issue.  Those who actually make use of these special
devices may disagree though.

https://dev-nell.com/rpmb-emmc-errors-under-linux.html documents a
different issue, but has some code references that may be useful for
determining how best to construct a filter for these special devices.

LMP