Re: [SLOF] [PATCH v2] slof/fs/packages/disk-label.fs: improve checking for DOS boot partitions

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On 2024-03-26 15:45:46, Thomas Huth wrote:
> On 18/03/2024 11.30, Kautuk Consul wrote:
> > While testing with a qcow2 with a DOS boot partition it was found that
> > when we set the logical_block_size in the guest XML to >512 then the
> > boot would fail
> ...
> > diff --git a/slof/fs/packages/disk-label.fs b/slof/fs/packages/disk-label.fs
> > index 661c6b0..2630701 100644
> > --- a/slof/fs/packages/disk-label.fs
> > +++ b/slof/fs/packages/disk-label.fs
> > @@ -132,11 +132,16 @@ CONSTANT /gpt-part-entry
> >      debug-disk-label? IF dup ." actual=" .d cr THEN
> >   ;
> > -\ read sector to array "block"
> > -: read-sector ( sector-number -- )
> > +\ read sector to array "block" and return actual bytes read
> > +: read-sector-ret ( sector-number -- actual-bytes )
> >      \ block-size is 0x200 on disks, 0x800 on cdrom drives
> >      block-size * 0 seek drop      \ seek to sector
> > -   block block-size read drop    \ read sector
> > +   block block-size read    \ read sector
> > +;
> > +
> > +\ read sector to array "block"
> > +: read-sector ( sector-number -- )
> > +   read-sector-ret drop
> >   ;
> >   : (.part-entry) ( part-entry )
> > @@ -204,7 +209,8 @@ CONSTANT /gpt-part-entry
> >            part-entry>sector-offset l@-le    ( current sector )
> >            dup to part-start to lpart-start  ( current )
> 
> I just noticed that according to the stack comment above, there is a
> "current" item on the stack...
> 
> >            BEGIN
> > -            part-start read-sector          \ read EBR
> > +            part-start read-sector-ret          \ read EBR
> > +            block-size < IF UNLOOP 0 EXIT THEN
> 
> ... which doesn't get dropped here before the EXIT ? Is the stack still
> right after this function exited early?

Thanks for catching this. I didn't notice this as I sent this v2 in a
hurry.

> 
> >               1 partition>start-sector IF
> >                  \ ." Logical Partition found at " part-start .d cr
> >                  1+
> > @@ -279,6 +285,7 @@ CONSTANT /gpt-part-entry
> >      THEN
> >      count-dos-logical-partitions TO dos-logical-partitions
> > +   dos-logical-partitions 0= IF false EXIT THEN
> >      debug-disk-label? IF
> >         ." Found " dos-logical-partitions .d ." logical partitions" cr
> > @@ -352,6 +359,7 @@ CONSTANT /gpt-part-entry
> >      no-mbr? IF drop FALSE EXIT THEN  \ read MBR and check for DOS disk-label magic
> >      count-dos-logical-partitions TO dos-logical-partitions
> > +   dos-logical-partitions 0= IF 0 EXIT THEN
> 
> Similar question here, what about the "addr" stack item? Shouldn't it be
> dropped first?
Yes. Will take a look at this too. Thanks!
I will make these both changes and test them out before sending out a
v3.

> 
>  Thomas
> 
> 
> PS: I'm still having trouble receiving your mail, I just discovered v2 on
> patchwork and downloaded it from there...
Okay I will check everything from my side to see if everything is in
order.
> 




[Index of Archives]     [KVM Development]     [KVM ARM]     [KVM ia64]     [Linux Virtualization]     [Linux USB Devel]     [Linux Video]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [Big List of Linux Books]

  Powered by Linux