diff options
author | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-26 18:30:03 +0000 |
---|---|---|
committer | mark@chromium.org <mark@chromium.org@0039d316-1c4b-4281-b951-d872f2087c98> | 2011-07-26 18:30:03 +0000 |
commit | e818bdfc24981c7e734e991c0fabd7fbc5044572 (patch) | |
tree | 554cd6ad1ec200d6b431e9a3f49ab0eef623f58d /third_party/mach_override | |
parent | 9bb211dc3038e18b593febc3c8d2a16e8e421c1d (diff) | |
download | chromium_src-e818bdfc24981c7e734e991c0fabd7fbc5044572.zip chromium_src-e818bdfc24981c7e734e991c0fabd7fbc5044572.tar.gz chromium_src-e818bdfc24981c7e734e991c0fabd7fbc5044572.tar.bz2 |
Update mach_override to 51ae3d199463fa84548f466d649f0821d579fdaf to pick up
our recent change (r93690, bug 79642). This also picks up:
commit 965084a3fa2d8171508037601e1ea009bc0d8443
Author: rentzsch <jwr.git@redshed.net>
Date: Wed Jul 13 11:20:08 2011 -0500
Add support for signal() and longjmp() on x86 and x86_64. (Ramosian Glider) Closes #6.
commit 8a6962a636af2ab5e213eb317506cde5f1cdb8b6
Merge: 8f5baad f2061a9
Author: Jonathan 'Wolf' Rentzsch <jwr.git@redshed.net>
Date: Sat Jun 25 12:51:34 2011 -0700
Merge pull request #5 from mkrautz/vm-protect-size
Change size of region in vm_protect calls to be 8.
commit f2061a9c26733a764a37585b7f93f362ca788ce5
Author: Mikkel Krautz <mikkel@krautz.dk>
Date: Sat Jun 25 21:13:44 2011 +0200
Change size of region in vm_protect calls to be 8.
commit 8f5baad6fe4fa73ecdf76d7d7cacec131723b8f5
Author: Jonathan 'Wolf' Rentzsch <jwr.git@redshed.net>
Date: Sat Jun 25 11:52:25 2011 -0700
[FIX] sizeof(long) => sizeof(void*) for vm_protect(). Closes #4.
BUG=none
TEST=none
Review URL: http://codereview.chromium.org/7461053
git-svn-id: svn://svn.chromium.org/chrome/trunk/src@94131 0039d316-1c4b-4281-b951-d872f2087c98
Diffstat (limited to 'third_party/mach_override')
-rw-r--r-- | third_party/mach_override/README.chromium | 25 | ||||
-rw-r--r-- | third_party/mach_override/mach_override.c | 15 |
2 files changed, 14 insertions, 26 deletions
diff --git a/third_party/mach_override/README.chromium b/third_party/mach_override/README.chromium index a1d5c69..065ade9 100644 --- a/third_party/mach_override/README.chromium +++ b/third_party/mach_override/README.chromium @@ -2,8 +2,8 @@ Name: mach_override Short Name: Part of the mach_star project Version: Unknown URL: https://github.com/rentzsch/mach_star -Date: 04/18/2011 -Revision: 32c4560eb09848073f69 +Date: 07/22/2011 +Revision: 51ae3d199463fa84548f466d649f0821d579fdaf License: MIT Security Critical: Yes @@ -11,7 +11,7 @@ Security Critical: Yes Description: This is the mach_override part of mach_star, namely: - https://github.com/rentzsch/mach_star/tree/aeb1720815c7255070da0f548267ccfdf7bd50b7 + https://github.com/rentzsch/mach_star/tree/51ae3d199463fa84548f466d649f0821d579fdaf This package is used to replace framework functions with different implementations at run time. @@ -19,21 +19,4 @@ implementations at run time. Local Modifications: -Enabled makeIslandExecutable for 32-bit i386. Main executables linked and run -on Mac OS X 10.7 ("Lion") have non-executable heap pages by default. See -http://crbug.com/79642. - -Changed the logic surrounding calls to makeIslandExecutable so that -mach_override_ptr can return successfully when originalFunctionReentryIsland, -an optional argument, is NULL. Failure in makeIslandExecutable will now -trigger cleanup of allocated memory. - -Changed allocateBranchIsland to use a more appropriate address range per -http://developer.apple.com/library/mac/#documentation/Performance/Conceptual/LaunchTime/Articles/Prebinding.html. -The range for x86 (32-bit) with kAllocateHigh set is now [0xffc00000, -0xffe00000). In this configuration, the loop is now guaranteed to terminate -instead of exceeding its permitted range. Previously, this function would -begin looking for a page at 0xfefff000 and would not stop, even after wrapping -around to low memory. The URL above states 0xfefff000 is within a range marked -"Reserved for use by the pasteboard and other system services. Do not use this -address range." +None. All local changes have been upstreamed. diff --git a/third_party/mach_override/mach_override.c b/third_party/mach_override/mach_override.c index 4e1c4bc..1274133 100644 --- a/third_party/mach_override/mach_override.c +++ b/third_party/mach_override/mach_override.c @@ -199,11 +199,11 @@ mach_override_ptr( // Make the original function implementation writable. if( !err ) { err = vm_protect( mach_task_self(), - (vm_address_t) originalFunctionPtr, - sizeof(long), false, (VM_PROT_ALL | VM_PROT_COPY) ); + (vm_address_t) originalFunctionPtr, 8, false, + (VM_PROT_ALL | VM_PROT_COPY) ); if( err ) err = vm_protect( mach_task_self(), - (vm_address_t) originalFunctionPtr, sizeof(long), false, + (vm_address_t) originalFunctionPtr, 8, false, (VM_PROT_DEFAULT | VM_PROT_COPY) ); } if (err) printf("err = %x %d\n", err, __LINE__); @@ -238,7 +238,7 @@ mach_override_ptr( #if defined(__i386__) || defined(__x86_64__) if (!err) { - uint32_t addressOffset = ((void*)escapeIsland - (void*)originalFunctionPtr - 5); + uint32_t addressOffset = ((char*)escapeIsland - (char*)originalFunctionPtr - 5); addressOffset = OSSwapInt32(addressOffset); jumpRelativeInstruction |= 0xE900000000000000LL; @@ -380,7 +380,7 @@ allocateBranchIsland( } } if( allocated ) - *island = (void*) page; + *island = (BranchIsland*) page; else if( !allocated && !err ) err = KERN_NO_SPACE; } @@ -539,6 +539,9 @@ static AsmInstructionMatch possibleInstructions[] = { { 0x1, {0xFF}, {0x57} }, // push %edi { 0x1, {0xFF}, {0x56} }, // push %esi { 0x2, {0xFF, 0xFF}, {0x31, 0xC0} }, // xor %eax, %eax + { 0x3, {0xFF, 0x4F, 0x00}, {0x8B, 0x45, 0x00} }, // mov $imm(%ebp), %reg + { 0x3, {0xFF, 0x4C, 0x00}, {0x8B, 0x40, 0x00} }, // mov $imm(%eax-%edx), %reg + { 0x4, {0xFF, 0xFF, 0xFF, 0x00}, {0x8B, 0x4C, 0x24, 0x00} }, // mov $imm(%esp), %ecx { 0x0 } }; #elif defined(__x86_64__) @@ -550,6 +553,8 @@ static AsmInstructionMatch possibleInstructions[] = { { 0x4, {0xFB, 0xFF, 0x00, 0x00}, {0x48, 0x89, 0x00, 0x00} }, // move onto rbp { 0x2, {0xFF, 0x00}, {0x41, 0x00} }, // push %rXX { 0x2, {0xFF, 0x00}, {0x85, 0x00} }, // test %rX,%rX + { 0x5, {0xF8, 0x00, 0x00, 0x00, 0x00}, {0xB8, 0x00, 0x00, 0x00, 0x00} }, // mov $imm, %reg + { 0x3, {0xFF, 0xFF, 0x00}, {0xFF, 0x77, 0x00} }, // pushq $imm(%rdi) { 0x0 } }; #endif |