subhook icon indicating copy to clipboard operation
subhook copied to clipboard

add SUBHOOK_TRY_ALLOCATE_TRAMPOLINE_NEAR_SOURCE flag

Open santazhang opened this issue 3 years ago • 3 comments

On 64-bit Linux systems, this flag will let subhook call mmap() with MAP_FIXED_NOREPLACE to allocate trampoline code near the source function. This helps avoid relocation overflow when generating trampoline code.

The exact allocation address will be determined by going through /proc//maps file and locating the nearest unmapped address near the source function.

santazhang avatar Apr 15 '21 21:04 santazhang

This should help address issues like #53

santazhang avatar Apr 15 '21 21:04 santazhang

This should help address issues like #53

I tried your patch on x64 linux and it doesn't seem to work. I still get overflow errors with SUBHOOK_TRY_ALLOCATE_TRAMPOLINE_NEAR_SOURCE and I get null trampolines with SUBHOOK_64BIT_OFFSET|SUBHOOK_TRY_ALLOCATE_TRAMPOLINE_NEAR_SOURCE.

I'm using funchook now, they don't have any of these issues.

bottiger1 avatar Jun 07 '21 21:06 bottiger1

hallo sir, can u help me?

UchiyhaMozi avatar Aug 17 '21 21:08 UchiyhaMozi