diff --git a/clang/docs/DataFlowSanitizer.rst b/clang/docs/DataFlowSanitizer.rst --- a/clang/docs/DataFlowSanitizer.rst +++ b/clang/docs/DataFlowSanitizer.rst @@ -214,6 +214,25 @@ void __dfsan_mem_transfer_callback(dfsan_label *Start, size_t Len); void __dfsan_cmp_callback(dfsan_label CombinedLabel); +* ``-dfsan-conditional-callbacks`` -- An experimental feature that inserts + callbacks for control flow conditional expressions. + This can be used to find where tainted values can control execution. + + In addition to this compilation flag, a callback handler must be registered + using ``dfsan_set_conditional_callback(my_callback);``, where my_callback is + a function with a signature matching + ``void my_callback(dfsan_label l, dfsan_origin o);``. + This signature is the same when origin tracking is disabled - in this case + the dfsan_origin passed in it will always be 0. + + The callback will only be called when a tainted value reaches a conditional + expression for control flow (such as an if's condition). + The callback will be skipped for conditional expressions inside signal + handlers, as this is prone to deadlock. Tainted values used in conditional + expressions inside signal handlers will instead be aggregated via bitwise + or, and can be accessed using + ``dfsan_label dfsan_get_labels_in_signal_conditional();``. + * ``-dfsan-track-origins`` -- Controls how to track origins. When its value is 0, the runtime does not track origins. When its value is 1, the runtime tracks origins at memory store operations. When its value is 2, the runtime tracks