This is the mail archive of the glibc-bugs@sourceware.org mailing list for the glibc project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]
Other format: [Raw text]

[Bug nptl/16796] New: [aarch64] pthread_self not aligned to 16 bytes when heap grows up


https://sourceware.org/bugzilla/show_bug.cgi?id=16796

            Bug ID: 16796
           Summary: [aarch64] pthread_self not aligned to 16 bytes when
                    heap grows up
           Product: glibc
           Version: 2.19
            Status: NEW
          Severity: normal
          Priority: P2
         Component: nptl
          Assignee: unassigned at sourceware dot org
          Reporter: michael.hudson at linaro dot org
                CC: drepper.fsp at gmail dot com

Hi,

There is a test in glibc (tst-tls5) that tests that
((uintptr_t)pthread_self())%16 is zero.  But watch this:

(t-mwhudson)mwhudson@am1:~$ cat btp.c 
#include <stdint.h>
#include <stdio.h>
#include <pthread.h>

int
main(int argc, char** argv)
{
        uintptr_t p = (uintptr_t)__builtin_thread_pointer();
        uintptr_t q = (uintptr_t)pthread_self();
        printf("p: %lx %ld\n", p, p%16);
        printf("q: %lx %ld\n", q, q%16);
}
(t-mwhudson)mwhudson@am1:~$ gcc -o btp btp.c -lpthread
(t-mwhudson)mwhudson@am1:~$ ulimit -s unlimited
(t-mwhudson)mwhudson@am1:~$ ./btp
p: 2000028d88 8
q: 2000028698 8
(t-mwhudson)mwhudson@am1:~$ ulimit -S -s 8192
(t-mwhudson)mwhudson@am1:~$ ./btp
p: 7f7fd086f0 0
q: 7f7fd08000 0

So something is clearly wrong; maybe it's just that the test is too strict, but
somehow that seems a bit unlikely.  FWIW, this doesn't happen if you don't link
with libpthread so maaaaybe it's a bug in something that ends up in
libpthread's .init section?

-- 
You are receiving this mail because:
You are on the CC list for the bug.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]