All of lore.kernel.org
 help / color / mirror / Atom feed
* How to test grub_iso9660_uuid from userland ?
@ 2024-07-01 14:08 Thomas Schmitt via Grub-devel
  2024-07-01 14:30 ` Vladimir 'phcoder' Serbinenko
  0 siblings, 1 reply; 3+ messages in thread
From: Thomas Schmitt via Grub-devel @ 2024-07-01 14:08 UTC (permalink / raw)
  To: grub-devel; +Cc: Thomas Schmitt

Hi,

i found a wrong word in an error message of grub-core/fs/iso9660.c
function grub_iso9660_uuid():

         grub_error (GRUB_ERR_BAD_NUMBER, "no creation date in filesystem to generate UUID");

The missing entity would be the modification date
  data->voldesc.modified
rather than the creation date
  data->voldesc.created

The fix is obviously simple. But i have no idea how to get the code
execution to this function for testing.
An ISO with 0 date would be easy to fake. A use case known to me is in
GRUB configuration with command "search" and option "--fs-uuid".
In grub-fstest.c i see no opportunity to perform "search".

Any idea how to test grub_iso9660_uuid() from userland of a running
GNU/Linux ?


Have a nice day :)

Thomas


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to test grub_iso9660_uuid from userland ?
  2024-07-01 14:08 How to test grub_iso9660_uuid from userland ? Thomas Schmitt via Grub-devel
@ 2024-07-01 14:30 ` Vladimir 'phcoder' Serbinenko
  2024-07-01 15:39   ` Thomas Schmitt via Grub-devel
  0 siblings, 1 reply; 3+ messages in thread
From: Vladimir 'phcoder' Serbinenko @ 2024-07-01 14:30 UTC (permalink / raw)
  To: The development of GNU GRUB


[-- Attachment #1.1: Type: text/plain, Size: 1102 bytes --]

Le lun. 1 juil. 2024, 17:12, Thomas Schmitt via Grub-devel <
grub-devel@gnu.org> a écrit :

> Hi,
>
> i found a wrong word in an error message of grub-core/fs/iso9660.c
> function grub_iso9660_uuid():
>
>          grub_error (GRUB_ERR_BAD_NUMBER, "no creation date in filesystem
> to generate UUID");
>
> The missing entity would be the modification date
>   data->voldesc.modified
> rather than the creation date
>   data->voldesc.created
>
> The fix is obviously simple. But i have no idea how to get the code
> execution to this function for testing.
> An ISO with 0 date would be easy to fake. A use case known to me is in
> GRUB configuration with command "search" and option "--fs-uuid".
> In grub-fstest.c i see no opportunity to perform "search".
>
> Any idea how to test grub_iso9660_uuid() from userland of a running
> GNU/Linux ?
>
grub-fstest IMAGE ls -- -l

>
>
> Have a nice day :)
>
> Thomas
>
>
> _______________________________________________
> Grub-devel mailing list
> Grub-devel@gnu.org
> https://lists.gnu.org/mailman/listinfo/grub-devel
>

[-- Attachment #1.2: Type: text/html, Size: 1859 bytes --]

[-- Attachment #2: Type: text/plain, Size: 141 bytes --]

_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: How to test grub_iso9660_uuid from userland ?
  2024-07-01 14:30 ` Vladimir 'phcoder' Serbinenko
@ 2024-07-01 15:39   ` Thomas Schmitt via Grub-devel
  0 siblings, 0 replies; 3+ messages in thread
From: Thomas Schmitt via Grub-devel @ 2024-07-01 15:39 UTC (permalink / raw)
  To: grub-devel; +Cc: Thomas Schmitt

Hi,

the question is now:

Is it worth to correct an error text which i cannot get to show up ?


Vladimir 'phcoder' Serbinenko wrote:
> grub-fstest IMAGE ls -- -l

  $ gunzip <tests/iso9660_early_ce.iso.gz >/tmp/iso9660_early_ce.iso
  $ ./grub-fstest /tmp/iso9660_early_ce.iso ls -- -l
  ...
  Device loop0: Filesystem type iso9660 - Label `ISOIMAGE' -
  Last modification time 2023-03-04 16:28:35 Saturday,
  UUID 2023-03-04-16-28-35-00 - Sector size 512B - Total size 68KiB
  ...

Now zeroizing the modification date (offset 830 in PVD at offset 32768):

  $ dd if=/dev/zero of=/tmp/iso9660_early_ce.iso conv=notrunc bs=1 count=17 seek=33598

  $ ./grub-fstest /tmp/iso9660_early_ce.iso ls -- -l
  ...
  Device loop0: Filesystem type iso9660 - Label `ISOIMAGE' -
  Sector size 512B - Total size 68KiB
  ...
  $

Well, it did not crash and there is no UUID. But i don't see the error
message either.

Switching to the branch with my proposed error text improvements of
grub-fstest ...
Still nothing to see. Obviously grub_errno is not set after function
execute_command of grub-fstest.c.

I checked that a bad ISO still causes a visible error message

  $ /grub-fstest /tmp/iso9660_ce_loop2.iso ls / -- -l
  ls : GRUB error 9 with message 'suspecting endless CE loop'
  ./grub-fstest: error: encountered 1 error during command execution.
  $

I also zeroized creation date at offset 32768+813 of the original ISO and
verified that grub-fstest still shows an UUID.
So the only thing i could prove by my test run is that indeed GRUB depends
on ISO 9660 modification time for its UUID production.

I failed to hack the function grub_error in grub-core/kern/err.c so that
it shows grub_errmsg to me. Neither fprintf(3) nor write(2) seem in reach.
The attempt to #include /usr/include/stdio.h or /usr/include/unistd.h
fails with not found sub-header files.


Have a nice day :)

Thomas


_______________________________________________
Grub-devel mailing list
Grub-devel@gnu.org
https://lists.gnu.org/mailman/listinfo/grub-devel

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2024-07-01 15:38 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-07-01 14:08 How to test grub_iso9660_uuid from userland ? Thomas Schmitt via Grub-devel
2024-07-01 14:30 ` Vladimir 'phcoder' Serbinenko
2024-07-01 15:39   ` Thomas Schmitt via Grub-devel

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.