summaryrefslogtreecommitdiff
path: root/open_issues/glibc/t/tls.mdwn
blob: b10703fd9075760d90d2e67d6aecc46f517adbe4 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
[[!meta copyright="Copyright © 2011, 2012, 2013 Free Software Foundation,
Inc."]]

[[!meta license="""[[!toggle id="license" text="GFDL 1.2+"]][[!toggleable
id="license" text="Permission is granted to copy, distribute and/or modify this
document under the terms of the GNU Free Documentation License, Version 1.2 or
any later version published by the Free Software Foundation; with no Invariant
Sections, no Front-Cover Texts, and no Back-Cover Texts.  A copy of the license
is included in the section entitled [[GNU Free Documentation
License|/fdl]]."]]"""]]

[[!tag open_issue_glibc open_issue_libpthread]]

# To Do

  * Discuss d2431f633e6139a62e1575ec18830f7e81160cf0 with Samuel.

  * Validate our implementation against
    <https://sourceware.org/glibc/wiki/TLSandSignals>.


# Documentation

[[!taglink open_issue_documentation]]

  * IRC, freenode, #hurd, 2011-11-26

        <tschwinge> In glibc multiarch support (strcasecmp for i686 SSE3, etc.)
          there is access to memory via gs: -- this will need to be changed for
          us, right?
        <youpi> depends on the access
        <tschwinge>       * `optimized strcasecmp and strncasecmp for x86-32`
          (multiarch),
        <tschwinge>         76e3966e9efc3808a9e7ad09121c5dfc1211c20b +
        <tschwinge>         6abf346582ba678f4850a88b4a5950593841df1d +
        <tschwinge>         5583a0862cf94f71cbcde91c4043a20af65facca.  `gs`
          access.
        <youpi> +       movl    __libc_tsd_LOCALE@GOTNTPOFF(%ebx), %eax
        <youpi> that's handled by the linker fine
        <youpi> it's only the things held in the tcb_t structure which can pose
          problem
        <tschwinge> tcbhead_t?
        <tschwinge> I'm looking at this.
        <tschwinge> So, at gs:0, there is the TCB.
        <tschwinge> And we have the same layout as NPTL/Linux, just that we
          don't have as much data there as they have.
        <tschwinge> We're missing multiple_threads, sysinfo, sttack_guard,
          pointer_guard, gscope_flag, private_futex, __private_tm[5].
        <tschwinge> So, if one of these is referenced (be it my name or by
          numeric offset), this is invalid for us.
        <tschwinge> Anything else should work equivalently.
        <youpi> yes
        <youpi> usually the only numeric offset being used is 0
        <youpi> so it would simply not build
        <tschwinge> And the other offsers are generated via tcb-offsets.sym.
        <tschwinge> glibc's elf/stackguard-macros.h is wrong for us (but not
          used anywhere apart from elf/tst-stackguard1.c, I think).

After commit a9538892adfbb9f092e0bb14ff3a1703973968af, it's
`sysdeps/i386/stackguard-macros.h`; problem remains.

        <tschwinge> __thread __locale_t __libc_tsd_LOCALE = &_nl_global_locale;
          -- this means that a __libc_tsd_LOCALE values will be in the TLS
          segment, and this is what is being accessed from the assembler code
          with %gs:__libc_tsd_LOCALE@NTPOFF, and the linker will resolve this.
        <youpi> yes
        <youpi> see in the nm output, the libc_tsd symbols
        <youpi> these provide the offsets
        <tschwinge> youpi: Thank you, I'm now understanding this part of TLS
          much better.
        <youpi> have you had a look at the tls.pdf from Uli ?
        <youpi> all the gory details are there :)

Commit c61b4d41c9647a54a329aa021341c0eb032b793e, [[!sourceware_PR 15754]], adds
`sysdeps/i386/stackguard-macros.h:POINTER_CHK_GUARD`, which is not correct for
us (at the moment), but it also shouldn't cause any harm, as this file is only
used in `elf/tst-ptrguard1.c` and `elf/tst-stackguard1.c`, which now will fail
to build for us, as we don't have a `pointer_guard` member in
`sysdeps/mach/hurd/tls.h:tcbhead_t`.

We don't define `THREAD_SET_POINTER_GUARD`.