[DFSan] Add `zeroext` attribute for callbacks with 8bit shadow variable arguments
Add `zeroext` attribute for below callbacks' first parameter (8bit shadow variable arguments) to conform to many platforms' ABI calling convention and some compiler behavior. - __dfsan_load_callback - __dfsan_store_callback - __dfsan_cmp_callback - __dfsan_conditional_callback - __dfsan_conditional_callback_origin - __dfsan_reaches_function_callback - __dfsan_reaches_function_callback_origin The type of these callbacks' first parameter is u8 (see the definition of `dfsan_label`). First, many platforms' ABI requires unsigned integer data types (except unsigned int) are zero-extended when stored in general-purpose register. Second, the problem is that compiler optimization may assume the arguments are zero-extended and, if not, misbehave, e.g. it uses an `i8` argument to index into a jump table. If the argument has non-zero high bits, the output executable may crash at run-time. So we need to add the `zeroext` attribute when declaring and calling them. Reviewed By: browneee, MaskRay Differential Revision: https://reviews.llvm.org/D140689
Loading
Please sign in to comment