Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 8 Sep 2015 12:00:14 +0000 (UTC)
From:      Andrew Turner <andrew@FreeBSD.org>
To:        src-committers@freebsd.org, svn-src-all@freebsd.org, svn-src-stable@freebsd.org, svn-src-stable-10@freebsd.org
Subject:   svn commit: r287560 - stable/10/libexec/rtld-elf
Message-ID:  <201509081200.t88C0E1D062225@repo.freebsd.org>

next in thread | raw e-mail | index | archive | help
Author: andrew
Date: Tue Sep  8 12:00:13 2015
New Revision: 287560
URL: https://svnweb.freebsd.org/changeset/base/287560

Log:
  MFC r287369:
  Ensure we use calculate_first_tls_offset, even if the main program doesn't
  have TLS program header. This is needed on architectures with Variant I
  tls, that is arm, arm64, mips, and powerpc. These place the thread control
  block at the start of the buffer and, without this, this data may be
  trashed.
  
  This appears to not be an issue on mips or powerpc as they include a second
  adjustment to move the thread local data, however this is on arm64 (with a
  future change to fix placing this data), and should be on arm. I am unable
  to trigger this on arm, even after changing the code to move the data
  around to make it more likely to be hit. This is most likely because my
  tests didn't use the variable in offset 0.
  
  Reviewed by:	kib
  MFC after:	1 week
  Sponsored by:	ABT Systems Ltd

Modified:
  stable/10/libexec/rtld-elf/rtld.c
Directory Properties:
  stable/10/   (props changed)

Modified: stable/10/libexec/rtld-elf/rtld.c
==============================================================================
--- stable/10/libexec/rtld-elf/rtld.c	Tue Sep  8 08:54:40 2015	(r287559)
+++ stable/10/libexec/rtld-elf/rtld.c	Tue Sep  8 12:00:13 2015	(r287560)
@@ -4532,7 +4532,7 @@ allocate_tls_offset(Obj_Entry *obj)
 	return true;
     }
 
-    if (obj->tlsindex == 1)
+    if (tls_last_offset == 0)
 	off = calculate_first_tls_offset(obj->tlssize, obj->tlsalign);
     else
 	off = calculate_tls_offset(tls_last_offset, tls_last_size,



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?201509081200.t88C0E1D062225>