<div dir="ltr"><div dir="ltr"><div dir="ltr"><div><div>Hi, </div><div><br></div><div>I am trying to rewrite the custom function __dfsw_read in compiler-rt/lib/dfsan/dfsan_custom.cc, I wrote the function  __dfsw_read like this</div><div><br></div><div>dfsan_lib.c</div><div>```</div><div>#include <stdio.h></div><div>#include <sanitizer/dfsan_interface.h></div><div>__attribute__((visibility("default"))) ssize_t</div><div>__dfsw_read (int __fd, void *__buf, size_t __nbytes,</div><div>            dfsan_label __fd_label, dfsan_label __buf_label, dfsan_label __nbytes_label,</div><div>            dfsan_label *ret_label)</div><div>{</div><div>    ssize_t ret = read(__fd, __buf, __nbytes);</div><div><br></div><div>    if(ret != -1)</div><div>    {</div><div>        assign_taint_labels_exf(__buf, fd, ret, __nbytes);</div><div>        fd += ret;</div><div>    }</div><div><br></div><div>    *ret_label = 0;</div><div>    return ret;</div><div>}</div><div>```</div><div>with following ABI List:</div><div><br></div><div>dfsan_abilist.txt</div><div>```</div><div>fun:read=uninstrumented</div><div>fun:read=custom</div><div>```</div><div><br></div><div>Then, I pack the lib with </div><div>```</div><div>clang -Wall -fPIC -fsanitize-blacklist=./dfsan_abilist.txt -o dfsan_lib.o dfsan_lib.c</div><div>ar -rc dfsan_lib.o dfsan_lib.a</div><div>```</div><div><br></div><div>And then compile with my test program test.c</div><div>```</div><div>clang -fsanitize=dataflow -fsanitize-blacklist=./dfsan_abilist.txt -fPIC test.c -ldfsan_lib</div><div>```</div><div><br></div><div>Then error occurs which says that "__dfsw_read" has been defined in compiler-rt/lib/dfsan/dfsan_custom.cc.</div><div><br></div><div>Is there something I am missing or doing wrong in my steps?</div><div><br></div><div>Thanks!</div><div><br></div></div></div></div></div>