[Date Prev][Date Next] [Thread Prev][Thread Next] [Date Index] [Thread Index]

Bug#226716: marked as done (libc6: TLS doesn't work with LD_ASSUME_KERNEL < 2.6.0)



Your message dated Mon, 10 Apr 2006 20:42:04 -0700
with message-id <E1FT9lU-0001Wn-Es@spohr.debian.org>
and subject line Bug#226716: fixed in glibc 2.3.6-6
has caused the attached Bug report to be marked as done.

This means that you claim that the problem has been dealt with.
If this is not the case it is now your responsibility to reopen the
Bug report if necessary, and/or fix the problem forthwith.

(NB: If you are a system administrator and have no idea what I am
talking about this indicates a serious mail system misconfiguration
somewhere.  Please contact me immediately.)

Debian bug tracking system administrator
(administrator, Debian Bugs database)

--- Begin Message ---
Package: libc6
Version: 2.3.2.ds1-10
Severity: important

TLS doesn't work properly with LD_ASSUME_KERNEL < 2.6.0.  I don't have
a machine with 2.4 kernel currently, so I can't say whether it's only
broken on 2.6 kernels when setting LD_ASSUME_KERNEL or whether it's
broken on older kernels too.

The appended code creates 5 additional threads.  Each of these and the
main thread set a thread-local variable to unique numbers.  When
execution continues after the barrier, all threads still should see
the value they stored to the thread-local variable.

This works fine on 2.6 kernels without setting LD_ASSUME_KERNEL to
something less than 2.6.0:

,----
| % gcc -Wall -D_GNU_SOURCE -pthread tls.c -o tls
| % ./tls
| BEFORE_BARRIER: primordial thread: tls_var is 0 (0x4000f8fc)
| BEFORE BARRIER: thread 1: test tls_var == 1 (0x40810bcc)
| BEFORE BARRIER: thread 2: test tls_var == 2 (0x41011bcc)
| BEFORE BARRIER: thread 3: test tls_var == 3 (0x41812bcc)
| BEFORE BARRIER: thread 4: test tls_var == 4 (0x42013bcc)
| BEFORE BARRIER: thread 5: test tls_var == 5 (0x42814bcc)
| AFTER BARRIER:  thread 1: test tls_var == 1 (0x40810bcc) OK
| AFTER BARRIER:  thread 2: test tls_var == 2 (0x41011bcc) OK
| AFTER BARRIER:  thread 5: test tls_var == 5 (0x42814bcc) OK
| AFTER BARRIER:  thread 3: test tls_var == 3 (0x41812bcc) OK
| AFTER BARRIER:  thread 4: test tls_var == 4 (0x42013bcc) OK
| AFTER BARRIER:  primordial thread: tls_var is 0 (0x4000f8fc) OK
`----

But if I set LD_ASSUME_KERNEL to something less than 2.6.0, the
variable isn't thread-local at all.  After the barrier all threads see
the value used by last thread doing 'tls_var = i'.  Also note that the
address of tls_var is the same in all threads:

,----
| % LD_ASSUME_KERNEL=2.4.1 ./tls 
| BEFORE_BARRIER: primordial thread: tls_var is 0 (0x400608bc)
| BEFORE BARRIER: thread 1: test tls_var == 1 (0x400608bc)
| BEFORE BARRIER: thread 2: test tls_var == 2 (0x400608bc)
| BEFORE BARRIER: thread 3: test tls_var == 3 (0x400608bc)
| BEFORE BARRIER: thread 4: test tls_var == 4 (0x400608bc)
| BEFORE BARRIER: thread 5: test tls_var == 5 (0x400608bc)
| AFTER BARRIER:  thread 1: test tls_var == 5 (0x400608bc) BROKEN
| AFTER BARRIER:  thread 2: test tls_var == 5 (0x400608bc) BROKEN
| AFTER BARRIER:  thread 3: test tls_var == 5 (0x400608bc) BROKEN
| AFTER BARRIER:  thread 5: test tls_var == 5 (0x400608bc) OK
| AFTER BARRIER:  thread 4: test tls_var == 5 (0x400608bc) BROKEN
| AFTER BARRIER:  primordial thread: tls_var is 5 (0x400608bc) BROKEN
`----

