1 /* { dg-do run } */ 2 /* { dg-shouldfail "asan" } */ 3 4 #include <sanitizer/asan_interface.h> 5 6 struct vfsmount {}; 7 struct dentry {}; 8 9 struct path { 10 struct vfsmount *mnt; 11 struct dentry *dentry; 12 }; 13 14 struct fs_struct { 15 int users; 16 int lock; 17 int seq; 18 int umask; 19 int in_exec; 20 struct path root, pwd; 21 }; 22 23 void __attribute__((noinline, noclone)) copy_fs_struct(struct fs_struct * a,struct fs_struct * b)24copy_fs_struct(struct fs_struct *a, struct fs_struct *b) { 25 a->root = b->root; 26 } 27 28 struct fs_struct a, b; 29 30 int main()31main () { 32 __asan_poison_memory_region (&a.root, sizeof (a.root)); 33 copy_fs_struct (&a, &b); 34 return 0; 35 } 36 37 /* { dg-output "ERROR: AddressSanitizer:\[^\n\r]*on address\[^\n\r]*" } */ 38