Skip to content

Fixes for ASAN/MSAN#10

Open
vihangm wants to merge 13 commits into
gimlet_patches/3.11.0from
vihang/sanitizer_fixes
Open

Fixes for ASAN/MSAN#10
vihangm wants to merge 13 commits into
gimlet_patches/3.11.0from
vihang/sanitizer_fixes

Conversation

@vihangm
Copy link
Copy Markdown
Member

@vihangm vihangm commented Apr 28, 2026

No description provided.

vihangm added 13 commits April 27, 2026 22:58
…tizer

Clang -fsanitize=function flags indirect calls when resolved symbols do not match
exact C function pointer types even if the FFI is intentionally type-erased.
IREE_VM_ABI_* shims pass args/rets as target2 (void* ABI). The old typedef used
native_function_target_t (3-arg callback), which Clang's function sanitizer
correctly rejected at indirect call sites.
…nction)

target2_t now lives in native_module.h. Annotate IREE_VM_ABI_DEFINE_SHIM bodies
so Clang does not flag IREE_VM_ABI_EXPORT targets with concrete struct pointers.
…tive_function_target2_t

Keeps EXPORT_FN tables consistent with the codegen VM ABI shim path.
Adjust call_shim_i32_i32, yieldable shims, and bytecode benchmark shim to match
iree_vm_native_function_shim_t after target2.
Descriptors store iree_vm_ref_destroy_t (void (*)(void*)), while HAL-provided
destroy hooks use typed pointers; Clang resolves the resolved symbol.
Typed HAL objects register destroy with identical layout to
iree_hal_resource_vtable_t.destroy but Clang still flags mismatched prototypes.
iree_hal_cmd_apply_fn_t erases pointers to disparate apply_* signatures; annotate
apply() only.
Zero iree_allocator_alloc_params_t before passing to allocator.ctl so padding
is initialized. In the libc implementation, only read *inout_ptr for REALLOC;
malloc and calloc callers use that slot as an uninitialized out-parameter.
Set path to an empty string view explicitly in the static device_infos used
when cloning enumerated devices, avoiding partially initialized aggregates.
glibc memcpy is annotated nonnull; memcpy with NULL pointers is undefined
even when the length is zero. Only copy when key or metadata length is
positive.
Signed-off-by: Vihang Mehta <vihang@gimletlabs.ai>
Linux sysfs cluster_id values can exceed 63; shifting 1ull by that amount is
undefined behavior. Fold the id modulo 64 so the shift is always valid.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant