Module Name: src Committed By: rin Date: Mon Aug 7 00:54:54 UTC 2023
Modified Files: src/tests/usr.bin/c++: t_asan_global_buffer_overflow.sh src/tests/usr.bin/cc: t_asan_global_buffer_overflow.sh Log Message: t_asan_global_buffer_overflow: Avoid ODR Violation for pic variants Common symbol triggers ODR (One Definition Rule) Violation correctly, instead of Global Buffer Overflow. XXX Add test for odr_violation. To generate a diff of this commit: cvs rdiff -u -r1.3 -r1.4 \ src/tests/usr.bin/c++/t_asan_global_buffer_overflow.sh cvs rdiff -u -r1.3 -r1.4 \ src/tests/usr.bin/cc/t_asan_global_buffer_overflow.sh Please note that diffs are not public domain; they are subject to the copyright notices on the relevant files.
Modified files: Index: src/tests/usr.bin/c++/t_asan_global_buffer_overflow.sh diff -u src/tests/usr.bin/c++/t_asan_global_buffer_overflow.sh:1.3 src/tests/usr.bin/c++/t_asan_global_buffer_overflow.sh:1.4 --- src/tests/usr.bin/c++/t_asan_global_buffer_overflow.sh:1.3 Tue Jan 29 20:02:34 2019 +++ src/tests/usr.bin/c++/t_asan_global_buffer_overflow.sh Mon Aug 7 00:54:54 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_asan_global_buffer_overflow.sh,v 1.3 2019/01/29 20:02:34 mgorny Exp $ +# $NetBSD: t_asan_global_buffer_overflow.sh,v 1.4 2023/08/07 00:54:54 rin Exp $ # # Copyright (c) 2018, 2019 The NetBSD Foundation, Inc. # All rights reserved. @@ -31,12 +31,13 @@ ASAN_CODE=' #include <stdio.h> #include <stdlib.h> -int arr[5] = {-1}; void foo(int); #ifndef PIC_MAIN +extern int arr[]; void foo(int index) { arr[index] = 0; } #endif #ifndef PIC_FOO +int arr[5] = {-1}; int main(int argc, char **argv) {foo(argc + 5); printf("CHECK\n"); exit(0);} #endif ' Index: src/tests/usr.bin/cc/t_asan_global_buffer_overflow.sh diff -u src/tests/usr.bin/cc/t_asan_global_buffer_overflow.sh:1.3 src/tests/usr.bin/cc/t_asan_global_buffer_overflow.sh:1.4 --- src/tests/usr.bin/cc/t_asan_global_buffer_overflow.sh:1.3 Tue Jan 29 19:56:37 2019 +++ src/tests/usr.bin/cc/t_asan_global_buffer_overflow.sh Mon Aug 7 00:54:54 2023 @@ -1,4 +1,4 @@ -# $NetBSD: t_asan_global_buffer_overflow.sh,v 1.3 2019/01/29 19:56:37 mgorny Exp $ +# $NetBSD: t_asan_global_buffer_overflow.sh,v 1.4 2023/08/07 00:54:54 rin Exp $ # # Copyright (c) 2018, 2019 The NetBSD Foundation, Inc. # All rights reserved. @@ -31,12 +31,13 @@ ASAN_CODE=' #include <stdio.h> #include <stdlib.h> -int arr[5] = {-1}; void foo(int); #ifndef PIC_MAIN +extern int arr[]; void foo(int index) { arr[index] = 0; } #endif #ifndef PIC_FOO +int arr[5] = {-1}; int main(int argc, char **argv) {foo(argc + 5); printf("CHECK\n"); exit(0);} #endif '