Skip to content

Commit f23dd8e

Browse files
committed
[DFSan] Add missing documentation for -dfsan-reaches-function-callbacks.
1 parent dcd08da commit f23dd8e

File tree

1 file changed

+24
-0
lines changed

1 file changed

+24
-0
lines changed

clang/docs/DataFlowSanitizer.rst

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -233,6 +233,30 @@ labels of just ``v1`` and ``v2``.
233233
or, and can be accessed using
234234
``dfsan_label dfsan_get_labels_in_signal_conditional();``.
235235

236+
* ``-dfsan-reaches-function-callbacks`` -- An experimental feature that inserts
237+
callbacks for data entering a function.
238+
239+
In addition to this compilation flag, a callback handler must be registered
240+
using ``dfsan_set_reaches_function_callback(my_callback);``, where my_callback is
241+
a function with a signature matching
242+
``void my_callback(dfsan_label label, dfsan_origin origin,
243+
const char *file, unsigned int line,
244+
const char *function);``
245+
This signature is the same when origin tracking is disabled - in this case
246+
the dfsan_origin passed in it will always be 0.
247+
248+
The callback will be called when a tained value reach stack/registers
249+
in the context of a function. Tainted values can reach a function:
250+
* via the arguments of the function
251+
* via the return value of a call that occurs in the function
252+
* via the loaded value of a load that occurs in the function
253+
254+
The callback will be skipped for conditional expressions inside signal
255+
handlers, as this is prone to deadlock. Tainted values reaching functions
256+
inside signal handlers will instead be aggregated via bitwise or, and can
257+
be accessed using
258+
``dfsan_label dfsan_get_labels_in_signal_reaches_function()``.
259+
236260
* ``-dfsan-track-origins`` -- Controls how to track origins. When its value is
237261
0, the runtime does not track origins. When its value is 1, the runtime tracks
238262
origins at memory store operations. When its value is 2, the runtime tracks

0 commit comments

Comments
 (0)