Skip to content

[TSan] ocamlrun should never be linked with -fsanitize=thread #13042

@OlivierNicole

Description

@OlivierNicole

Currently, when the compiler is configured with TSan enabled, only native programs are compiled with TSan instrumentation; bytecode programs produced by ocamlc are not. However, ocamlrun gets linked with the -fsanitize=thread flag. This is bad, because it causes some libc functions like mmap or memmove to be intercepted and replaced with special TSan versions, even though none of the OCaml nor C runtime is instrumented.

The consequences so far have been minor (we usually don’t use bytecode when TSan is enabled and vice versa), but it causes some occasional false alarms in the TSan CI, like lib-format/mc_pr586_par.ml, which has been flaky for a while. This false alarm is due to TSan seeing memory being accessed by the occasional memmove or strcpy, without any synchronization (because the synchronization operations are not instrumented).

Ideally, ocamlrun should not be linked with -fsanitize=thread.

Metadata

Metadata

Assignees

Labels

No labels
No labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions