/// value.
dfsan_label dfsan_get_label(long data);
+/// Retrieves the label associated with the data at the given address.
+dfsan_label dfsan_read_label(const void *addr, size_t size);
+
/// Retrieves a pointer to the dfsan_label_info struct for the given label.
const struct dfsan_label_info *dfsan_get_label_info(dfsan_label label);
}
extern "C" SANITIZER_INTERFACE_ATTRIBUTE
-dfsan_label __dfsan_union_load(dfsan_label *ls, size_t n) {
+dfsan_label __dfsan_union_load(const dfsan_label *ls, size_t n) {
dfsan_label label = ls[0];
for (size_t i = 1; i != n; ++i) {
dfsan_label next_label = ls[i];
return __dfsan_arg_tls[0];
}
+SANITIZER_INTERFACE_ATTRIBUTE dfsan_label
+dfsan_read_label(const void *addr, size_t size) {
+ if (size == 0)
+ return 0;
+ return __dfsan_union_load(shadow_for(addr), size);
+}
+
SANITIZER_INTERFACE_ATTRIBUTE
const struct dfsan_label_info *dfsan_get_label_info(dfsan_label label) {
__dfsan_retval_tls = 0; // Ensures return value is unlabelled in the caller.
dfsan_label new_label = dfsan_get_label(i);
assert(i_label == new_label);
+ dfsan_label read_label = dfsan_read_label(&i, sizeof(i));
+ assert(i_label == read_label);
+
return 0;
}
assert(dfsan_has_label(ijk_label, j_label));
assert(dfsan_has_label(ijk_label, k_label));
+ struct { int i, j; } s = { i, j };
+ assert(dfsan_read_label(&s, sizeof(s)) == ij_label);
+
return 0;
}