Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1378599

Re: [RFC 0/6] mmc: Field Firmware Update

Path csiph.com!aioe.org!bofh.it!news.nic.it!robomod
From Ulf Hansson <ulf.hansson@linaro.org>
Newsgroups linux.kernel
Subject Re: [RFC 0/6] mmc: Field Firmware Update
Date Thu, 14 Apr 2016 10:40:01 +0200
Message-ID <rnKYF-7jf-7@gated-at.bofh.it> (permalink)
References <qunZv-7IZ-1@gated-at.bofh.it> <qxYga-1C0-17@gated-at.bofh.it> <qFZRN-64B-43@gated-at.bofh.it> <qFZRN-64B-41@gated-at.bofh.it> <qIqkO-1qs-1@gated-at.bofh.it> <qKIdA-43M-13@gated-at.bofh.it> <qQPYK-7yP-19@gated-at.bofh.it> <rjhBU-3Nd-11@gated-at.bofh.it> <rkbkK-2rF-17@gated-at.bofh.it> <rnBC2-8vj-31@gated-at.bofh.it>
Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :cc; bh=c9o9j+bJxTFMA4RzXjmfzbgQBG2EwDezqtxFV6Mesb8=; b=gWvQvzPXuH46v+8eTJuKKdJ7yGIpKGknWkwDmzD+JtOjXgcCzW/WqOHRDhkWGtGwiL fB9pvFSyBhT0WdgfwBEQK6FdoiqmMsmhb3pbYUJX4s7zLst6VGBPDN/pmVCTPQP6kfiv khcjGqwrIHw2uZg7Fc5m89NQE/3fGmph7zNtk=
X-Google-Dkim-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:to:cc; bh=c9o9j+bJxTFMA4RzXjmfzbgQBG2EwDezqtxFV6Mesb8=; b=eTaxnbKNtcLGHIfVTQPYUxx9i3GdO4gSgu9XXrstlS9HUgSgoN3z1HFetg6tbWLDRC 1Y9mRPkxS3lfjCG3RlcW32Jttl4tih+kflQxxi/osHrzP9Wm7Fpy2me/7LY+gUSHaZFD U/NFfgUxckbpsj8pSqjgSAj1xuKWaAxm6hh2MS0LqKIeYAOsokEM7Mae07fL1govJeoy w0BAXWW9iTu5EAV52JKRc0mPGTaxfMxdduBVGtNMmJDfd7YbwSSTmIfZ8SQT9FbUtCDH ZY4+Y2FHLiLvng0VT+qSPEVV7Gzl9B0fbL0IGWIQwPU/2LYMSsFygB0ymewCyxdC9INO fbMg==
X-Gm-Message-State AOPr4FW439H3wSfSVphfQvXKkRbpWVNJkInIhQKXbFsYsjCpUl4SFUwJuGYullukiemdbfTDA0xKw+4xstjEqzUl
MIME-Version 1.0
X-Received by 10.28.88.212 with SMTP id m203mr2934965wmb.52.1460622934300; Thu, 14 Apr 2016 01:35:34 -0700 (PDT)
Content-Type text/plain; charset=UTF-8
Sender robomod@news.nic.it
List-ID <linux-kernel.vger.kernel.org>
X-Mailing-List linux-kernel@vger.kernel.org
Approved robomod@news.nic.it
Lines 85
Organization linux.* mail to news gateway
X-Original-Cc Alex Lemberg <Alex.Lemberg@sandisk.com>, Holger Schurig <holgerschurig@gmail.com>, Avi Shchislowski <Avi.Shchislowski@sandisk.com>, "linux-mmc@vger.kernel.org" <linux-mmc@vger.kernel.org>, "linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>, Chris Ball <chris@printf.net>, Baolin Wang <baolin.wang@linaro.org>
X-Original-Date Thu, 14 Apr 2016 10:35:34 +0200
X-Original-Message-ID <CAPDyKFpt5kbBnF9MeC63YKPxgrGLV53uPSB+iTaiTXpun2+4zw@mail.gmail.com>
X-Original-References <1447426572-11756-1-git-send-email-holgerschurig@gmail.com> <SN1PR02MB13891415516DE9FA4756140783070@SN1PR02MB1389.namprd02.prod.outlook.com> <CAOpc7mHbM8EYYNRKR+pKnzc0wf1DR1ojX-iFuDWDYyquC3EVZg@mail.gmail.com> <CAPDyKFp2WEVF4yi=Upzx+58SY15u=Fp4=tr3_hh7AS3T2yz4qQ@mail.gmail.com> <87r3ierjae.fsf@gmail.com> <BLUPR02MB2773299A3F882A172DF0E3694FB0@BLUPR02MB277.namprd02.prod.outlook.com> <CAPDyKFopp9gaaPu_DBR0Rpcsu6BCXu5DexXiVxYv9v5uX150jw@mail.gmail.com> <CAMHSBOUCT0mQfpN6+7NfeaR5wKMOizQeH__-j9fup1Y-H48Wcg@mail.gmail.com> <CAPDyKFoH3=czLW5_AKcJLRZa2ptTuumiMT24PZw6zKBW38WOwQ@mail.gmail.com> <CAMHSBOUjGutAOXYu01rjr-SgWKkGDL7KfQALn-bgkLopBVwpOA@mail.gmail.com>
X-Original-Sender linux-kernel-owner@vger.kernel.org
Xref csiph.com linux.kernel:1378599

