All of lore.kernel.org
 help / color / mirror / Atom feed
From: Pintu Agarwal <pintu.ping@gmail.com>
To: Richard Weinberger <richard@nod.at>
Cc: Greg KH <greg@kroah.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-mtd <linux-mtd@lists.infradead.org>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Phillip Lougher <phillip@squashfs.org.uk>,
	Sean Nyekjaer <sean@geanix.com>,
	Kernelnewbies <kernelnewbies@kernelnewbies.org>
Subject: Re: MTD: How to get actual image size from MTD partition
Date: Tue, 20 Jul 2021 11:47:49 +0530	[thread overview]
Message-ID: <CAOuPNLh_KY4NaVWSEV2JPp8fx0iy8E1MU8GHT-w7-hMXrvSaeA@mail.gmail.com> (raw)
In-Reply-To: <1458549943.44607.1626686894648.JavaMail.zimbra@nod.at>

On Mon, 19 Jul 2021 at 14:58, Richard Weinberger <richard@nod.at> wrote:
>
> ----- Ursprüngliche Mail -----
> > Von: "Pintu Agarwal" <pintu.ping@gmail.com>
> > An: "richard" <richard@nod.at>
> > CC: "Greg KH" <greg@kroah.com>, "linux-kernel" <linux-kernel@vger.kernel.org>, "linux-mtd"
> > <linux-mtd@lists.infradead.org>, "linux-fsdevel" <linux-fsdevel@vger.kernel.org>, "Phillip Lougher"
> > <phillip@squashfs.org.uk>, "Sean Nyekjaer" <sean@geanix.com>, "Kernelnewbies" <kernelnewbies@kernelnewbies.org>
> > Gesendet: Montag, 19. Juli 2021 11:09:46
> > Betreff: Re: MTD: How to get actual image size from MTD partition
>
> > On Fri, 16 Jul 2021 at 21:56, Richard Weinberger <richard@nod.at> wrote:
> >
> >> >> My requirement:
> >> >> To find the checksum of a real image in runtime which is flashed in an
> >> >> MTD partition.
> >> >
> >> > Try using the dm-verity module for ensuring that a block device really
> >> > is properly signed before mounting it.  That's what it was designed for
> >> > and is independent of the block device type.
> >>
> >> MTDs are not block devices. :-)
> >>
> > Is it possible to use dm-verity with squashfs ?
> > We are using squashfs for our rootfs which is an MTD block /dev/mtdblock44
>
> Well, if you emulate a block device using mtdblock, you can use dm-verity and friends.
> Also consider using ubiblock. It offers better performance and wear leveling support.
>
Okay thank you.
We have tried dm-verity with squashfs (for our rootfs) but we are
facing some mounting issues.
[...]
[    4.697757] device-mapper: init: adding target '0 96160 verity 1
/dev/mtdblock34 /dev/mtdblock39 4096 4096 12020 8 sha256
d7b8a7d0c01b9aec888930841313a81603a50a2a7be44631c4c813197a50d681
aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7'
[    4.704771] device-mapper: verity: sha256 using implementation
"sha256-generic"
[...]
[    4.727366] device-mapper: init: dm-0 is ready
[    4.912558] VFS: Cannot open root device "dm-0" or
unknown-block(253,0): error -5

The same works with ext4 emulation.
So, not sure if there are any changes missing w.r.t. squashfs on 4.14 kernel ?

Anyways, I will create a separate thread for dm-verity issue and keep
this thread still open for UBI image size issue.
We may use dm-verify for rootfs during booting, but still we need to
perform integrity check for other nand partitions and UBI volumes.

So, instead of calculating the checksum for the entire partition, is
it possible to perform checksum only based on the image size ?
Right now, we are still exploring what are the best possible
mechanisms available for this.

Thanks,
Pintu

WARNING: multiple messages have this Message-ID (diff)
From: Pintu Agarwal <pintu.ping@gmail.com>
To: Richard Weinberger <richard@nod.at>
Cc: Greg KH <greg@kroah.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	 linux-mtd <linux-mtd@lists.infradead.org>,
	 linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Phillip Lougher <phillip@squashfs.org.uk>,
	 Sean Nyekjaer <sean@geanix.com>,
	Kernelnewbies <kernelnewbies@kernelnewbies.org>
