I am using android 4.2.2(Jelly Been) with linux-kernel 3.0.31 source code. I am trying to hook open system call but i don't know that how to change a page from read-only to writable given an address because sys_call_table is read-only.
I have do it successfully on linux Ubuntu12.04 3.2.32 with lookup_address() function below.
int make_rw(unsigned long address)
{
unsigned int level;
pte_t *pte = lookup_address(address, &level);
if(pte->pte &~ _PAGE_RW)
pte->pte |= _PAGE_RW;
return 0;
}
but unfortunately this function is for x86 not for arm. I don't know how to do it on arm-arch
another way: based on write protect register
#define CR0_WP 0x10000 //Write Protect Bit (CR0:16)
unsigned long cr0;
cr0 = read_cr0();
write_cr0(cr0 & ~CR0_WP);/* remove write protection*/
hookfunc(){...};
write_cr0(cr0);/* set write protection*/
but i do not know the relative register on arm-arch
Does there anyone have solved this problem? waiting for answer online!