Force udst ctx->#reg load to be volatile
This is related to issue #1133. Compiler sometimes
generates code patterns likes:
r1 = ctx + 96
goto next
here:
r1 = ctx + 48
next:
r3 = load (r1 + 0)
Verifier will fail for such cases as r1 is marked
as "unknown" at the time of load.
The previous workaround is to add volatile attribute
to the store like
*(volatile u64 *)&dest = ctx->bx
The hope is to force ctx related load in-place since
its value is needed for store.
Unfortunately, this does not always work and compiler
still has freedom to merge different ctx loads at the
same time honoring the volatile &dest. In USDT generated
code, different branches of &dest are the same.
This patch directly make ctx->bx itself as a volatile load:
*(volatile u64 *)&ctx->bx
This seems working as compiler stops playing around
the address pointing to a volatile data.
Signed-off-by: Yonghong Song <yhs@fb.com>
Showing
Please register or sign in to comment