Re: Update: [PATCH 5/X] libsanitizer: mid-end: Introduce stack variable handling for HWASAN

2020-11-24 Thread Matthew Malcomson via Gcc-patches
On 24/11/2020 12:30, Hongtao Liu wrote: Hi: I'm learning about this patch, and I see one place that might be slighted improved. + poly_int64 size = (top - bot); + + /* Assert the edge of each variable is aligned to the HWASAN tag granule +size. */ + gcc_assert (multipl

Re: Update: [PATCH 5/X] libsanitizer: mid-end: Introduce stack variable handling for HWASAN

2020-11-24 Thread Hongtao Liu via Gcc-patches
Hi: I'm learning about this patch, and I see one place that might be slighted improved. + poly_int64 size = (top - bot); + + /* Assert the edge of each variable is aligned to the HWASAN tag granule +size. */ + gcc_assert (multiple_p (top, HWASAN_TAG_GRANULE_SIZE)); +

Re: Update: [PATCH 5/X] libsanitizer: mid-end: Introduce stack variable handling for HWASAN

2020-11-23 Thread Richard Sandiford via Gcc-patches
Sorry for the earlier OK, was replying to the wrong message… Matthew Malcomson writes: > @@ -1216,6 +1255,24 @@ expand_stack_vars (bool (*pred) (size_t), class > stack_vars_data *data) > { > offset = alloc_stack_frame_space (stack_vars[i].size, alignb); > base_a

Re: Update: [PATCH 5/X] libsanitizer: mid-end: Introduce stack variable handling for HWASAN

2020-11-23 Thread Richard Sandiford via Gcc-patches
Matthew Malcomson writes: > Hi there, > > I was just doing some double-checks and noticed I'd placed the > documentation in the wrong section of tm.texi. The `MEMTAG` hooks were > documented in the `Register Classes` section, so I've now moved it to > the `Misc` section. > > That's the only chang

Re: Update: [PATCH 5/X] libsanitizer: mid-end: Introduce stack variable handling for HWASAN

2020-11-20 Thread Matthew Malcomson via Gcc-patches
Hi there, I was just doing some double-checks and noticed I'd placed the documentation in the wrong section of tm.texi. The `MEMTAG` hooks were documented in the `Register Classes` section, so I've now moved it to the `Misc` section. That's the only change, Ok for trunk? Matthew ---

Re: Update: [PATCH 5/X] libsanitizer: mid-end: Introduce stack variable handling for HWASAN

2020-11-19 Thread Richard Sandiford via Gcc-patches
Matthew Malcomson writes: > […] > +/* hwasan_frame_base_init_seq is the sequence of RTL insns that will > initialize > + the hwasan_frame_base_ptr. When the hwasan_frame_base_ptr is requested, > we > + generate this sequence but do not emit it. If the sequence was created it > + is emitt

Update: [PATCH 5/X] libsanitizer: mid-end: Introduce stack variable handling for HWASAN

2020-11-19 Thread Matthew Malcomson via Gcc-patches
Hi there, After offline discussion with Richard I've modified the way in which the initialisation for the hwasan base pointer is emitted. Originally it was getting emitted during `expand_used_vars`, and requiring `handle_builtin_alloca` to register a need for it to be emitted so that `expand_HWASA

[PATCH 5/X] libsanitizer: mid-end: Introduce stack variable handling for HWASAN

2020-11-16 Thread Matthew Malcomson via Gcc-patches
Handling stack variables has three features. 1) Ensure HWASAN required alignment for stack variables When tagging shadow memory, we need to ensure that each tag granule is only used by one variable at a time. This is done by ensuring that each tagged variable is aligned to the tag granule repres

Re: [PATCH 5/X] libsanitizer: mid-end: Introduce stack variable handling for HWASAN

2020-11-04 Thread Richard Sandiford via Gcc-patches
Matthew Malcomson writes: > Hi Richard, > > I'm sending up the revised patch 5 (introducing stack variable handling) > without the other changes to other patches. > > I figure there's been quite a lot of changes to this patch and I wanted > to give you time to review them while I worked on finishi

[PATCH 5/X] libsanitizer: mid-end: Introduce stack variable handling for HWASAN

2020-11-03 Thread Matthew Malcomson via Gcc-patches
Hi Richard, I'm sending up the revised patch 5 (introducing stack variable handling) without the other changes to other patches. I figure there's been quite a lot of changes to this patch and I wanted to give you time to review them while I worked on finishing the less widespread changes in patch

Re: [PATCH 5/X] libsanitizer: mid-end: Introduce stack variable handling for HWASAN

2020-10-14 Thread Richard Sandiford via Gcc-patches
Matthew Malcomson writes: > @@ -75,6 +89,31 @@ extern hash_set *asan_used_labels; > > #define ASAN_USE_AFTER_SCOPE_ATTRIBUTE "use after scope memory" > > +/* NOTE: The values below define an ABI and are hard-coded to these values in > + libhwasan, hence they can't be changed independ

[PATCH 5/X] libsanitizer: mid-end: Introduce stack variable handling for HWASAN

2020-08-17 Thread Matthew Malcomson
Handling stack variables has three features. 1) Ensure HWASAN required alignment for stack variables When tagging shadow memory, we need to ensure that each tag granule is only used by one variable at a time. This is done by ensuring that each tagged variable is aligned to the tag granule repres

[PATCH 5/X] [libsanitizer][mid-end] Introduce stack variable handling for HWASAN

2019-12-12 Thread Matthew Malcomson
Handling stack variables has three features. 1) Ensure HWASAN required alignment for stack variables When tagging shadow memory, we need to ensure that each tag granule is only used by one variable at a time. This is done by ensuring that each tagged variable is aligned to the tag granule repres

Re: [PATCH 5/X] [libsanitizer][mid-end] Introduce stack variable handling for HWASAN

2019-11-20 Thread Joseph Myers
On Wed, 20 Nov 2019, Matthew Malcomson wrote: > I don't have much of a plan. > > The most promising lead I have is that libiberty/alloca.c has a similar > functionality but with macros to account for a special case. The comment in libiberty/aclocal.m4 is: # We always want a C version of alloca

Re: [PATCH 5/X] [libsanitizer][mid-end] Introduce stack variable handling for HWASAN

2019-11-20 Thread Matthew Malcomson
On 20/11/2019 14:46, Martin Liška wrote: > On 11/20/19 3:37 PM, Matthew Malcomson wrote: >> Hi Martin, >> >> Thanks for the review, > > You're welcome. > >> I'll get working on your comments now, but since I really enjoyed >> finding this bug in ./configure when I hit it I thought I'd answer this

Re: [PATCH 5/X] [libsanitizer][mid-end] Introduce stack variable handling for HWASAN

2019-11-20 Thread Martin Liška
On 11/20/19 3:37 PM, Matthew Malcomson wrote: Hi Martin, Thanks for the review, You're welcome. I'll get working on your comments now, but since I really enjoyed finding this bug in ./configure when I hit it I thought I'd answer this right away. Heh :) On 20/11/2019 14:02, Martin Liška

Re: [PATCH 5/X] [libsanitizer][mid-end] Introduce stack variable handling for HWASAN

2019-11-20 Thread Matthew Malcomson
Hi Martin, Thanks for the review, I'll get working on your comments now, but since I really enjoyed finding this bug in ./configure when I hit it I thought I'd answer this right away. On 20/11/2019 14:02, Martin Liška wrote: > On 11/7/19 7:37 PM, Matthew Malcomson wrote: >> >> diff --git a/con

Re: [PATCH 5/X] [libsanitizer][mid-end] Introduce stack variable handling for HWASAN

2019-11-20 Thread Martin Liška
On 11/7/19 7:37 PM, Matthew Malcomson wrote: Handling stack variables has three features. 1) Ensure HWASAN required alignment for stack variables When tagging shadow memory, we need to ensure that each tag granule is only used by one variable at a time. This is done by ensuring that each tagge

[PATCH 5/X] [libsanitizer][mid-end] Introduce stack variable handling for HWASAN

2019-11-07 Thread Matthew Malcomson
Handling stack variables has three features. 1) Ensure HWASAN required alignment for stack variables When tagging shadow memory, we need to ensure that each tag granule is only used by one variable at a time. This is done by ensuring that each tagged variable is aligned to the tag granule repres