This is the mail archive of the
gcc-patches@gcc.gnu.org
mailing list for the GCC project.
Re: libsanitizer merge from upstream r191666
- From: Konstantin Serebryany <konstantin dot s dot serebryany at gmail dot com>
- To: Jakub Jelinek <jakub at redhat dot com>
- Cc: GCC Patches <gcc-patches at gcc dot gnu dot org>, Dodji Seketeli <dodji at redhat dot com>, Dmitry Vyukov <dvyukov at google dot com>
- Date: Fri, 15 Nov 2013 12:06:25 +0400
- Subject: Re: libsanitizer merge from upstream r191666
- Authentication-results: sourceware.org; auth=none
- References: <CAGQ9bdzrx07_OfvCcxm_uFUt3MRhg1gwqdHvmK_9kHDmz1vPVw at mail dot gmail dot com> <CAGQ9bdxj-DmEaoo0mOWfSVXsrhVShWj3onHZRxiwt97Vq6J45w at mail dot gmail dot com> <20131029121355 dot GY30970 at tucnak dot zalov dot cz> <CAGQ9bdw+VW=yF+vaqE_0GkyHUChL_vp3cABZf-FuNYoHo3g=eg at mail dot gmail dot com> <20131029135236 dot GB30970 at tucnak dot zalov dot cz> <CAGQ9bdwHhvDksRcWqn3udeDy=7xAtXueo63Km_h=To9PZ7Li8g at mail dot gmail dot com> <20131114153349 dot GC27813 at tucnak dot zalov dot cz> <CAGQ9bdwc8gw1Am1T9-jKdweiGkThKy-n7m65CMLSHsJnAp7DHA at mail dot gmail dot com> <20131114180817 dot GF27813 at tucnak dot zalov dot cz> <20131114180906 dot GE21875 at tucnak dot zalov dot cz>
On Thu, Nov 14, 2013 at 10:09 PM, Jakub Jelinek <jakub@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