Hi to all,
there is a way to poison bytes as read-only in the ASAN runtime?
For instance, I have a type field in a dynamic allocated structure that is 
assigned only at creation
and I want to mark it as read-only after the first assignment to detect 
type-confusions.
I found nothing searching about it in compiler-rt and so this is more a 
feature request, but maybe I missed it and already exists.

Something like the following snippet would be useful:

enum {
  IS_INT,
  IS_FLOAT
};
struct foo {
  int type;
  union { int i; float f };
};

struct foo* create_int_foo(int i) {
  struct foo * f = malloc(sizeof(struct foo));
  f->i = i;
  f->type = IS_INT;
  ASAN_POISON_RDONLY_MEMORY_REGION(&f->type, sizeof(int));
}

Thank you!

-- 
You received this message because you are subscribed to the Google Groups 
"address-sanitizer" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to address-sanitizer+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/address-sanitizer/29bb9619-d1ba-4426-8eaf-068b3c795337%40googlegroups.com.

Reply via email to