2

Author Topic: "header read size 0" bug and FIX :-)  (Read 12578 times)

0 Members and 1 Guest are viewing this topic.

madwolf

  • Entrant
  • Posts: 5
"header read size 0" bug and FIX :-)
« on: September 11, 2009, 11:38:13 AM »
Hello,
I found a bug and fixed it myself, hope you don't mind ;-) but it would be cool if you included the fix for the future releases of Chameleon.
When waking from hibernation some people (including me) experienced messages "header read size 0" and incorrect sleepimage signature. Well it seems that Chameleon was unable to read any file over 4gb in size. So for anyone with 4gb or more memory waking from hibernation didn't work.
There was a bug in libsaio/hfs.c that treated every fileLength as 32bit (long). Attached to my post there is the fixed compiled boot file from Chameleon RC3 and fixed hfs.c (in function ReadFile, the fileLength variable for HFS+ files was cast to long instead of long long).
Works great now :-)
If you're going to incorporate the fix you can give credits to "radekg" :P I rarely use the nick madwolf. Bye.

zef

  • Administrator
  • Posts: 265
Re: "header read size 0" bug and FIX :-)
« Reply #1 on: September 12, 2009, 10:46:28 AM »
Hi radekg!

Many thx for the patch, we will review it and hopefully add your changes for a next release! :)

Bye,
zef
ASUS P8Z68-V PRO/GEN3 | i5-2500k | 16GB RAM | GTX560 | Keyboard | Mouse | Devilsound DAC

Bit Shoveler

  • Entrant
  • Posts: 5
Re: "header read size 0" bug and FIX :-)
« Reply #2 on: September 25, 2009, 08:29:19 AM »
Thanks radekg, good catch!

first post :)
The Hack: EP45-UD3P 1.1, BIOS F11d, Q9550@3.68GHz, 8GB, GTX 660, buncha drives, 10.9.1/Chimera 2.2.1

zef

  • Administrator
  • Posts: 265
Re: "header read size 0" bug and FIX :-)
« Reply #3 on: October 12, 2009, 10:10:54 AM »
@radekg:

Thx for the fix! :) Btw, I used an (uint64_t) cast for the fileLength type instead.
ASUS P8Z68-V PRO/GEN3 | i5-2500k | 16GB RAM | GTX560 | Keyboard | Mouse | Devilsound DAC

CharredPC

  • Observer
  • Posts: 12
Re: "header read size 0" bug and FIX :-)
« Reply #4 on: December 12, 2009, 08:38:57 PM »
Radekg: 

Since the Chameleon team can't / won't address it, I was wondering if I could get some support on your patch. It's not working for me (either your file or their latest release that includes it). Are you running SL or 10.5.x? Is a 64-bit OS needed to use this? I run retail 10.5.8 and deep sleep (hibernation) works great if I yank out one of my 2GB RAM sticks. Leaving both in (4GB total) it locks up while trying to boot, only giving the single line:

Loaded HFS+ file: [System/Library/CoreServices/System Version.plist]

Any thoughts or ideas?

zef

  • Administrator
  • Posts: 265
Re: "header read size 0" bug and FIX :-)
« Reply #5 on: December 12, 2009, 09:32:35 PM »
Since the Chameleon team can't / won't address it, I was wondering if I could get some support on your patch.

I think your issue has nothing to do with the patch posted here. If you take a look at the sources, you will see that there's more changes have been made regarding the sleepimage restoration. I'm trying to setup a test system to learn more about the bug.
ASUS P8Z68-V PRO/GEN3 | i5-2500k | 16GB RAM | GTX560 | Keyboard | Mouse | Devilsound DAC

CharredPC

  • Observer
  • Posts: 12
Re: "header read size 0" bug and FIX :-)
« Reply #6 on: December 12, 2009, 10:27:28 PM »
Zef:

Thanks for looking into this. I assumed it was this patch as it didn't work originally, and it was reported as included into RC4, which now also doesn't work. Let me know if you need anything tested.

Apex

  • Observer
  • Posts: 23
Re: "header read size 0" bug and FIX :-)
« Reply #7 on: February 01, 2010, 10:50:40 AM »
I am using RC4 which includes your patch. But i am having the lockup issue. The System hangs with the "Loading HFS+ File .... SystemVersion.plist" line after the boot device is selected.
All i can say is, wake-from-disk worked ONE time when i had two harddrives in my system. But i had to remove one harddrive and it stopped working. I am using SL and the 32bit Kernel.

Maybe someone gets a idea why it worked when i had two harddrives.

