Page 1 of 1

fatx chain corruption bug - was it ever fixed in gentoox?

Posted: Thu Sep 13, 2007 11:46 pm
by BitBasher
I found this post over on XS by rmenhal...

(can't add url yet) - go over to xbox-scene forums, into the XBE exploits sub-folder, and read my last post in the topic Reintroducing Kernel Patching - Nkpatcher.

In summary, he states, "All fatx files created with Xbox-Linux kernel are slighly corrupt in the eyes of MS Xbox kernel."

I'm wondering if this bug has ever been fixed in Gentoox? It appears that ALL the kernel 2.4.xx patches over at xbox-linux still have this bug - it doesn't appear to have ever been corrected. The kernel 2.6.xx patches appear a bit different (maybe cache.c is redone) so I'm not sure if this bug exists on any xbox kernel 2.6.xx builds.

What bothers me about this bug is that it doesn't appear to be all that well known, yet the fact that virtually all xbox linux distros write incorrect end-of-fat-chain markers could possibly explain many "unknown" problems xbox users have - especially after using xboxhdm to install a bigger drive.

Basically, heads up!
Bit.

Posted: Thu Sep 13, 2007 11:52 pm
by BitBasher
Since my account here is too "young" to post a URL, here's a paste of the bug report...

Posted by rmenhal, Dec 14 2004, 09:46 PM on xbox-scene

All fatx files created with Xbox-Linux kernel are slighly corrupt in the eyes of MS Xbox kernel. MS kernel refuses to write into such a file, that's why it's read-only. I believe this is also why people have to delete E:\cache files (and all cache drives?) after building their new HD with XboxHDM. Although the fatx allocation chains for all files are then ill-terminated, the cache (and game save) files are pretty much the only files that need to be written into. When a game can't do so, it will crash or go into some infinite loop. Only writing into file seems affected, but there might be also other issues, I don't know.

Below is the mail I sent to one of the Xbox-Linux fatx authors a few weeks ago. I haven't got a reply back or anything, so I don't know if they are ever going to fix this.

Code: Select all

Seems there's a slight incompatibility between Xbox-Linux v2.4 kernel
and MS Xbox kernel fatx file system implementions. Xbox-Linux marks
the last cluster of a file with 0xfffffff8 (32-bit entries) and MS
kernel marks with 0xffffffff. MS kernel doesn't like the former
marking; writing to a file created by Xbox-Linux kernel fails to
STATUS_FILE_CORRUPT_ERROR (0xc0000102).

This can be seen by creating some, say 100000 byte, file using
Xbox-Linux kernel and then booting to MS kernel and writing to the
file with NtWriteFile().

Here's a quick and dirty patch:

--- linux-2.4.28-xbox/fs/fatx/cache.c.~1.2.~    Sat Mar 15 09:19:45 2003
+++ linux-2.4.28-xbox/fs/fatx/cache.c   Sat Nov 27 02:59:50 2004
@@ -59,9 +59,13 @@
       PRINTK("FATX: fatx_access: 0x%x, nr=0x%x, first=0x%x, next=0x%x\n", b, n
r, first, next);
       if (new_value != -1) {
               if (FATX_SB(sb)->fat_bits == 32) {
+                       if (new_value == (int)0xfffffff8)
+                               new_value = (int)0xffffffff;
                       ((__u32 *)bh->b_data)[(first & (sb->s_blocksize - 1)) >>
2]
                               = CT_LE_L(new_value);
               } else if (FATX_SB(sb)->fat_bits == 16) {
+                       if (new_value == 0xfff8)
+                               new_value = 0xffff;
                       ((__u16 *)bh->b_data)[(first & (sb->s_blocksize - 1)) >>
1]
                               = CT_LE_W(new_value);
               }

Posted: Fri Sep 14, 2007 4:51 am
by orochi
thats an old post (from 2004) but yea, i thin the fatx author's have not been active for a long while

Posted: Sat Sep 22, 2007 6:38 pm
by ShALLaX
Committed to xbox-linux CVS.