Re: [PATCH] Optionally sanitize globals in user-defined sections

2015-04-22 Thread Jakub Jelinek
On Wed, Apr 22, 2015 at 12:26:57PM +0300, Yury Gribov wrote: > On 04/22/2015 12:00 PM, Jakub Jelinek wrote: > >On Wed, Apr 22, 2015 at 11:43:53AM +0300, Yury Gribov wrote: > >>@@ -272,7 +273,7 @@ along with GCC; see the file COPYING3. If not see > >> > >> static unsigned HOST_WIDE_INT asan_shadow

Re: [PATCH] Optionally sanitize globals in user-defined sections

2015-04-22 Thread Yury Gribov
On 04/22/2015 12:00 PM, Jakub Jelinek wrote: On Wed, Apr 22, 2015 at 11:43:53AM +0300, Yury Gribov wrote: @@ -272,7 +273,7 @@ along with GCC; see the file COPYING3. If not see static unsigned HOST_WIDE_INT asan_shadow_offset_value; static bool asan_shadow_offset_computed; -static const cha

Re: [PATCH] Optionally sanitize globals in user-defined sections

2015-04-22 Thread Jakub Jelinek
On Wed, Apr 22, 2015 at 11:43:53AM +0300, Yury Gribov wrote: > @@ -272,7 +273,7 @@ along with GCC; see the file COPYING3. If not see > > static unsigned HOST_WIDE_INT asan_shadow_offset_value; > static bool asan_shadow_offset_computed; > -static const char *sanitized_sections; > +static vec *s

Re: [PATCH] Optionally sanitize globals in user-defined sections

2015-04-22 Thread Yury Gribov
On 04/22/2015 11:31 AM, Yury Gribov wrote: On 04/19/2015 06:11 PM, Jakub Jelinek wrote: On Sun, Apr 19, 2015 at 10:54:57AM +0300, Yury Gribov wrote: On 04/17/2015 08:29 PM, Andi Kleen wrote: Yury Gribov writes: + +static bool +section_sanitized_p (const char *sec) +{ + if (!sanitized_sectio

Re: [PATCH] Optionally sanitize globals in user-defined sections

2015-04-22 Thread Yury Gribov
On 04/19/2015 06:11 PM, Jakub Jelinek wrote: On Sun, Apr 19, 2015 at 10:54:57AM +0300, Yury Gribov wrote: On 04/17/2015 08:29 PM, Andi Kleen wrote: Yury Gribov writes: + +static bool +section_sanitized_p (const char *sec) +{ + if (!sanitized_sections) +return false; + size_t len = strle

Re: [PATCH] Optionally sanitize globals in user-defined sections

2015-04-19 Thread Jakub Jelinek
On Sun, Apr 19, 2015 at 10:54:57AM +0300, Yury Gribov wrote: > On 04/17/2015 08:29 PM, Andi Kleen wrote: > >Yury Gribov writes: > >>+ > >>+static bool > >>+section_sanitized_p (const char *sec) > >>+{ > >>+ if (!sanitized_sections) > >>+return false; > >>+ size_t len = strlen (sec); > >>+ c

Re: [PATCH] Optionally sanitize globals in user-defined sections

2015-04-19 Thread Yury Gribov
On 04/17/2015 08:29 PM, Andi Kleen wrote: Yury Gribov writes: + +static bool +section_sanitized_p (const char *sec) +{ + if (!sanitized_sections) +return false; + size_t len = strlen (sec); + const char *p = sanitized_sections; + while ((p = strstr (p, sec))) +{ + if ((p == san

Re: [PATCH] Optionally sanitize globals in user-defined sections

2015-04-17 Thread Andi Kleen
Yury Gribov writes: > + > +static bool > +section_sanitized_p (const char *sec) > +{ > + if (!sanitized_sections) > +return false; > + size_t len = strlen (sec); > + const char *p = sanitized_sections; > + while ((p = strstr (p, sec))) > +{ > + if ((p == sanitized_sections || p[-1

Re: [PATCH] Optionally sanitize globals in user-defined sections

2015-04-17 Thread Jakub Jelinek
On Fri, Apr 17, 2015 at 10:37:50AM +0300, Yury Gribov wrote: > commit 97c141d9be45b29fb7e281dc2b7cd904e93c2813 > Author: Yury Gribov > Date: Mon Feb 2 14:33:17 2015 +0300 > > 2015-04-17 Yury Gribov > > gcc/ > * asan.c (set_sanitized_sections): New function. > (sectio

Re: [PATCH] Optionally sanitize globals in user-defined sections

2015-04-17 Thread Yury Gribov
On 04/17/2015 10:33 AM, Yury Gribov wrote: Hi all, This patch adds an optional support for sanitizing user-defined sections. Usually this is a bad idea because ASan changes relative position of variables in section thus breaking user assumptions. But this is a desired feature for kernel which