* libblkid: broken calculation of blkid_probe size for ubiN_M
@ 2017-08-01 13:25 Rafał Miłecki
2017-08-02 8:37 ` Karel Zak
0 siblings, 1 reply; 3+ messages in thread
From: Rafał Miłecki @ 2017-08-01 13:25 UTC (permalink / raw)
To: util-linux
Hi,
Today I discovered libblkid can't recognize my UBI volume with ubifs
filesystem. The code in libblkid/src/superblocks/ubifs.c seems
alright, but it's never used because of:
# LIBBLKID_DEBUG=3Dlowprobe,buffer blkid /dev/ubi0_0
(...)
4166: libblkid: LOWPROBE: [59] ubifs:
4166: libblkid: BUFFER: ignore: request out of probing area
Above error comes from blkid_probe_get_buffer and its
pr->off + pr->size < real_off + len
condition. In my case its evaulated as:
0 + 1 < 0 + 4
(pr->size is 1 which looks wrong obviously).
My UBI MTD partition is detected as:
[ 0.834197] Creating 1 MTD partitions on "brcmnand.0":
[ 0.839318] 0x000000000000-0x000008000000 : "ubi"
And attached using:
ubiattach -m 0
If you take a look at blkid_verify, you can see it calls:
blkid_probe_set_device(cache->probe, fd, 0, 0)
(the last 0 argument is "size" variable). So the source of the problem
seems to be "size" calculation inside blkid_probe_set_device. It has
something like:
if (S_ISCHR(sb.st_mode))
devsiz =3D 1; /* UBI devices are char... */
pr->size =3D size ? (uint64_t)size : devsiz;
While I managed to debug and track down this issue, I'm not familiar
enough with libblkid to fix it. Could someone take a look at this and
help me, please?
--=20
Rafa=C5=82
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: libblkid: broken calculation of blkid_probe size for ubiN_M
2017-08-01 13:25 libblkid: broken calculation of blkid_probe size for ubiN_M Rafał Miłecki
@ 2017-08-02 8:37 ` Karel Zak
2017-08-02 8:41 ` Rafał Miłecki
0 siblings, 1 reply; 3+ messages in thread
From: Karel Zak @ 2017-08-02 8:37 UTC (permalink / raw)
To: Rafał Miłecki; +Cc: util-linux
On Tue, Aug 01, 2017 at 03:25:40PM +0200, Rafał Miłecki wrote:
> Hi,
>
> Today I discovered libblkid can't recognize my UBI volume with ubifs
> filesystem. The code in libblkid/src/superblocks/ubifs.c seems
> alright, but it's never used because of:
> # LIBBLKID_DEBUG=lowprobe,buffer blkid /dev/ubi0_0
> (...)
> 4166: libblkid: LOWPROBE: [59] ubifs:
> 4166: libblkid: BUFFER: ignore: request out of probing area
>
> Above error comes from blkid_probe_get_buffer and its
> pr->off + pr->size < real_off + len
> condition. In my case its evaulated as:
> 0 + 1 < 0 + 4
> (pr->size is 1 which looks wrong obviously).
Version? Is it the current git master branch?
I fixed something like this two weeks ago:
commit 4360f56cf6e40b10ab6ace4cf74073de2381c192
Author: Karel Zak <kzak@redhat.com>
Date: Tue Jul 11 12:17:40 2017 +0200
libblkid: don't check for size on UBI (char dev)
Signed-off-by: Karel Zak <kzak@redhat.com>
and now the condition is not used for char devices:
if (len == 0 || (!S_ISCHR(pr->mode) && pr->off + pr->size < real_off + len))
Karel
--
Karel Zak <kzak@redhat.com>
http://karelzak.blogspot.com
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: libblkid: broken calculation of blkid_probe size for ubiN_M
2017-08-02 8:37 ` Karel Zak
@ 2017-08-02 8:41 ` Rafał Miłecki
0 siblings, 0 replies; 3+ messages in thread
From: Rafał Miłecki @ 2017-08-02 8:41 UTC (permalink / raw)
To: Karel Zak; +Cc: util-linux
On 2 August 2017 at 10:37, Karel Zak <kzak@redhat.com> wrote:
> On Tue, Aug 01, 2017 at 03:25:40PM +0200, Rafa=C5=82 Mi=C5=82ecki wrote:
>> Today I discovered libblkid can't recognize my UBI volume with ubifs
>> filesystem. The code in libblkid/src/superblocks/ubifs.c seems
>> alright, but it's never used because of:
>> # LIBBLKID_DEBUG=3Dlowprobe,buffer blkid /dev/ubi0_0
>> (...)
>> 4166: libblkid: LOWPROBE: [59] ubifs:
>> 4166: libblkid: BUFFER: ignore: request out of probing area
>>
>> Above error comes from blkid_probe_get_buffer and its
>> pr->off + pr->size < real_off + len
>> condition. In my case its evaulated as:
>> 0 + 1 < 0 + 4
>> (pr->size is 1 which looks wrong obviously).
>
> Version? Is it the current git master branch?
>
> I fixed something like this two weeks ago:
>
> commit 4360f56cf6e40b10ab6ace4cf74073de2381c192
> Author: Karel Zak <kzak@redhat.com>
> Date: Tue Jul 11 12:17:40 2017 +0200
>
> libblkid: don't check for size on UBI (char dev)
>
> Signed-off-by: Karel Zak <kzak@redhat.com>
>
> and now the condition is not used for char devices:
>
> if (len =3D=3D 0 || (!S_ISCHR(pr->mode) && pr->off + pr->size < real_=
off + len))
Sorry for missing that info. I was testing & debugging with 2.29.2.
I'll give your commit a try, thanks!
--=20
Rafa=C5=82
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2017-08-02 8:41 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2017-08-01 13:25 libblkid: broken calculation of blkid_probe size for ubiN_M Rafał Miłecki
2017-08-02 8:37 ` Karel Zak
2017-08-02 8:41 ` Rafał Miłecki
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox