gaffe23 / linux-inject

Tool for injecting a shared object into a Linux process
Other
1.1k stars 246 forks source link

__libc_dlopen_mode() flag must be update #13

Open ParkHanbum opened 5 years ago

ParkHanbum commented 5 years ago

currently source code use 1 to flag for load shared object immediately. but this is not enough all of cases, if shared object need to be modify it own properties when load time.

refer glibc-2.28 source code. at line 1257:

if ((mode & (__RTLD_DLOPEN | __RTLD_AUDIT)) == __RTLD_DLOPEN)
   < change specific memory proctection >
    __stack_prot |= PROT_READ|PROT_WRITE|PROT_EXEC;
else 
    __stack_prot |= PROT_READ|PROT_WRITE|PROT_EXEC;

if you pass the 1 to argument for __libc_dlopen_mode, there is a possibility of occur SIGSEGV.

so, my suggest is very simple, just pass 0x80000001, not 1. then everyone will happy.