Check the RELRO security flag
通俗解读
请在原生构建中启用 RELRO 标志;当 GNU_RELRO 与其他可写数据共享一个可写 LOAD 段时,其结束地址必须按 16 KB(0x4000)对齐。
- 现代链接器使用 RELRO,使重定位目标段(如 .got 和 .data.rel.ro)在动态重定位完成后变为只读。
- 当 GNU_RELRO 与之后的可写数据(如 .data 或 .bss)共享一个可写 LOAD 段时,必须满足 16 KB 对齐要求。
- 结束地址为 GNU_RELRO 段的 VirtAddr + MemSiz。
- 如果未对齐,Android 链接器会使同一 16 KB 页面内相邻的可写数据变为只读,写入时应用会因 SIGSEGV 崩溃。
- 这通常发生在使用 NDK 工具链 r27 及更低版本构建、且未启用相关标志的 .so 文件中。
官方原文摘录
To mitigate security exploits, modern linkers use the Relocation Read-Only (RELRO) flag to make relocation target sections (such as .got and .data.rel.ro) of the shared object file read-only after dynamic relocations are complete. Enable the RELRO flag in your build. When GNURELRO shares a writable LOAD segment with …
阅读官方全文 ↗ 在 StoreRules 规则库中打开 询问你的应用是否合规
变更历史
- · 修改
开发者关于此条款的案例
暂无案例。