v2
2026-11-09
修复 arm64 noinstr 插桩逃逸 · v2
arm64 强制内联 noinstr 等路径辅助函数,并禁用库分支 profiling、标记 alternatives 辅助为 noinst。
原始补丁链接
子 Patch(6)
1/6
arm64: percpu: Always inline helpers used by noinstr code
per-CPU偏移/读取helper改用__always_inline,防止size优化下__kern_my_cpu_offset等生成到.text,保证noinstr入口与栈回溯代码不被插桩。
2/6
arm64: entry: Always inline helpers used by non-instrumentable paths
把MTE/SME进出用户态helper及CPU特性检查改为__always_inline,并改用tif_test_bit(TIF_SME),避免size优化生成.text副本破坏noinstr约束。
3/6
kasan: Always inline kasan_hw_tags_enabled()
将kasan_hw_tags_enabled()设为__always_inline,使arm64 MTE noinstr进出路径的硬件标签检查随调用者内联,避免size优化下在.text生成可插桩函数。
4/6
arm64: stacktrace: Always inline internal stack boundary helpers
把arm64共享栈边界与帧记录helper改为__always_inline,防止size优化将unwind_find_stack等栈信息helper生成到.text,确保noinstr栈回溯不执行可插桩代码。
5/6
arm64: lib: Disable branch profiling for architecture library code
在arch/arm64/lib/Makefile禁用分支profiling,因libs-y构建未继承arm64 Kbuild的ccflags,避免替代指令应用等库代码被profiling宏插桩。
6/6
arm64: alternatives: Make branch and ADRP offset helpers noinst
将branch/ADRP偏移helper标为noinstr,并内联私有immediate编解码与掩码helper,防止ftrace在patch_alternative等待cache维护期间插桩。