* [PATCH] optionally disable global check
@ 2015-03-06 14:23 Marat Zakirov
2015-03-06 15:41 ` Yury Gribov
2015-03-11 19:50 ` Jakub Jelinek
0 siblings, 2 replies; 4+ messages in thread
From: Marat Zakirov @ 2015-03-06 14:23 UTC (permalink / raw)
To: gcc-patches; +Cc: Jakub Jelinek, Yury Gribov
[-- Attachment #1: Type: text/plain, Size: 152 bytes --]
Hi all!
Currently !ASAN_GLOBALS disables red-zones for global variables but
keeps their checks. This simple patch disables these checks too.
--Marat
[-- Attachment #2: mavdt-208_2.diff --]
[-- Type: text/x-patch, Size: 1241 bytes --]
gcc/ChangeLog:
2015-01-22 Marat Zakirov <m.zakirov@samsung.com>
* asan.c (instrument_derefs): asan-globals=0 disable instrumentation.
gcc/testsuite/ChangeLog:
2015-01-22 Marat Zakirov <m.zakirov@samsung.com>
* c-c++-common/asan/no-asan-check-glob.c: New test.
diff --git a/gcc/asan.c b/gcc/asan.c
index be28ede..c331f67 100644
--- a/gcc/asan.c
+++ b/gcc/asan.c
@@ -1809,6 +1809,8 @@ instrument_derefs (gimple_stmt_iterator *iter, tree t,
{
if (DECL_THREAD_LOCAL_P (inner))
return;
+ if (!ASAN_GLOBALS && is_global_var (inner))
+ return;
if (!TREE_STATIC (inner))
{
/* Automatic vars in the current function will be always
diff --git a/gcc/testsuite/c-c++-common/asan/no-asan-check-glob.c b/gcc/testsuite/c-c++-common/asan/no-asan-check-glob.c
new file mode 100644
index 0000000..a1b1410
--- /dev/null
+++ b/gcc/testsuite/c-c++-common/asan/no-asan-check-glob.c
@@ -0,0 +1,13 @@
+/* { dg-options "--param asan-globals=0 -fdump-tree-asan" } */
+/* { dg-do compile } */
+/* { dg-skip-if "" { *-*-* } { "-O0" } { "*" } } */
+
+extern int a;
+
+int foo ()
+{
+ return a;
+}
+
+/* { dg-final { scan-tree-dump-times "ASAN_CHECK" 0 "asan1" } } */
+/* { dg-final { cleanup-tree-dump "asan1" } } */
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] optionally disable global check
2015-03-06 14:23 [PATCH] optionally disable global check Marat Zakirov
@ 2015-03-06 15:41 ` Yury Gribov
2015-03-09 14:45 ` Jakub Jelinek
2015-03-11 19:50 ` Jakub Jelinek
1 sibling, 1 reply; 4+ messages in thread
From: Yury Gribov @ 2015-03-06 15:41 UTC (permalink / raw)
To: Marat Zakirov, Jakub Jelinek; +Cc: gcc-patches
On 03/06/2015 05:23 PM, Marat Zakirov wrote:
> Hi all!
>
> Currently !ASAN_GLOBALS disables red-zones for global variables but
> keeps their checks. This simple patch disables these checks too.
>
> --Marat
Jakub,
Given that this may be considered a bugfix for --param asan-globals,
perhaps this is ok for 5.0?
> 2015-01-22 Marat Zakirov <m.zakirov@samsung.com>
I think you'll want to update dates here.
> * asan.c (instrument_derefs): asan-globals=0 disable instrumentation.
s/asan-globals=0 disable instrumentation/Disable instrumentation on
asan-globals=0./g
-Y
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] optionally disable global check
2015-03-06 15:41 ` Yury Gribov
@ 2015-03-09 14:45 ` Jakub Jelinek
0 siblings, 0 replies; 4+ messages in thread
From: Jakub Jelinek @ 2015-03-09 14:45 UTC (permalink / raw)
To: Yury Gribov; +Cc: Marat Zakirov, gcc-patches
On Fri, Mar 06, 2015 at 06:41:38PM +0300, Yury Gribov wrote:
> On 03/06/2015 05:23 PM, Marat Zakirov wrote:
> >Hi all!
> >
> >Currently !ASAN_GLOBALS disables red-zones for global variables but
> >keeps their checks. This simple patch disables these checks too.
> >
> >--Marat
>
> Jakub,
>
> Given that this may be considered a bugfix for --param asan-globals, perhaps
> this is ok for 5.0?
>
>
> > 2015-01-22 Marat Zakirov <m.zakirov@samsung.com>
>
> I think you'll want to update dates here.
>
> > * asan.c (instrument_derefs): asan-globals=0 disable instrumentation.
>
> s/asan-globals=0 disable instrumentation/Disable instrumentation on
> asan-globals=0./g
Ok with those changes.
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] optionally disable global check
2015-03-06 14:23 [PATCH] optionally disable global check Marat Zakirov
2015-03-06 15:41 ` Yury Gribov
@ 2015-03-11 19:50 ` Jakub Jelinek
1 sibling, 0 replies; 4+ messages in thread
From: Jakub Jelinek @ 2015-03-11 19:50 UTC (permalink / raw)
To: Marat Zakirov; +Cc: gcc-patches, Yury Gribov
On Fri, Mar 06, 2015 at 05:23:47PM +0300, Marat Zakirov wrote:
> Hi all!
>
> Currently !ASAN_GLOBALS disables red-zones for global variables but keeps
> their checks. This simple patch disables these checks too.
I've noticed
UNRESOLVED: c-c++-common/asan/no-asan-check-glob.c -O0 scan-tree-dump-times asan1 "ASAN_CHECK" 0
UNRESOLVED: c-c++-common/asan/no-asan-check-glob.c -O2 -flto -fuse-linker-plugin -fno-fat-lto-objects scan-tree-dump-times asan1 "ASAN_CHECK" 0
in my last build, fixed thusly, committed as obvious:
2015-03-11 Jakub Jelinek <jakub@redhat.com>
* c-c++-common/asan/no-asan-check-glob.c: Add -ffat-lto-objects
to dg-options, fix up dg-skip-if.
--- gcc/testsuite/c-c++-common/asan/no-asan-check-glob.c.jj 2015-03-11 20:17:46.000000000 +0100
+++ gcc/testsuite/c-c++-common/asan/no-asan-check-glob.c 2015-03-11 20:47:22.010109724 +0100
@@ -1,6 +1,6 @@
-/* { dg-options "--param asan-globals=0 -fdump-tree-asan" } */
+/* { dg-options "--param asan-globals=0 -fdump-tree-asan1 -ffat-lto-objects" } */
/* { dg-do compile } */
-/* { dg-skip-if "" { *-*-* } { "-O0" } { "*" } } */
+/* { dg-skip-if "" { *-*-* } { "-O0" } { "" } } */
extern int a;
Jakub
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2015-03-11 19:50 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-03-06 14:23 [PATCH] optionally disable global check Marat Zakirov
2015-03-06 15:41 ` Yury Gribov
2015-03-09 14:45 ` Jakub Jelinek
2015-03-11 19:50 ` Jakub Jelinek
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).