2013-01-01 65 views
2

我正在使用android-kernel 2.6.29。我试图挂钩在android-kernel上的系统调用。我跟着链接http://syprog.blogspot.com.au/2011/10/hijack-linux-system-calls-part-iii.html钩在Ubuntu 12.04LTS和成功,但是当我交叉编译我的模块为Android然后我得到给出以下错误android系统调用钩子


错误:隐lookup_address功能

谁能帮助?为什么我得到这个错误?有没有其他的lookup_address?

+0

你可以包括源?该函数仅适用于x86! (看看这个交叉引用[这里](http://lxr.free-electrons.com/ident?a=arm&i=lookup_address)) – t0mm13b

回答

0

Linux Cross-reference与ARM架构相应的标准来看,指的是第一次引用内核版本2.6.32(没有2.6.29不幸)

交叉引用将产生命中大多指x86架构尽管设置了标准。引述:

lookup_address 

Defined as a function in: 
arch/x86/mm/pageattr.c, line 295 
arch/sh/kernel/io_trapped.c, line 162 
Defined as a function prototype in: 
arch/x86/include/asm/pgtable_types.h, line 330 
Referenced (in 11 files total) in: 
arch/x86/include/asm/pgtable_types.h, line 330 
arch/x86/mm/kmemcheck/pte.c, line 12 
arch/x86/mm/kmemcheck/kmemcheck.c: 
line 269 
line 295 
arch/x86/mm/pageattr-test.c: 
line 60 
line 150 
line 183 
line 203 
line 215 
arch/x86/mm/mmio-mod.c, line 96 
arch/x86/mm/fault.c, line 577 
arch/x86/mm/kmmio.c, line 136 
arch/x86/mm/pageattr.c: 
line 200 
line 238 
line 295 
line 326 
line 371 
line 487 
line 606 
line 1288 
arch/x86/xen/mmu.c: 
line 335 
line 347 
line 362 
arch/x86/xen/enlighten.c: 
line 281 
line 364 
arch/sh/kernel/io_trapped.c: 
line 162 
line 228 
line 251 

综观内x86/mm/pageattr.chere发现实际的源功能,只是为了显示功能是什么样子:

295 pte_t *lookup_address(unsigned long address, unsigned int *level) 
296 { 
297   pgd_t *pgd = pgd_offset_k(address); 
298   pud_t *pud; 
299   pmd_t *pmd; 
300 
301   *level = PG_LEVEL_NONE; 
302 
303   if (pgd_none(*pgd)) 
304     return NULL; 
305 
306   pud = pud_offset(pgd, address); 
307   if (pud_none(*pud)) 
308     return NULL; 
309 
310   *level = PG_LEVEL_1G; 
311   if (pud_large(*pud) || !pud_present(*pud)) 
312     return (pte_t *)pud; 
313 
314   pmd = pmd_offset(pud, address); 
315   if (pmd_none(*pmd)) 
316     return NULL; 
317 
318   *level = PG_LEVEL_2M; 
319   if (pmd_large(*pmd) || !pmd_present(*pmd)) 
320     return (pte_t *)pmd; 
321 
322   *level = PG_LEVEL_4K; 
323 
324   return pte_offset_kernel(pmd, address); 
325 } 
326 EXPORT_SYMBOL_GPL(lookup_address); 
+0

有没有其他的选择呢?我试过这个链接的方法[链接](http://dev-console.blogspot.com/2010/01/hooking-syscall-in-linux-2624-kernel.html),但没有change_page_attr函数。再次错误.. :(.. – rami

+0

@RamizRaja你提到的功能是**特定于x86平台** – t0mm13b

+0

我明白,但我只是问你的建议的实现或像lookup_address或change_page_attr功能如果你没有任何建议,然后确定np .. :) – rami