信息网络安全 ›› 2026, Vol. 26 ›› Issue (2): 263-273.doi: 10.3969/j.issn.1671-1122.2026.02.007

• 学术研究 • 上一篇    下一篇

一种基于编译辅助的odex文件重写方法

程龙, 解梦飞, 吴鸿涛, 傅建明()   

  1. 武汉大学国家网络安全学院武汉 430072
  • 收稿日期:2025-03-25 出版日期:2026-02-10 发布日期:2026-02-23
  • 通讯作者: 傅建明 jmfu@whu.edu.cn
  • 作者简介:程龙(2000—),男,河南,硕士研究生,主要研究方向为移动安全|解梦飞(1997—),男,山东,博士研究生,主要研究方向为系统安全、漏洞挖掘|吴鸿涛(2000—),男,河南,硕士研究生,主要研究方向为系统安全|傅建明(1969—),男,湖南,教授,博士,CCF会员,主要研究方向为系统安全、移动安全
  • 基金资助:
    国家自然科学基金(62272351)

A Compiler-Assisted odex File Rewriting Method

CHENG Long, XIE Mengfei, WU Hongtao, FU Jianming()   

  1. School of Cyber Science and Engineering, Wuhan University, Wuhan 430072, China
  • Received:2025-03-25 Online:2026-02-10 Published:2026-02-23

摘要:

移动操作系统通过预先编译将应用中的字节码翻译为机器码并存储在odex文件中,以提升应用的启动和运行效率。然而,系统框架代码更新后odex文件会失效,导致应用需要重新编译,影响用户体验。对已有odex文件进行静态重写可避免重新编译,但是现有的静态重写技术较少关注odex文件及系统环境变化引发的重写问题。针对上述问题,文章提出一种基于编译辅助的odex文件重写方法,利用编译过程中收集的指令信息,指导对odex文件的精准静态重写,使其适应不同的系统环境。基于该方法实现原型系统,并对50个高流行度的应用进行了实验评估。实验结果表明,该原型系统能够有效实现odex文件重写,与重新编译应用相比,重写odex文件的时间开销平均仅为重新编译时间的6.85%。

关键词: 移动操作系统应用, 编译辅助, 二进制重写, odex

Abstract:

The mobile operating system translates application bytecode into machine code through pre-compilation and stores it in odex files to improve application startup and runtime efficiency. However, system framework updates invalidate these odex files, necessitating application recompilation and degrading user experience. One approach to avoid recompilation was to statically rewrite existing odex files, but existing static rewriting technologies paid little attention to odex files and the rewriting challenges posed by system environment changes. To address these issues, this paper proposed a compiler-assisted odex file rewriting method. During compilation, this method collected instruction information to guide precise static rewriting and adapt odex files to new system environments. This paper implemented a prototype system based on this method and evaluated it on 50 popular applications. The experimental results show that the method effectively rewrites odex files. The average time cost for rewriting is only 6.85% of the time required for recompilation.

Key words: mobile operating system application, compiler-assisted, binary rewriting, odex

中图分类号: