On Sunday 16 October 2005 18:26, Joel Palmius wrote:
> [EMAIL PROTECTED] /export/virtual/usermode/machine.master $ ls -lh
> totalt 4,3G
> -rwxr-xr-x  1 joepal users  671 16 okt 16.09 config.pl*
> lrwxrwxrwx  1 joepal users   12 16 okt 16.09 master.uml -> ../lib/linux*
> -rw-r--r--  1 joepal users 4,1G 14 okt 21.02 root_fs
> -rw-r--r--  1 joepal users 4,1G 16 okt 18.16 root_fs.cow
> -rw-r--r--  1 joepal users 513M 16 okt 16.09 swap_fs
> [EMAIL PROTECTED] /export/virtual/usermode/machine.master $ uml_moo -d
> root_fs.cow Aritmetiskt fel
> [EMAIL PROTECTED] /export/virtual/usermode/machine.master $

> uml_moo says "arithmetical error". I'm only guessing this is because the
> root/cow files are too large..? Or is it a 64-bit host error?

Ok, as a news - I didn't find the time any more to go debugging this myself, 
but I just hit this error, so I have debugged it.

It's due to using a 64-bit uml_moo and a 32-bit Linux binary (or viceversa).

Just for confirmation - I looked in your mails but I found a missing detail: I 
expect you used a 32-bit kernel to create the COW file, right?

Otherwise there's also something else that I missed here.

Using a 32-bit uml_moo seems to avoid the problem - I didn't let it go through 
and do the actual work, but I debugged until the instruction failing in your 
setup and it didn't fail, and *align_out had a meaningful value.

Finally, I found out that in the structure defining the COW header:

struct cow_header_v3 {
        __u32 magic;
        __u32 version;
        time_t mtime;
        __u64 size;
        __u32 sectorsize;
        __u32 alignment;
        __u32 cow_format;
        char backing_file[PATH_LEN_V3];
};

there is a different amount of padding between fields - on 64-bit machines the 
natural alignment of __u64 is 8 bytes rather than 4, so 4 padding bytes get 
added between mtime and size on 64-bit binaries.

To verify that, I did:
        $ gdb uml_moo 
or 
        $ gdb uml_moo-32

and 

        (gdb) print &( ((struct cow_header_v3*) 0) -> size)
to see the various alignments. I didn't do a full verification, though.

Solution could be to add __attribute__((packed)); to the struct declaration. 
Actually this could modify other paddings (not here - this is the only added 
padding, but we have more structures to audit).

So using __attribute__((packed)) __attribute__((aligned(4))) could be useful, 
but still not robust enough, though, in general - different vars can have 
different alignments.

Probably adding packed and specifying the paddings by hand will help - but it 
would be bad for other structures, possibly.

Not that V1 and V2 will ever be 64-bit clean (doesn't make sense and it's 
already broken).

BUT:

The problem is that the same declaration is used in kernel sources. I.e., we 
have (likely) COW files generated from 64-bit machines using a different 
format from 32-bit ones. So we have two incompatible formats out there in the 
wild.

-- 
Inform me of my mistakes, so I can keep imitating Homer Simpson's "Doh!".
Paolo Giarrusso, aka Blaisorblade (Skype ID "PaoloGiarrusso", ICQ 215621894)
http://www.user-mode-linux.org/~blaisorblade

        

        
                
___________________________________ 
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB 
http://mail.yahoo.it



-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://ads.osdn.com/?ad_id=7637&alloc_id=16865&op=click
_______________________________________________
User-mode-linux-user mailing list
User-mode-linux-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/user-mode-linux-user

Reply via email to