I'll try to include your patch into PCEFI 10.5 and see how that works.

Apex

  • Observer
  • Posts: 23
Re: "header read size 0" bug and FIX :-)
« Reply #8 on: February 01, 2010, 11:38:28 AM »
Update:

I added this (small) patch to Chameleon RC3. After that, i had the exact same lockup issue. So the lockup is somehow related to this patch. The System freezes after the line "Loading HFS+ File SystemVersion.plist"
« Last Edit: February 01, 2010, 11:39:59 AM by Apex »

MacWen

  • Entrant
  • Posts: 2
Re: "header read size 0" bug and FIX :-)
« Reply #9 on: March 20, 2010, 08:30:18 PM »
Hi All,

I fixed another bug (details below) in hfs.c causing (at least on my system) a freeze. I attached an updated boot binary (based on RC4) and the modified source for the VooDoo team.

Bug details: hfs.c, ReadExtent line 892 (see attached modified version, line is commented with // MacWen: ...). The multiplication of GetExtentSize(..) and gBlockSize can cause an overflow. In my case GetExtentSize(..) returned 0x0010.0000 and gBlockSize returned 0x0000.1000 causing a 32 bit overflow (both return long). Casting at least one of them to (long long) turns it into a 64 bit multiplication and voila: a valid readSize.

Happy 4Gb hibernation to you all!

MacWen

 
 

zef

  • Administrator
  • Posts: 265
Re: "header read size 0" bug and FIX :-)
« Reply #10 on: March 21, 2010, 01:25:29 PM »
I fixed another bug (details below) in hfs.c causing (at least on my system) a freeze. I attached an updated boot binary (based on RC4) and the modified source for the VooDoo team.

Hi MacWen,

Thanks for the fix, great finding! :)

Just committed to the trunk as well:

http://forge.voodooprojects.org/p/chameleon/source/commit/136/

Bye,
zef
ASUS P8Z68-V PRO/GEN3 | i5-2500k | 16GB RAM | GTX560 | Keyboard | Mouse | Devilsound DAC

Apex

  • Observer
  • Posts: 23
Re: "header read size 0" bug and FIX :-)
« Reply #11 on: March 27, 2010, 12:55:39 PM »
@ MacWen

Your patch fixed my wake-from-disk-problems. I now can wake-from-disk without problems :)

(i have 4GB Ram)

Goten

  • Entrant
  • Posts: 3
Re: "header read size 0" bug and FIX :-)
« Reply #12 on: April 06, 2010, 10:55:17 PM »
hi
please can you explain me how do I use the fix to make works hibernation on my hp-dv5 with 4gb.
I downloaded the boot file and I have replaced the old one, but the message about incorrect image signature still appears.
What's wrong?
How should I use the hfs.c file? Should I copy it to somewhere in my disc?

thanks in advance
 
hp dv5-1172 - Intel core 2 duo t9400 2,53ghz - 4gb ram dd2 - nvidia 9600m gt 512mb -
ethernet realtek 8169 - intel wifi 5100 - hdd 320 sata
snow leopard 10.6.3 with chameleon 2 rc4

MacWen

  • Entrant
  • Posts: 2
Re: "header read size 0" bug and FIX :-)
« Reply #13 on: April 07, 2010, 08:23:43 AM »
Hi Goten,

My fix addresses the hanging issue as described by Apex above. Your problem "incorrect image signature" is not related to my fix, sorry.

MacWen

Goten

  • Entrant
  • Posts: 3
Re: "header read size 0" bug and FIX :-)
« Reply #14 on: April 17, 2010, 01:46:50 PM »
Hi, just a question for those who have hibernation full working.
Normal sleep on my laptop works fine, the problem is the hibernation. even when I set hibernatemode to hibernation only (mode 1) my system continues to go in normal sleep instead of safe sleep and after reboot i get the "header read size 0 & incorrect image signature". But I think that is not a chameleon problem (i use rc5pre8) but the system that doesn't create properly the sleepimage file. In fact when the system goes to hibernation, in theory the disc should load a little time to write the ram status into sleepimage, and then shutdown. This not happens to me. System goes alway in normal sleep, no hard disk load e then perhaps the 4gb sleepimage file in var/vm is actually a fake.

Can you confirm that hard disk load before going to safe sleep?
What do you think about my considerations?

thanks to all
hp dv5-1172 - Intel core 2 duo t9400 2,53ghz - 4gb ram dd2 - nvidia 9600m gt 512mb -
ethernet realtek 8169 - intel wifi 5100 - hdd 320 sata
snow leopard 10.6.3 with chameleon 2 rc4