Revise comments

pull/142/head
Kubo Takehiro 2016-06-21 00:03:56 +09:00
parent 1cc4406358
commit d23cb11695
2 changed files with 13 additions and 9 deletions

View File

@ -1623,8 +1623,7 @@ static int audit_plugin_init(void *p)
size_t func_in_plugin = (size_t)trampoline_dummy_func_for_mem; size_t func_in_plugin = (size_t)trampoline_dummy_func_for_mem;
if (func_in_mysqld < INT_MAX && func_in_plugin > INT_MAX) if (func_in_mysqld < INT_MAX && func_in_plugin > INT_MAX)
{ {
// When the distance from a hot patch function to trampoline_mem is within 2GB, // See comment about IndirectJump in hot_patch.cc.
// the minimum size of hot patching is reduced from 14 to 6.
mmap_flags |= MAP_32BIT; mmap_flags |= MAP_32BIT;
use_static_memory = false; use_static_memory = false;
} }

View File

@ -228,15 +228,20 @@ static bool HookFunction(ULONG_PTR targetFunction, ULONG_PTR newFunction, ULONG_
#else #else
#define ASM_MODE 64 #define ASM_MODE 64
enum { enum {
// overwrite 14 bytes in targetFunction. // Jump64 overwrites 14 bytes in targetFunction.
// jump to newFunction by WriteJump(). // This is used when the next two jump types are not available.
Jump64, Jump64,
// overwrite 5 bytes in targetFunction. // Jump32 overwrites 5 bytes in targetFunction.
// jump to newFunction by WriteJump32(). // This is used when mysqld is a Position Independent Executable(PIE).
// The mysqld would be loaded near dynamically loaded shared libraries
Jump32, Jump32,
// overwrite 5 bytes in targetFunction. // IndirectJump overwrites 5 bytes in targetFunction and uses
// jump to a region in trampolineFunction by WriteJump32() // extra 14 bytes in the region of trampolineFunction.
// and then jump to newFunction by WriteJump(). // This is used when mysqld isn't a Position Independent Executable(PIE).
// The mysqld is loaded at the fixed position 0x00400000.
// The region of trampolineFunction is located near the mysqld
// because it is allocated in audit_plugin_init() with the MAP_32BIT
// flag if mysqld isn't a PIE.
IndirectJump, IndirectJump,
} jumpType = Jump64; } jumpType = Jump64;
#endif #endif