[PATCH] D141389: [DFSAN] Add support for strnlen, strncat, strsep, sscanf and _tolower
Andrew via Phabricator via cfe-commits
cfe-commits at lists.llvm.org
Thu Mar 2 09:10:35 PST 2023
browneee added inline comments.
================
Comment at: compiler-rt/lib/dfsan/dfsan_custom.cpp:221
+ if (flags().strict_data_dependencies) {
+ *ret_label = res ? s_label : 0;
+ } else {
----------------
tkuchta wrote:
> browneee wrote:
> > When `res != NULL`, then `res` is derived from `*s`, not from `s`.
> >
> > e.g.
> >
> > ```
> > *ret_label = res ? dfsan_get_label(base) : 0;
> > ```
> Apologies for a delay.
>
> I came across some difficulty with using dfsan_get_label inside the dfsan_custom.cpp file.
> It seems that including the dfsan_interface.h header there, which would be needed for dfsan_get_label, causes other conflicts and build errors.
> Would there be another way to use that function inside dfsan_custom.cpp?
```
char *base = *s;
```
Here base is loaded, so we can also load the shadow.
`dfsan_get_label(base) == dfsan_read_label(s, sizeof(*s))`
If base was an argument, then it would have a corresponding label argument as part of the wrapper function, so you also wouldn't need `dfsan_get_label`.
Repository:
rCRT Compiler Runtime
CHANGES SINCE LAST ACTION
https://reviews.llvm.org/D141389/new/
https://reviews.llvm.org/D141389
More information about the cfe-commits
mailing list