dynamorio icon indicating copy to clipboard operation
dynamorio copied to clipboard

indirect branch lookup should have barriers for either both mask and table or neither?

Open derekbruening opened this issue 1 year ago • 1 comments

Looking at the arm and aarch64 emit_indirect_branch_lookup() they both have synchronization to handle a concurrently updated hash mask, but nothing when loading the lookuptable address. update_lookuptable_tls() uses a store-release when updating the mask -- but not the lookuptable. I'm not understanding that. Since these tables are all private anyway (-shard_{bb,trace}_ibt_tables are false by default) it doesn't matter in default runs?? But if they're private why don't we avoid the barrier for the mask under those options? Shouldn't we either have barriers for both the mask and table or for neither?

derekbruening avatar Oct 25 '23 16:10 derekbruening

Should we put the barrier on the lookuptable instead of the mask? e.g. for AArch64:

# emit_indirect_branch_lookup

ldr xx, [x28, hash_mask]
ldar xx, [x28, hash_table]

# update_lookuptable_tls

stlr xx, [x28, hash_table]
str xx, [x28, hash_mask]

ksco avatar Oct 25 '23 17:10 ksco