Show key headers only | View raw


On 14 April 2016 at 00:33, Gwendal Grignou <gwendal@chromium.org> wrote:
> On Mon, Apr 4, 2016 at 4:50 AM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>>
>> On 2 April 2016 at 02:23, Gwendal Grignou <gwendal@chromium.org> wrote:
>> > On Thu, Jan 14, 2016 at 5:16 AM, Ulf Hansson <ulf.hansson@linaro.org> wrote:
>> >> On 28 December 2015 at 15:12, Alex Lemberg <Alex.Lemberg@sandisk.com> wrote:
>>
>> > I am arriving after the battle, but I have finally rebased the eMMC
>> > FFU kernel ffu code to 4.x. It is based on what Avi and Alex have
>> > written.
>> > As stated earlier, the advantage over using MMC_MUTLI_CMD is we can
>> > force a reset and rescan of the card without asking the user to reboot
>> > their machine.
>>
>> No matter what, I think the problem is how you would *safely* deal
>> with the reset. Especially in the case when the eMMC already has an
>> mounted file system on it.
>
> Assuming the firmware is not wiping data or resizing the available
> space, the data in the flash is readable after the upgrade.

This is exactly my point. You can no* assume anything about the card
after a firmware upgrade.

> For the host point of view, a firmware update and a reset is
> equivalent to a reset, that could happen during error recovery.
> The only change are in the cid/csd//extcsd registers the firmware may
> have updated.

Is that defined by the spec and are all eMMC vendors conforming to
your above statement?

> The stack has to assume these registers are not constant and can
> change after reset.
>
> When looking into the mmc stack, AFAICT, the code that needs to get
> device specifics always rely on fields that are re-generated by
> mmc_card_inif() (card->ext_csd, output of mmc_decode_csd()/cid(() and
> so on).
>>
>>
>> Just doing something that *might* work, isn't good enough to me.
>>
>> > Also, by only sending a firmware name over the ioctl, we can use Kees'
>> > work for firmware validation (https://lwn.net/Articles/605432/).
>>
>> The request_firmware() interface would indeed be good to use. Although
>> unless we can figure out a way on how to safely deal with reset, we
>> will have to live without request_firmware().
>>
>> > To prevent downloading firmware from unknown source, we would reject
>> > some commands (like SWITCH with FFU_MODE) in the kernel
>> > MMC_IOC/MULTI_CMD ioctl handler.
>>
>> I don't follow, can you elaborate on this please.
>
> Today, an attacker with root access could break the chain of trust by
> writing a firmware in the eMMC that corrupts data on the fly and
> return infected code to the host after verification.
> One way is to use firmware signed by the manufacturer, a stronger
> approach is to enforce that the firmware is part of the root
> partition.
> To prevent a bad firmware from being downloaded, we have to make sure
> downloading firmware using raw single or multi commands ioctls does
> not work.

I clearly see the benefit of using request_firmware() and I open to
adopt an in-kernel FFU solution that uses it, as long as a safe reset
can be managed.

However, whether it's more safe to hackers has nothing to do with it.
If a hacker becomes root on a device they can do all kind of magic
things, for example replacing a firmware in rootfs or sending ioctl
commands to a device node that has root permissions. To achieve
security, verification of a signatures are needed and currently the
request_firmware() API doesn't support this and nor does the eMMC
device itself (at least to my knowledge).

Regarding the safe reset, the only way I see how to deal with this, is
to force a reboot and prevent serving new read/write request after a
firmware upgrade. Although, perhaps you can think of something more
clever.

Kind regards
Uffe

Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread


Thread

Re: [RFC 0/6] mmc: Field Firmware Update Ulf Hansson <ulf.hansson@linaro.org> - 2016-04-04 14:00 +0200
  Re: [RFC 0/6] mmc: Field Firmware Update Gwendal Grignou <gwendal@chromium.org> - 2016-04-14 00:40 +0200
    Re: [RFC 0/6] mmc: Field Firmware Update Ulf Hansson <ulf.hansson@linaro.org> - 2016-04-14 10:40 +0200

csiph-web