Subject: Re: MTD: How to get actual image size from MTD partition
Date: Tue, 20 Jul 2021 11:47:49 +0530	[thread overview]
Message-ID: <CAOuPNLh_KY4NaVWSEV2JPp8fx0iy8E1MU8GHT-w7-hMXrvSaeA@mail.gmail.com> (raw)
In-Reply-To: <1458549943.44607.1626686894648.JavaMail.zimbra@nod.at>

On Mon, 19 Jul 2021 at 14:58, Richard Weinberger <richard@nod.at> wrote:
>
> ----- Ursprüngliche Mail -----
> > Von: "Pintu Agarwal" <pintu.ping@gmail.com>
> > An: "richard" <richard@nod.at>
> > CC: "Greg KH" <greg@kroah.com>, "linux-kernel" <linux-kernel@vger.kernel.org>, "linux-mtd"
> > <linux-mtd@lists.infradead.org>, "linux-fsdevel" <linux-fsdevel@vger.kernel.org>, "Phillip Lougher"
> > <phillip@squashfs.org.uk>, "Sean Nyekjaer" <sean@geanix.com>, "Kernelnewbies" <kernelnewbies@kernelnewbies.org>
> > Gesendet: Montag, 19. Juli 2021 11:09:46
> > Betreff: Re: MTD: How to get actual image size from MTD partition
>
> > On Fri, 16 Jul 2021 at 21:56, Richard Weinberger <richard@nod.at> wrote:
> >
> >> >> My requirement:
> >> >> To find the checksum of a real image in runtime which is flashed in an
> >> >> MTD partition.
> >> >
> >> > Try using the dm-verity module for ensuring that a block device really
> >> > is properly signed before mounting it.  That's what it was designed for
> >> > and is independent of the block device type.
> >>
> >> MTDs are not block devices. :-)
> >>
> > Is it possible to use dm-verity with squashfs ?
> > We are using squashfs for our rootfs which is an MTD block /dev/mtdblock44
>
> Well, if you emulate a block device using mtdblock, you can use dm-verity and friends.
> Also consider using ubiblock. It offers better performance and wear leveling support.
>
Okay thank you.
We have tried dm-verity with squashfs (for our rootfs) but we are
facing some mounting issues.
[...]
[    4.697757] device-mapper: init: adding target '0 96160 verity 1
/dev/mtdblock34 /dev/mtdblock39 4096 4096 12020 8 sha256
d7b8a7d0c01b9aec888930841313a81603a50a2a7be44631c4c813197a50d681
aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7'
[    4.704771] device-mapper: verity: sha256 using implementation
"sha256-generic"
[...]
[    4.727366] device-mapper: init: dm-0 is ready
[    4.912558] VFS: Cannot open root device "dm-0" or
unknown-block(253,0): error -5

The same works with ext4 emulation.
So, not sure if there are any changes missing w.r.t. squashfs on 4.14 kernel ?

Anyways, I will create a separate thread for dm-verity issue and keep
this thread still open for UBI image size issue.
We may use dm-verify for rootfs during booting, but still we need to
perform integrity check for other nand partitions and UBI volumes.

So, instead of calculating the checksum for the entire partition, is
it possible to perform checksum only based on the image size ?
Right now, we are still exploring what are the best possible
mechanisms available for this.

Thanks,
Pintu

______________________________________________________
Linux MTD discussion mailing list
http://lists.infradead.org/mailman/listinfo/linux-mtd/

WARNING: multiple messages have this Message-ID (diff)
From: Pintu Agarwal <pintu.ping@gmail.com>
To: Richard Weinberger <richard@nod.at>
Cc: Kernelnewbies <kernelnewbies@kernelnewbies.org>,
	Greg KH <greg@kroah.com>,
	linux-kernel <linux-kernel@vger.kernel.org>,
	linux-mtd <linux-mtd@lists.infradead.org>,
	Sean Nyekjaer <sean@geanix.com>,
	linux-fsdevel <linux-fsdevel@vger.kernel.org>,
	Phillip Lougher <phillip@squashfs.org.uk>
