<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/libexec/rtld-elf/map_object.c, branch releng/14.4</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=releng%2F14.4</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=releng%2F14.4'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2025-12-15T16:58:44Z</updated>
<entry>
<title>rtld-elf: Fix executable's TLS module index for direct exec</title>
<updated>2025-12-15T16:58:44Z</updated>
<author>
<name>Jessica Clarke</name>
<email>jrtc27@FreeBSD.org</email>
</author>
<published>2025-05-06T22:14:51Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=8e8ae9ac48cc59615dd83d2b5fe1368036ff8808'/>
<id>urn:sha1:8e8ae9ac48cc59615dd83d2b5fe1368036ff8808</id>
<content type='text'>
For direct exec mode we reuse map_object, but tls_max_index is
initialised to 1. As a result, the executable ends up being assigned
module 2 (and the generation is pointlessly incremented, unlike in
digest_phdr for the normal case). For most architectures this is
harmless, since TLS linker relaxation will optimise General Dynamic
accesses to Initial Exec or Local Exec for executables, but on RISC-V
this relaxation does not exist, yet the linker will initialise the
tls_index in the GOT with module 1, and at run time the call to
__tls_get_addr will fail with:

    ld-elf.so.1: Can't find module with TLS index 1

Fix this by making map_object use 1 for obj-&gt;tlsindex when it's loading
the main executable, and don't bother to increment tls_dtv_generation
either, matching digest_phdr (though that one is harmless).

(Note this also applies to MIPS on stable/13)

Reviewed by:	kib
Fixes:		0fc65b0ab82c ("Make ld-elf.so.1 directly executable.")
MFC after:	1 week
Differential Revision:	https://reviews.freebsd.org/D50186

(cherry picked from commit a08d92def20a41243d4afc97cf4a2124be5386b9)
</content>
</entry>
<entry>
<title>rtld: do not relocate tlsinit address twice</title>
<updated>2025-07-25T03:23:49Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2025-07-21T04:09:53Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=1c250e04505f0d3e9b103fa22fe1cf103182a695'/>
<id>urn:sha1:1c250e04505f0d3e9b103fa22fe1cf103182a695</id>
<content type='text'>
PR:	288334

(cherry picked from commit db9ef9d5f517a14160bb3d0a599b8392e01fb400)
</content>
</entry>
<entry>
<title>Remove $FreeBSD$: two-line .h pattern</title>
<updated>2023-08-16T17:54:16Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-08-16T17:54:16Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b3e7694832e81d7a904a10f525f8797b753bf0d3'/>
<id>urn:sha1:b3e7694832e81d7a904a10f525f8797b753bf0d3</id>
<content type='text'>
Remove /^\s*\*\n \*\s+\$FreeBSD\$$\n/
</content>
</entry>
<entry>
<title>rtld: rename tls_done to tls_static</title>
<updated>2023-06-05T19:33:17Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2023-06-05T00:43:55Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=283a4f409731ba3a4eb1be41e151c20e8a960c03'/>
<id>urn:sha1:283a4f409731ba3a4eb1be41e151c20e8a960c03</id>
<content type='text'>
The meaning of the flag is that static TLS allocation was done.

Taken from NetBSD Joerg Sonnenberger change for src/libexec/ld.elf_so/tls.c
rev. 1.18.

Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
</content>
</entry>
<entry>
<title>spdx: The BSD-2-Clause-FreeBSD identifier is obsolete, drop -FreeBSD</title>
<updated>2023-05-12T16:44:03Z</updated>
<author>
<name>Warner Losh</name>
<email>imp@FreeBSD.org</email>
</author>
<published>2023-05-10T15:40:58Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=4d846d260e2b9a3d4d0a701462568268cbfe7a5b'/>
<id>urn:sha1:4d846d260e2b9a3d4d0a701462568268cbfe7a5b</id>
<content type='text'>
The SPDX folks have obsoleted the BSD-2-Clause-FreeBSD identifier. Catch
up to that fact and revert to their recommended match of BSD-2-Clause.

Discussed with:		pfg
MFC After:		3 days
Sponsored by:		Netflix
</content>
</entry>
<entry>
<title>sys/param.h: Add _WANT_P_OSREL</title>
<updated>2023-02-15T00:43:18Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2023-02-14T08:52:14Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=5942b4b6fde3f4ce6d0295fbcf135f552f92c607'/>
<id>urn:sha1:5942b4b6fde3f4ce6d0295fbcf135f552f92c607</id>
<content type='text'>
Use it instead of defining IN_RTLD by base sources that want P_OSREL_
defines in userspace, but are not rtld.
This allows to remove abuse of IN_RTLD from userspace.

Reviewed by:	dchagin, markj, imp
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D38585
</content>
</entry>
<entry>
<title>rtld: Revert "When loading dso without PT_GNU_STACK phdr, only call"</title>
<updated>2023-01-04T22:55:00Z</updated>
<author>
<name>John Baldwin</name>
<email>jhb@FreeBSD.org</email>
</author>
<published>2023-01-04T22:55:00Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=b069d3e0193121ff6de348f68c7ce93ee61e5e2f'/>
<id>urn:sha1:b069d3e0193121ff6de348f68c7ce93ee61e5e2f</id>
<content type='text'>
After the removal of ia64 and sparc64, all current architectures
support executable stacks at an architectural level.

This reverts commit 1290d38ac50b3afa7e5781d9d97346a1042c736c.

Reviewed by:	kib
Sponsored by:	DARPA
Differential Revision:	https://reviews.freebsd.org/D37904
</content>
</entry>
<entry>
<title>Have rtld query the page size from the kernel</title>
<updated>2022-04-07T14:37:37Z</updated>
<author>
<name>Andrew Turner</name>
<email>andrew@FreeBSD.org</email>
</author>
<published>2022-04-04T15:05:40Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=e85eaa930862d5b4dc917bc31e8d7254a693635d'/>
<id>urn:sha1:e85eaa930862d5b4dc917bc31e8d7254a693635d</id>
<content type='text'>
To allow for a dynamic page size on arm64 have the runtime linker
query the kernel for the currentl page size.

Reviewed by:	kib
Sponsored by:	The FreeBSD Foundation
Differential Revision: https://reviews.freebsd.org/D34765
</content>
</entry>
<entry>
<title>rtld: extract header validation into new helper check_elf_headers()</title>
<updated>2021-12-06T18:46:49Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2021-11-11T17:51:26Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=63fc4e820c86f5dedb80cc31b7918deb284b455e'/>
<id>urn:sha1:63fc4e820c86f5dedb80cc31b7918deb284b455e</id>
<content type='text'>
Reviewed by:	emaste
Discussed with:	jrtc27
Tested by:	pho
Sponsored by:	The FreeBSD Foundation
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D32960
</content>
</entry>
<entry>
<title>rtld: Round down relro_size</title>
<updated>2021-08-13T09:58:53Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2021-08-12T02:45:15Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=c9f833abf1d76ea194b82caafa06a0627790ad97'/>
<id>urn:sha1:c9f833abf1d76ea194b82caafa06a0627790ad97</id>
<content type='text'>
lld rounds up p_memsz(PT_GNU_RELRO) to satisfy common-page-size. If the
page size is smaller than common-page-size, rounding up relro_size may
incorrectly make some RW pages read-only.

GNU ld, gold, and ld.lld ensures p_vaddr+p_memsz is a multiple of
common-page-size. While max-page-size &gt;= system the page size,
common-page-size can be smaller than the system page size.

Submitted by:	MaskRay
MFC after:	1 week
Differential revision:	https://reviews.freebsd.org/D31498
</content>
</entry>
</feed>