[If this is broken on 2.4 kernels too, then this may explain the
problems some people had with the TLS version of NVIDIA's GL stuff.]


// tls.c
#include <pthread.h>
#include <stdio.h>

#define THREADS 5

pthread_barrier_t barrier;
pthread_t threads[THREADS];

__thread int tls_var;

void *f(void *num)
{
    int i = (int) num;
    int value_before;

    tls_var = i;
    value_before = tls_var;
 
    printf("BEFORE BARRIER: thread %d: test tls_var == %d (%p)\n",
           i, tls_var, &tls_var);

    pthread_barrier_wait(&barrier);

    printf("AFTER BARRIER:  thread %d: test tls_var == %d (%p) %s\n",
           i, tls_var, &tls_var, tls_var == value_before ? "OK" : "BROKEN");

    return NULL;
}

int main(int argc, char *argv[])
{
    int i;
    int value_before;

    pthread_barrier_init(&barrier, NULL, THREADS);

    tls_var = 0;
    value_before = tls_var;

    printf("BEFORE_BARRIER: primordial thread: tls_var is %d (%p)\n",
           tls_var, &tls_var); 

    for (i = 0; i < THREADS; i++) {
        pthread_create(&threads[i], NULL, f, (void*) i + 1);
    }

    for (i = 0; i < THREADS; i++) {
        pthread_join(threads[i], NULL);
    }

    pthread_barrier_destroy(&barrier);

    printf("AFTER BARRIER:  primordial thread: tls_var is %d (%p) %s\n",
           tls_var, &tls_var, tls_var == value_before ? "OK" : "BROKEN");

    return 0;
}


-- System Information:
Debian Release: testing/unstable
Architecture: i386
Kernel: Linux arthur 2.6.1-rc1-mm2 #1 SMP Mon Jan 5 20:59:14 CET 2004 i686
Locale: LANG=C, LC_CTYPE=C

Versions of packages libc6 depends on:
ii  libdb1-compat                 2.1.3-7    The Berkeley database routines [gl

-- no debconf information



--- End Message ---
--- Begin Message ---
Source: glibc
Source-Version: 2.3.6-6

We believe that the bug you reported is fixed in the latest version of
glibc, which is due to be installed in the Debian FTP archive:

glibc-doc_2.3.6-6_all.deb
  to pool/main/g/glibc/glibc-doc_2.3.6-6_all.deb
glibc_2.3.6-6.diff.gz
  to pool/main/g/glibc/glibc_2.3.6-6.diff.gz
glibc_2.3.6-6.dsc
  to pool/main/g/glibc/glibc_2.3.6-6.dsc
libc6-amd64_2.3.6-6_i386.deb
  to pool/main/g/glibc/libc6-amd64_2.3.6-6_i386.deb
libc6-dbg_2.3.6-6_i386.deb
  to pool/main/g/glibc/libc6-dbg_2.3.6-6_i386.deb
libc6-dev-amd64_2.3.6-6_i386.deb
  to pool/main/g/glibc/libc6-dev-amd64_2.3.6-6_i386.deb
libc6-dev_2.3.6-6_i386.deb
  to pool/main/g/glibc/libc6-dev_2.3.6-6_i386.deb
libc6-i686_2.3.6-6_i386.deb
  to pool/main/g/glibc/libc6-i686_2.3.6-6_i386.deb
libc6-pic_2.3.6-6_i386.deb
  to pool/main/g/glibc/libc6-pic_2.3.6-6_i386.deb
libc6-prof_2.3.6-6_i386.deb
  to pool/main/g/glibc/libc6-prof_2.3.6-6_i386.deb
libc6-udeb_2.3.6-6_i386.udeb
  to pool/main/g/glibc/libc6-udeb_2.3.6-6_i386.udeb
libc6-xen_2.3.6-6_i386.deb
  to pool/main/g/glibc/libc6-xen_2.3.6-6_i386.deb
libc6_2.3.6-6_i386.deb
  to pool/main/g/glibc/libc6_2.3.6-6_i386.deb
libnss-dns-udeb_2.3.6-6_i386.udeb
  to pool/main/g/glibc/libnss-dns-udeb_2.3.6-6_i386.udeb
libnss-files-udeb_2.3.6-6_i386.udeb
  to pool/main/g/glibc/libnss-files-udeb_2.3.6-6_i386.udeb
locales_2.3.6-6_all.deb
  to pool/main/g/glibc/locales_2.3.6-6_all.deb
nscd_2.3.6-6_i386.deb
  to pool/main/g/glibc/nscd_2.3.6-6_i386.deb



A summary of the changes between this version and the previous one is
attached.

Thank you for reporting the bug, which will now be closed.  If you
have further comments please address them to 226716@bugs.debian.org,
and the maintainer will reopen the bug report if appropriate.

Debian distribution maintenance software
pp.
Aurelien Jarno <aurel32@debian.org> (supplier of updated glibc package)

(This message was generated automatically at their request; if you
believe that there is a problem with it please contact the archive
administrators by mailing ftpmaster@debian.org)


-----BEGIN PGP SIGNED MESSAGE-----
Hash: SHA1

Format: 1.7
Date: Mon, 10 Apr 2006 20:19:55 +0200
Source: glibc
Binary: libc0.1-prof libc6-dev-amd64 libc6-i686 libc6-dev-ppc64 libc0.3-pic glibc-doc libc0.3 libc0.1-i686 libc6.1-dev libc6-s390x libnss-files-udeb libc6-dev-sparc64 libc6-i386 libc0.3-dev libc6-udeb libc6-dbg libc6.1-pic libc6-dev libc0.3-prof libc6-sparcv9 libc0.1-udeb libc6-dev-i386 libc6.1-prof libc0.1-dev locales libc6-pic libc0.3-udeb libc6-dev-powerpc libc0.1-pic libc6-ppc64 libc0.3-dbg libc0.1-dbg libc6-amd64 libc0.1 libc6-prof libc6-xen libc6-powerpc libc6 libc6-sparcv9b libc6.1-udeb libc6.1-dbg nscd libc6-sparc64 libnss-dns-udeb libc6.1 libc6-dev-s390x
Architecture: source i386 all
Version: 2.3.6-6
Distribution: unstable
Urgency: low
Maintainer: GNU Libc Maintainers <debian-glibc@lists.debian.org>
Changed-By: Aurelien Jarno <aurel32@debian.org>
Description: 
 glibc-doc  - GNU C Library: Documentation
 libc6      - GNU C Library: Shared libraries
 libc6-amd64 - GNU C Library: 64bit Shared libraries for AMD64
 libc6-dbg  - GNU C Library: Libraries with debugging symbols
 libc6-dev  - GNU C Library: Development Libraries and Header Files
 libc6-dev-amd64 - GNU C Library: 64bit Development Libraries for AMD64
 libc6-i686 - GNU C Library: Shared libraries [i686 optimized]
 libc6-pic  - GNU C Library: PIC archive library
 libc6-prof - GNU C Library: Profiling Libraries
 libc6-udeb - GNU C Library: Shared libraries - udeb (udeb)
 libc6-xen  - GNU C Library: Shared libraries [Xen version]
 libnss-dns-udeb - GNU C Library: NSS helper for DNS - udeb (udeb)
 libnss-files-udeb - GNU C Library: NSS helper for files - udeb (udeb)
 locales    - GNU C Library: National Language (locale) data [support]
 nscd       - GNU C Library: Name Service Cache Daemon
Closes: 174270 220992 226716 346342 357523 360383 361091 361101 361338 361642
Changes: 
 glibc (2.3.6-6) unstable; urgency=low
 .
   [ Aurelien Jarno ]
   * Remove the timezone database from the libc6 package. It is not provided
     by a separate package called tzdata.
   * Put each test log file in the corresponding package instead of putting all
     of them in libc6.
   * Remove sparc/local-sparc64-fixups.diff as /lib64 and /usr/lib64 are now a
     default search path on 32/64-bit architectures.
   * Switch minimum kernel to at least 2.4.0 on all arches but m68k, and change
     kernelcheck.sh accordingly. Affected architectures:
     - alpha: from 2.2.0 to 2.4.0
     - arm: from 2.2.0 to 2.4.0 (but 2.4.0 was checked at installed time)
     - i386: from 2.2.0 to 2.4.0
     - powerpc: from 2.2.0 to 2.4.0
     - s390: from 2.2.10 to 2.4.0
     - sparc: from 2.2.0 to 2.4.0
     (Closes: #174270, #220992)
   * Add i386/local-i486_ldt_support.diff (add ldt support and thus TLS support
     on i486 machines). Thanks to Petr Salinger for the hint.  (Closes: #226716)
   * Bump shlib to (>= 2.3.6-6) on i386.
   * debian/debhelper.in/libc-alt.install: Add gconv-modules to the bi-arch
     packages.  (Closes: #361642)
   * /etc/ld.so.nohwcap is now supported on non-Linux architectures. Drop the
     "Linux" check from libc-otherbuild.preinst.
   * Build a libc6-xen flavour on i386.
   * Fix a typo in the description of the libc6-sparcv9 and libc6-sparcv9b
     packages.
   * local/usr_sbin/tzconfig:
     - Put a copy of the current timezone into /etc/localtime instead of a
       symlink.  (Closes: #346342)
     - Handle the case where /etc/localtime does not exists.  (Closes:
       #360383).
   * local/manpages/tzconfig.8: Update the manpage accordingly.
   * script.in/kernelcheck.sh: Also take in account 64-bit mips(el) kernels.
   * Add GNU/kFreeBSD patches, using conditional patching until they get
     accepted upstream.
   * Correctly replace DEB_HOST_ARCH by its value in libc6.preinst. Thanks to
     Denis for noticing me.
 .
   [ Denis Barbier ]
   * debian/debhelper.in/locales.config: /etc/locale.gen was not generated at
     initial installation.  (Closes: #357523)
   * update-locale: Fix buggy sanity check between LANGUAGE and LANG.
     (Closes: #361091)
   * update-locale: Drop the --remove flag, it is useless.
   * update-locale: Fix the --locale-file flag.
   * Add new Galician debconf translation, by Jacobo Tarrio.  (Closes: #361101)
   * Use new features of po-debconf 1.0 to remove unneeded strings from PO
     files.
   * Fix day, abmon and mon fields for wo_SN locale.  (Closes: #361338)
 .
   [ Michael Banck ]
   * Add hurd-machrules-make.diff (fixes build problems with make-3.81 for
     Mach interface generation rules) by Roland McGrath (patch from HEAD).
   * Add hurd-sysvshm.diff (implements SysV shared memory for GNU/Hurd)
     by Marcus Brinkmann.
Files: 
 8b4b311ff3dcff6e71257c30bfd94149 2048 libs required glibc_2.3.6-6.dsc
 1f1db590c613c3fbab6c6fcd1f03e09e 802813 libs required glibc_2.3.6-6.diff.gz
 6db50e9ad7e2c2af6e7e1698715a3739 3353236 doc optional glibc-doc_2.3.6-6_all.deb
 3415991c75953bc2facfab27d341e84f 3932110 libs standard locales_2.3.6-6_all.deb
 2bd7cf0e18f828252793f383f91d6a0b 4731426 libs required libc6_2.3.6-6_i386.deb
 129818c6ff779de8312892385bc8fa38 2731826 libdevel standard libc6-dev_2.3.6-6_i386.deb
 9c347aad6e1529c8d35f183d75814e6b 1304844 libdevel extra libc6-prof_2.3.6-6_i386.deb
 b0273053d5e16be697090229394bf932 1073088 libdevel optional libc6-pic_2.3.6-6_i386.deb
 60596d43f3e830c12923d7043b871de3 1093640 libs extra libc6-i686_2.3.6-6_i386.deb
 6011526583bbac517dc0574c8840c84c 1131150 libs extra libc6-xen_2.3.6-6_i386.deb
 de3cdf987cc2e7f0ee17f71e41dd87ae 3328004 libs standard libc6-amd64_2.3.6-6_i386.deb
 8834637cb4fa646b156864c46c1a93b2 2014048 libdevel optional libc6-dev-amd64_2.3.6-6_i386.deb
 e31301365e21122ed95e5cc236e55e4c 135008 admin optional nscd_2.3.6-6_i386.deb
 1208e3563e3b8d91cb8b1506f5912efc 6478250 libdevel extra libc6-dbg_2.3.6-6_i386.deb
 2ead0521f62b1052e5a817a9ec56551f 738384 debian-installer extra libc6-udeb_2.3.6-6_i386.udeb
 91baaa42ca88e09834464aede28b1e60 8682 debian-installer extra libnss-dns-udeb_2.3.6-6_i386.udeb
 a8be4a63de1924b3d854edf103894803 15540 debian-installer extra libnss-files-udeb_2.3.6-6_i386.udeb
Package-Type: udeb

-----BEGIN PGP SIGNATURE-----
Version: GnuPG v1.4.3 (GNU/Linux)

iD8DBQFEOuRfw3ao2vG823MRAjP9AJ91Pn2MLjNxDSCRfGetSE7FajdJogCfWmra
etYphyEBAGkKeB054rkSID4=
=tbWh
-----END PGP SIGNATURE-----


--- End Message ---

Reply to: