mprotect

125 篇文章 0 订阅
d:\linux\linuxkernel\WORKING_DIRECTORY\android-omap-20111108-gingerbread\dalvik\vm\oo\Class.c
bool dvmClassStartup(void)
    gDvm.pBootLoaderAlloc = dvmLinearAllocCreate(NULL);


d:\linux\linuxkernel\WORKING_DIRECTORY\android-omap-20111108-gingerbread\dalvik\vm\LinearAlloc.c
LinearAllocHdr* dvmLinearAllocCreate(Object* classLoader)
    pHdr->mapAddr = mmap(NULL, pHdr->mapLength, PROT_READ | PROT_WRITE,
        MAP_PRIVATE, fd, 0);// 0xa850000
static inline LinearAllocHdr* getHeader(Object* classLoader)
{
    return gDvm.pBootLoaderAlloc;
}
void* dvmLinearAlloc(Object* classLoader, size_t size)
{
    LinearAllocHdr* pHdr = getHeader(classLoader);


        *(u4*)(pHdr->mapAddr + startOffset) = size;
This is writing the memory of mappingfile, and there's some kind of vialation. In LinearAlloc.c:
//    pHdr->mapAddr = mmap(NULL, pHdr->mapLength, PROT_READ | PROT_WRITE,
//        MAP_PRIVATE, fd, 0);
    pHdr->mapAddr = mmap(NULL, pHdr->mapLength, PROT_READ | PROT_WRITE,
        MAP_SHARED, fd, 0);
d:\linux\linuxkernel\WORKING_DIRECTORY\android-omap-20111108-gingerbread\dalvik\vm\LinearAlloc.
* commented by ango
     */
//    if (mprotect(pHdr->mapAddr, pHdr->mapLength, PROT_NONE) != 0) {
mprotect make the pHdr->mapAddr cannot be accessed at all
0  0x005556cb  dvmLinearAlloc  d:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/vm/LinearAlloc.c  382
1  0x004d1e8a  loadClassFromDex0  d:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/vm/oo/Class.c  1750
2  0x004d24f1  loadClassFromDex  d:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/vm/oo/Class.c  1921
3  0x004d16dd  findClassNoInit  d:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/vm/oo/Class.c  1461
4  0x004d1586  dvmFindSystemClassNoInit  d:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/vm/oo/Class.c  1382
5  0x004d14e2  dvmFindSystemClass  d:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/vm/oo/Class.c  1360
6  0x0052ecab  loadAllClasses  d:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/vm/analysis/DexPrepare.c  871
7  0x0052eb56  rewriteDex  d:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/vm/analysis/DexPrepare.c  800
8  0x0052e577  dvmContinueOptimization  d:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/vm/analysis/DexPrepare.c  577
9  0x0040205f  fromDex  d:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/dexopt/OptMain.c  538
10  0x00402188  dexoptmain  d:/linux/linuxkernel/WORKING_DIRECTORY/android-omap-20111108-gingerbread/dalvik/dexopt/OptMain.c  597
11  0x00401330  main  d:/linux/linuxkernel/WORKING_DIRECTORY/ango/dexopt/main.c  8
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

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

抵扣说明:

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

余额充值