Subject: Re: MTD: How to get actual image size from MTD partition
Date: Tue, 20 Jul 2021 11:47:49 +0530	[thread overview]
Message-ID: <CAOuPNLh_KY4NaVWSEV2JPp8fx0iy8E1MU8GHT-w7-hMXrvSaeA@mail.gmail.com> (raw)
In-Reply-To: <1458549943.44607.1626686894648.JavaMail.zimbra@nod.at>

On Mon, 19 Jul 2021 at 14:58, Richard Weinberger <richard@nod.at> wrote:
>
> ----- Ursprüngliche Mail -----
> > Von: "Pintu Agarwal" <pintu.ping@gmail.com>
> > An: "richard" <richard@nod.at>
> > CC: "Greg KH" <greg@kroah.com>, "linux-kernel" <linux-kernel@vger.kernel.org>, "linux-mtd"
> > <linux-mtd@lists.infradead.org>, "linux-fsdevel" <linux-fsdevel@vger.kernel.org>, "Phillip Lougher"
> > <phillip@squashfs.org.uk>, "Sean Nyekjaer" <sean@geanix.com>, "Kernelnewbies" <kernelnewbies@kernelnewbies.org>
> > Gesendet: Montag, 19. Juli 2021 11:09:46
> > Betreff: Re: MTD: How to get actual image size from MTD partition
>
> > On Fri, 16 Jul 2021 at 21:56, Richard Weinberger <richard@nod.at> wrote:
> >
> >> >> My requirement:
> >> >> To find the checksum of a real image in runtime which is flashed in an
> >> >> MTD partition.
> >> >
> >> > Try using the dm-verity module for ensuring that a block device really
> >> > is properly signed before mounting it.  That's what it was designed for
> >> > and is independent of the block device type.
> >>
> >> MTDs are not block devices. :-)
> >>
> > Is it possible to use dm-verity with squashfs ?
> > We are using squashfs for our rootfs which is an MTD block /dev/mtdblock44
>
> Well, if you emulate a block device using mtdblock, you can use dm-verity and friends.
> Also consider using ubiblock. It offers better performance and wear leveling support.
>
Okay thank you.
We have tried dm-verity with squashfs (for our rootfs) but we are
facing some mounting issues.
[...]
[    4.697757] device-mapper: init: adding target '0 96160 verity 1
/dev/mtdblock34 /dev/mtdblock39 4096 4096 12020 8 sha256
d7b8a7d0c01b9aec888930841313a81603a50a2a7be44631c4c813197a50d681
aee087a5be3b982978c923f566a94613496b417f2af592639bc80d141e34dfe7'
[    4.704771] device-mapper: verity: sha256 using implementation
"sha256-generic"
[...]
[    4.727366] device-mapper: init: dm-0 is ready
[    4.912558] VFS: Cannot open root device "dm-0" or
unknown-block(253,0): error -5

The same works with ext4 emulation.
So, not sure if there are any changes missing w.r.t. squashfs on 4.14 kernel ?

Anyways, I will create a separate thread for dm-verity issue and keep
this thread still open for UBI image size issue.
We may use dm-verify for rootfs during booting, but still we need to
perform integrity check for other nand partitions and UBI volumes.

So, instead of calculating the checksum for the entire partition, is
it possible to perform checksum only based on the image size ?
Right now, we are still exploring what are the best possible
mechanisms available for this.

Thanks,
Pintu

_______________________________________________
Kernelnewbies mailing list
Kernelnewbies@kernelnewbies.org
https://lists.kernelnewbies.org/mailman/listinfo/kernelnewbies

  reply	other threads:[~2021-07-20  6:18 UTC|newest]

