This is an archive of the discontinued LLVM Phabricator instance.

[BPF] Permit all user instructed offset relocatiions
ClosedPublic

Authored by yonghong-song on Sep 17 2019, 8:10 PM.

Details

Summary

Currently, not all user specified relocations
(with clang intrinsic __builtin_preserve_access_index())
will turn into relocations.

In the current implementation, a builtin_preserve_access_index()
chain is turned into relocation only if the result of the clang
intrinsic is used in a function call or a nonzero offset computation
of getelementptr. For all other cases, the relocatiion request
is ignored and the
builtin_preserve_access_index() is turned
into regular getelementptr instructions.
The main reason is to mimic bpf_probe_read() requirement.

But there are other use cases where relocatable offset is
generated but not used for bpf_probe_read(). This patch
relaxed previous constraints when to generate relocations.
Now, all user __builtin_preserve_access_index() will have
relocations generated.

Diff Detail

Event Timeline

yonghong-song created this revision.Sep 17 2019, 8:10 PM
Herald added a project: Restricted Project. · View Herald TranscriptSep 17 2019, 8:10 PM
ast accepted this revision.Sep 17 2019, 8:17 PM

thanks for the quick fix.

This revision is now accepted and ready to land.Sep 17 2019, 8:17 PM
This revision was automatically updated to reflect the committed changes.