Re: [PATCH] Add missing store in emission of asan_stack_free.

2020-06-10 Thread Jakub Jelinek via Gcc-patches
On Wed, Jun 10, 2020 at 01:14:59PM +0200, Martin Liška wrote: > >From 4d2e0b1e87b08ec21fd82144f00d364687030706 Mon Sep 17 00:00:00 2001 > From: Martin Liska > Date: Tue, 19 May 2020 16:57:56 +0200 > Subject: [PATCH] Add missing store in emission of asan_stack_free. > > gcc/ChangeLog: > >

Re: [PATCH] Add missing store in emission of asan_stack_free.

2020-06-10 Thread Martin Liška
On 6/10/20 12:08 PM, Jakub Jelinek wrote: On Wed, Jun 10, 2020 at 11:49:01AM +0200, Martin Liška wrote: - store_by_pieces (shadow_mem, sz, builtin_memset_read_str, , -BITS_PER_UNIT, true, RETURN_BEGIN); + { + /* Emit: + memset(ShadowBase,

Re: [PATCH] Add missing store in emission of asan_stack_free.

2020-06-10 Thread Jakub Jelinek via Gcc-patches
On Wed, Jun 10, 2020 at 11:49:01AM +0200, Martin Liška wrote: > - store_by_pieces (shadow_mem, sz, builtin_memset_read_str, , > - BITS_PER_UNIT, true, RETURN_BEGIN); > + { > + /* Emit: > +memset(ShadowBase, kAsanStackAfterReturnMagic, ShadowSize); > +

Re: [PATCH] Add missing store in emission of asan_stack_free.

2020-06-10 Thread Martin Liška
On 6/10/20 10:42 AM, Jakub Jelinek wrote: E.g. we just shouldn't reuse MEMs (even after adjusting them) from different indirection levels because we risk some attributes (alias set, MEM_EXPR, whatever else) will stay around from the different indirection level. All right, what about the

Re: [PATCH] Add missing store in emission of asan_stack_free.

2020-06-10 Thread Jakub Jelinek via Gcc-patches
On Wed, Jun 10, 2020 at 10:24:59AM +0200, Martin Liška wrote: > > > This doesn't look correct to me. > > > I'd think the first adjust_address should be > > >   mem = adjust_address (mem, ptr_mode, offset); > > > which will give you a MEM with ptr_mode which has SavedFlagPtr(FakeStack) > > >

Re: [PATCH] Add missing store in emission of asan_stack_free.

2020-06-10 Thread Martin Liška
On 6/1/20 3:18 PM, Martin Liška wrote: On 6/1/20 2:52 PM, Jakub Jelinek wrote: On Mon, Jun 01, 2020 at 02:28:51PM +0200, Martin Liška wrote: --- a/gcc/asan.c +++ b/gcc/asan.c @@ -1598,8 +1598,24 @@ asan_emit_stack_protection (rtx base, rtx pbase, unsigned int alignb,     if

Re: [PATCH] Add missing store in emission of asan_stack_free.

2020-06-01 Thread Martin Liška
On 6/1/20 2:52 PM, Jakub Jelinek wrote: On Mon, Jun 01, 2020 at 02:28:51PM +0200, Martin Liška wrote: --- a/gcc/asan.c +++ b/gcc/asan.c @@ -1598,8 +1598,24 @@ asan_emit_stack_protection (rtx base, rtx pbase, unsigned int alignb, if (use_after_return_class < 5 &&

Re: [PATCH] Add missing store in emission of asan_stack_free.

2020-06-01 Thread Jakub Jelinek via Gcc-patches
On Mon, Jun 01, 2020 at 02:28:51PM +0200, Martin Liška wrote: > --- a/gcc/asan.c > +++ b/gcc/asan.c > @@ -1598,8 +1598,24 @@ asan_emit_stack_protection (rtx base, rtx pbase, > unsigned int alignb, >if (use_after_return_class < 5 > && can_store_by_pieces (sz,

Re: [PATCH] Add missing store in emission of asan_stack_free.

2020-06-01 Thread Martin Liška
On 5/20/20 1:03 PM, Franz Sirl wrote: Am 2020-05-19 um 21:05 schrieb Martin Liška: Hi. We make direct emission for asan_emit_stack_protection for smaller stacks. That's fine but we're missing the piece that marks the stack as released and we run out of pre-allocated stacks. I also included

Re: [PATCH] Add missing store in emission of asan_stack_free.

2020-05-20 Thread Franz Sirl
Am 2020-05-19 um 21:05 schrieb Martin Liška: Hi. We make direct emission for asan_emit_stack_protection for smaller stacks. That's fine but we're missing the piece that marks the stack as released and we run out of pre-allocated stacks. I also included some stack-related constants that were