On Thu, Nov 14, 2013 at 10:09 PM, Jakub Jelinek <ja...@redhat.com> wrote:
> On Thu, Nov 14, 2013 at 07:08:17PM +0100, Jakub Jelinek wrote:
>> On Thu, Nov 14, 2013 at 09:56:36PM +0400, Konstantin Serebryany wrote:
>> > I thought about alignment but did not reflect it anywhere in the
>> > interface/comments.
>> > The alignment should be min(4096, N), which is enough for most purposes.
>>
>> You mean max(4096, N), right?
>
> Oops, of course min.
>
>> And, what exactly is N?  1 << (class_id + 6)?

Right.
The minimal allocation unit is 64-aligned 64-bytes.
Then 128-aligned 128-bytes and so on up to 4096.
Then only 4096-alignment is guaranteed.

These are the chunks returned by  __asan_stack_malloc.
The compiler pads them with redzones which in clang (and IIRC in gcc)
are 32-aligned 32-bytes.

You raised a valid concern about 512-bit (64-byte) alignment.
Clang asan does not support that now (will just not add a redzone to
such variables).
Someday we'll implement adaptable redzones for stack (we did that for
globals and heap already) which will fix this.

--kcc


>
> But this is valid.
>
>         Jakub

Reply via email to