Thread overview: 69+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2021-07-16  6:42 MTD: How to get actual image size from MTD partition Pintu Agarwal
2021-07-16  6:42 ` Pintu Agarwal
2021-07-16  6:42 ` Pintu Agarwal
2021-07-16  7:16 ` Richard Weinberger
2021-07-16  7:16   ` Richard Weinberger
2021-07-16  7:16   ` Richard Weinberger
2021-07-16 15:41 ` Greg KH
2021-07-16 15:41   ` Greg KH
2021-07-16 15:41   ` Greg KH
2021-07-16 16:26   ` Richard Weinberger
2021-07-16 16:26     ` Richard Weinberger
2021-07-16 16:26     ` Richard Weinberger
2021-07-19  9:09     ` Pintu Agarwal
2021-07-19  9:09       ` Pintu Agarwal
2021-07-19  9:09       ` Pintu Agarwal
2021-07-19  9:28       ` Richard Weinberger
2021-07-19  9:28         ` Richard Weinberger
2021-07-19  9:28         ` Richard Weinberger
2021-07-20  6:17         ` Pintu Agarwal [this message]
2021-07-20  6:17           ` Pintu Agarwal
2021-07-20  6:17           ` Pintu Agarwal
2021-07-20  6:40           ` Richard Weinberger
2021-07-20  6:40             ` Richard Weinberger
2021-07-20  6:40             ` Richard Weinberger
2021-07-20  8:01             ` Pintu Agarwal
2021-07-20  8:01               ` Pintu Agarwal
2021-07-20  8:01               ` Pintu Agarwal
2021-07-21 20:54               ` Richard Weinberger
2021-07-21 20:54                 ` Richard Weinberger
2021-07-21 20:54                 ` Richard Weinberger
2021-07-22 11:10                 ` Pintu Agarwal
2021-07-22 11:10                   ` Pintu Agarwal
2021-07-22 11:10                   ` Pintu Agarwal
2021-07-27 21:16                   ` Richard Weinberger
2021-07-27 21:16                     ` Richard Weinberger
2021-07-27 21:16                     ` Richard Weinberger
2021-07-29 11:17                     ` Ezequiel Garcia
2021-07-29 11:17                       ` Ezequiel Garcia
2021-07-29 11:17                       ` Ezequiel Garcia
2021-07-29 11:45                       ` Richard Weinberger
2021-07-29 11:45                         ` Richard Weinberger
2021-07-29 11:45                         ` Richard Weinberger
2021-07-29 12:03                         ` Ezequiel Garcia
2021-07-29 12:03                           ` Ezequiel Garcia
2021-07-29 12:03                           ` Ezequiel Garcia
2021-07-29 17:11                           ` Pintu Agarwal
2021-07-29 17:11                             ` Pintu Agarwal
2021-07-29 17:11                             ` Pintu Agarwal
2021-08-20 18:24                             ` Pintu Agarwal
2021-08-20 18:24                               ` Pintu Agarwal
2021-08-20 18:24                               ` Pintu Agarwal
2021-08-22 14:21                               ` Ezequiel Garcia
2021-08-22 14:21                                 ` Ezequiel Garcia
2021-08-22 14:21                                 ` Ezequiel Garcia
2021-08-30 15:58                                 ` Pintu Agarwal
2021-08-30 15:58                                   ` Pintu Agarwal
2021-08-30 15:58                                   ` Pintu Agarwal
2021-10-29 16:12                                   ` Pintu Agarwal
2021-10-29 16:12                                     ` Pintu Agarwal
2021-10-29 16:12                                     ` Pintu Agarwal
2021-10-29 16:48                                     ` Ezequiel Garcia
2021-10-29 16:48                                       ` Ezequiel Garcia
2021-10-29 16:48                                       ` Ezequiel Garcia
2021-11-08 13:51                                       ` Pintu Agarwal
2021-11-08 13:51                                         ` Pintu Agarwal
2021-11-08 13:51                                         ` Pintu Agarwal
2021-11-12 13:58                                         ` Ezequiel Garcia
2021-11-12 13:58                                           ` Ezequiel Garcia
2021-11-12 13:58                                           ` Ezequiel Garcia

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=CAOuPNLh_KY4NaVWSEV2JPp8fx0iy8E1MU8GHT-w7-hMXrvSaeA@mail.gmail.com \
    --to=pintu.ping@gmail.com \
    --cc=greg@kroah.com \
    --cc=kernelnewbies@kernelnewbies.org \
    --cc=linux-fsdevel@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=phillip@squashfs.org.uk \
    --cc=richard@nod.at \
    --cc=sean@geanix.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.