android内核hook定制,android kernel syscall table hook

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!

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值