Chameleon

Issue 133: Lion's IOKit/IOHibernatePrivate.h

Reported by Vladimir Zidar, Jul 27, 2011

IOHibernateImageHeader is different in Lion, wakeup from sleep image 
is not working anymore.

Comment 1 by Vladimir Zidar, Jul 27, 2011

In fact, there is another problem - 'Secure Virtual Memory' is on by 
default in Lion. There is no gui option to turn it off.

Comment 2 by Vladimir Zidar, Jul 27, 2011

/Library/Preferences/com.apple.virtualMemory.plist:

<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE plist PUBLIC "-//Apple//DTD PLIST 1.0//EN" 
"http://www.apple.com/DTDs/PropertyList-1.0.dtd">
<plist version="1.0">
<dict>
        <key>DisableEncryptedSwap</key>
        <true/>
</dict>
</plist>

Comment 3 by Jose Alves, Aug 19, 2011

even disabling secure virtual memory, hibernate does not work.

I tried with: hibernatemode 25 and (Wake=Yes/ForceWake=Yes) 

the same result:

Read HFS+ file: [hd(0,3)/private/var/vm/sleepimage] 512 bytes.
header read size 200
Incorrect image signature
Loading Darwin 10.7

Comment 4 by Vladimir Zidar, Aug 19, 2011

In order for hibernate to work, Chameleon needs to be compiled with 
10.7 IOHibernateImageHeader.

If interested, I can provide patch later today.

Comment 5 by Jose Alves, Aug 19, 2011

yes, thanks. I am willing to test

Comment 6 by Vladimir Zidar, Aug 20, 2011

Jose, 
please try this one. I works for me, and it should also be able to 
work with 10.5/10.6.

Comment 7 by Cosmosis Jones, Aug 20, 2011

why do u have to add the checkOsVersion??

I'm pretty sure that already exists

Comment 8 by Vladimir Zidar, Aug 20, 2011

Jones,

First of all, I forgot to mention that this is test patch, not 
intended to be a proper solution. I dislike resume.c very much, and 
if this works for people, I'll clean up resume.c completely and 
submit proper patch.
Therefore, I didn't want to change too many files, and considering 
checkOSVersion() was defined in boot.c only, and not mentioned in 
any header file, I did consider it private to boot.c. Proper 
solution would move checkOSVersion() to library, presumably the same 
one where gMacOSVersion is defined.

But first thing first, let's verify this works for everybody else.

Comment 9 by Jose Alves, Aug 21, 2011

Hi Vladimir 

Perfect

with secure virtual memory disabled
$ sysctl vm.swapusage
vm.swapusage: total = 64.00M  used = 0.00M  free = 64.00M 

hibernatemode	25

my kernel.log attached

Comment 10 by Jose Alves, Aug 21, 2011

sorry, attached

Comment 11 by Cyrus The Great, Aug 22, 2011

i test it. and can confirm that it work.

Comment 12 by goten goten0, Aug 26, 2011

hi, 
i've the same problem with hibernation. it doesn't work and at boot 
i get incorrect image signature.
is there a way to disable virtual secure memory in lion?
i've downloaded the patch by vladimir zidar but i don't know how to 
use that file.
anyone can help me?
thanks

Comment 13 by Carlos Rodríguez, Sep 3, 2011

I also get the "header read size 200. Incorrect image 
signature" message.

I'm using the 1493 build of Chameleon.

I can wake from sleep properly but not from deep sleep (hibernate).

I think chameleon is not even reading the whole sleep file because 
it only reads 512 bytes and obviously is way too large.

Cheers!

Comment 14 by Michael Seydl, Dec 26, 2011

*Bump* Are there already attempts to merge this into trunk? Are 
there any blockers that need to be resolved?

Comment 15 by Michael Seydl, Jan 22, 2012

*Bump* How complicated would it be to pull openssl into the boot 
loader in order to decrypt the pages encrypted in the swapfile (i 
got a working userspace implementation doing that)?

Comment 16 by Vladimir Zidar, Jan 22, 2012

@Michael

I guess decryption itself wouldn't be too hard, but how would you 
guess out the key?

Comment 17 by Michael Seydl, Jan 24, 2012

Hm. I see where you are going. Under 10.6 keys were still stored in 
the sleepfiles header. Under Lion keys get stored directly to nvram 
(have a look at IOHibernateIO.cpp; xnu-1699.24.8). Afaik FakeSMC is 
injecting stuff so that nvram is able to read stuff. Maybe it's 
possible to patch it in a way to store the nvram permanently to 
disk. Eventually that's too much effort considering it works after 
turning of encryption ...

Comment 18 by Vladimir Zidar, Jan 24, 2012

@Michael

Additionally, dumping 16GB of ram into sleepimage every time it goes 
to sleep takes too much time. Also due to special access mode during 
writing, all the fans in the box spin like crazy - which is really 
annoying.

What I'd like to find out is how to support deepsleepdelay option in 
pmset. I'd be ok with going first to standby mode, and then after 
predefined period (presumably when I am already sleeping) it would 
write the sleepimage (without waking me up).

Anyway, neither of which has to do with original issue here..

Comment 19 by Cosmosis Jones, May 5, 2012

Status: WontFix

Created: 3 years 3 days ago by Vladimir Zidar

Updated: 2 years 2 months ago

Status: WontFix

Followed by: 6 persons

Labels:
Priority:Medium
Type:Defect