From 41e5f654019b873d3b34c267275e4a4421f746a2 Mon Sep 17 00:00:00 2001 From: Slava Barinov Date: Thu, 14 Sep 2017 12:42:17 +0300 Subject: [PATCH] [TTC-9] Make LSan compliant with recovery mode when running on top of ASan Don't overwrite exit code in LSan when running on top of ASan in recovery mode to avoid breakage of users code due to found leaks. Change-Id: I172f59734837d3df350c9e586ace2547ae9f3f23 Signed-off-by: Slava Barinov --- ChangeLog.Tizen | 7 +++++++ gcc/testsuite/gcc.dg/asan/leak_recover-1.c | 16 ++++++++++++++++ gcc/testsuite/gcc.dg/asan/leak_recover-2.c | 17 +++++++++++++++++ 3 files changed, 40 insertions(+) create mode 100644 gcc/testsuite/gcc.dg/asan/leak_recover-1.c create mode 100644 gcc/testsuite/gcc.dg/asan/leak_recover-2.c diff --git a/ChangeLog.Tizen b/ChangeLog.Tizen index 8d820cf..e7f241d 100644 --- a/ChangeLog.Tizen +++ b/ChangeLog.Tizen @@ -29,6 +29,13 @@ # log at the same time (actually you can't). However, if you update this # file after the commit hash is fixed, you are free to add the commit hash. ################################################################################ +2017-10-20 Slava Barinov + + [TTC-9] Enable recovery mode for ASan with leak detector + +2017-10-17 Mikhail Kashkarov + + Add armv7hl support. 2017-08-30 Sangmin Seo diff --git a/gcc/testsuite/gcc.dg/asan/leak_recover-1.c b/gcc/testsuite/gcc.dg/asan/leak_recover-1.c new file mode 100644 index 0000000..a17a72b --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/leak_recover-1.c @@ -0,0 +1,16 @@ +/* { dg-do run } */ +/* { dg-set-target-env-var ASAN_OPTIONS "halt_on_error=0" } */ + +#include + +int f () { + volatile int* a = malloc(20); + a[0] = 1; + return a[0]; +} + +int main() { + f(); +} + +/* { dg-output {Direct leak of 20 byte} } */ diff --git a/gcc/testsuite/gcc.dg/asan/leak_recover-2.c b/gcc/testsuite/gcc.dg/asan/leak_recover-2.c new file mode 100644 index 0000000..1f57fb4 --- /dev/null +++ b/gcc/testsuite/gcc.dg/asan/leak_recover-2.c @@ -0,0 +1,17 @@ +/* { dg-do run } */ +/* { dg-set-target-env-var ASAN_OPTIONS "halt_on_error=1" } */ +/* { dg-shouldfail "asan" } */ + +#include + +int f () { + volatile int* a = malloc(20); + a[0] = 1; + return a[0]; +} + +int main() { + f(); +} + +/* { dg-output {Direct leak of 20 byte} } */ -- 2.7.4