Chameleon

Chameleon Commit Details

Date:2010-10-19 07:26:54 (13 years 6 months ago)
Author:Evan Lojewski
Commit:597
Parents: 596
Message:Fix kernel patcher, TODO: verify that it works on all kernels
Changes:
M/branches/meklort/i386/modules/KernelPatcher/kernel_patcher.c

File differences

branches/meklort/i386/modules/KernelPatcher/kernel_patcher.c
182182
183183
184184
185
186185
187186
188187
......
395394
396395
397396
398
397
399398
400399
401400
......
451450
452451
453452
454
453
455454
456455
457456
458457
459
460458
461
462
459
463460
464461
465
466462
467463
468464
......
510506
511507
512508
509
513510
514511
515512
......
609606
610607
611608
612
613609
614610
615611
}
entry = entry->next;
}
}
}
void patch_cpuid_set_info_32(void* kernelData, UInt32 impersonateFamily, UInt8 impersonateModel)
{
{
UInt8* bytes = (UInt8*)kernelData;
kernSymbols_t *symbol = lookup_kernel_symbol("_cpuid_set_info");
// NOTE: This will *NOT* be located on pre 10.6.2 kernels
jumpLocation = patchLocation - 15;
while((bytes[jumpLocation - 1] != 0x77 ||
bytes[jumpLocation] != (patchLocation - jumpLocation - -8)) &&
bytes[jumpLocation] != (patchLocation - jumpLocation - 18)) &&
(patchLocation - jumpLocation) < 0xF0)
{
jumpLocation--;
}
// If found... AND we want to impersonate a specific cpumodel / family...
if(impersonateFamily &&
impersonateModel &&
if(impersonateFamily && impersonateModel &&
((patchLocation - jumpLocation) < 0xF0))
{
bytes[jumpLocation] -= 10;// sizeof(movl$0x6b5a4cd2,0x00872eb4) = 10bytes
/*
}
else if(impersonateFamily && impersonateModel)
{
// pre 10.6.2 kernel
// Locate the jump to directly *after* the panic call,
jumpLocation = patchLocation - 4;
void patch_lapic_init(void* kernelData)
{
UInt8 panicIndex = 0;
UInt8* bytes = (UInt8*)kernelData;

Archive Download the corresponding diff file

Revision: 597