History log of /freebsd-14.2/libexec/rtld-elf/libmap.c (Results 1 – 25 of 42)
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
Revision tags: release/13.4.0-p5, release/13.5.0-p1, release/14.2.0-p3, release/13.5.0, release/14.2.0-p2, release/14.1.0-p8, release/13.4.0-p4, release/14.1.0-p7, release/14.2.0-p1, release/13.4.0-p3, release/14.2.0, release/13.4.0, release/14.1.0, release/13.3.0, release/14.0.0
# 42b38843 16-Aug-2023 Warner Losh <[email protected]>

Remove $FreeBSD$: one-line .h pattern

Remove /^\s*\*+\s*\$FreeBSD\$.*$\n/


Revision tags: release/13.2.0, release/12.4.0
# ca2560bd 17-Oct-2022 Konstantin Belousov <[email protected]>

rtld: fix typo in comment

Sponsored by: The FreeBSD Foundation
MFC after: 3 days


# 1251cf8a 18-Sep-2022 Konstantin Belousov <[email protected]>

rtld-elf/libmap.c: correct comment

There is no intent to support TLS for rtld.

Sponsored by: The FreeBSD Foundation
MFC after: 1 week


Revision tags: release/13.1.0, release/12.3.0
# 33dba3bb 12-Oct-2021 Konstantin Belousov <[email protected]>

rtld-elf/paths.h: Make it usable outside rtld

but still for tightly coupled things like ldd(1)

Rename paths.h to rtld_paths.h.
Add guard for rtld-specific externs declarations.
Add _COMPAT32_BASENA

rtld-elf/paths.h: Make it usable outside rtld

but still for tightly coupled things like ldd(1)

Rename paths.h to rtld_paths.h.
Add guard for rtld-specific externs declarations.
Add _COMPAT32_BASENAME_RTLD and _COMPAT32_PATH_RTLD.

Reviewed by: arichardson, jhb
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D32464

show more ...


# aa68b3bb 16-Aug-2021 Konstantin Belousov <[email protected]>

rtld: constify most variables holding references to the environment values

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.or

rtld: constify most variables holding references to the environment values

Reviewed by: markj
Sponsored by: The FreeBSD Foundation
MFC after: 1 week
Differential revision: https://reviews.freebsd.org/D31545

show more ...


Revision tags: release/13.0.0
# 741d7812 01-Jan-2021 Konstantin Belousov <[email protected]>

rtld: call close(2) after errno is saved

to prevent obliteration of error value from the original syscall.
Also improve error message for short read.

Submitted by: Konrad Sewiłło-Jopek
MFC after: 1

rtld: call close(2) after errno is saved

to prevent obliteration of error value from the original syscall.
Also improve error message for short read.

Submitted by: Konrad Sewiłło-Jopek
MFC after: 1 week
Differential Revision: https://reviews.freebsd.org/D27864

show more ...


Revision tags: release/12.2.0, release/11.4.0, release/12.1.0, release/11.3.0
# b54a59f3 30-Jun-2019 Alex Richardson <[email protected]>

Reduce size of rtld by 22% by pulling in less code from libc

Currently RTLD is linked against libc_nossp_pic which means that any libc
symbol used in rtld can pull in a lot of depedencies. This was

Reduce size of rtld by 22% by pulling in less code from libc

Currently RTLD is linked against libc_nossp_pic which means that any libc
symbol used in rtld can pull in a lot of depedencies. This was causing
symbol such as __libc_interposing and all the pthread stubs to be included
in RTLD even though they are not required. It turns out most of these
dependencies can easily be avoided by providing overrides inside of rtld.

This change is motivated by CHERI, where we have an experimental ABI that
requires additional relocation processing to allow the use of function
pointers inside of rtld. Instead of adding this self-relocation code to
RTLD I attempted to remove most function pointers from RTLD and discovered
that most of them came from the libc dependencies instead of being actually
used inside rtld.

A nice side-effect of this change is that rtld is now 22% smaller on amd64.

text data bss dec hex filename
0x21eb6 0xce0 0xe60 145910 239f6 /home/alr48/ld-elf-x86.before.so.1
0x1a6ed 0x728 0xdd8 113645 1bbed /home/alr48/ld-elf-x86.after.so.1

The number of R_X86_64_RELATIVE relocations that need to be processed on
startup has also gone down from 368 to 187 (almost 50% less).

Reviewed By: kib
Differential Revision: https://reviews.freebsd.org/D20663

show more ...


Revision tags: release/12.0.0
# 3ab5b6bd 29-Oct-2018 Alex Richardson <[email protected]>

rtld-elf: fix more warnings to allow compiling with WARNS=6

Reviewed By: kib
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D17154


# 903e0ffd 29-Oct-2018 Alex Richardson <[email protected]>

rtld-elf: compile with WANRS=4 warnings other than -Wcast-align

Reviewed By: kib
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D17153


# 78b64846 29-Oct-2018 Alex Richardson <[email protected]>

rtld-elf: make it compile with WARNS=3

Reviewed By: kib
Approved By: brooks (mentor)
Differential Revision: https://reviews.freebsd.org/D17150


# 6c306765 26-Sep-2018 Konstantin Belousov <[email protected]>

When doing lm_add(), check for duplicates.

This is useful when lm_find() moves the match to the global mapping,
since lm_find() could be called with a same path more than once.

Reported and tested

When doing lm_add(), check for duplicates.

This is useful when lm_find() moves the match to the global mapping,
since lm_find() could be called with a same path more than once.

Reported and tested by: Andreas Longwitz <[email protected]>
Sponsored by: The FreeBSD Foundation
Approved by: re (gjb)
MFC after: 1 week

show more ...


# c1a0a86e 02-Sep-2018 Konstantin Belousov <[email protected]>

Style cleanup. No functional changes.

Sponsored by: The FreeBSD Foundation
MFC after: 3 days
Approved by: re (rgrimes)


Revision tags: release/11.2.0
# 152036a0 29-Oct-2017 Edward Tomasz Napierala <[email protected]>

Plug memory leak on error case.

Reported by: Coverity
CID: 1382112
MFC after: 2 weeks


# a8b31c14 24-Oct-2017 Edward Tomasz Napierala <[email protected]>

Use xmalloc and read(2) instead of mmap(2) to read in libmap.conf(5).
This removes the need to call munmap(2) afterwards.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://

Use xmalloc and read(2) instead of mmap(2) to read in libmap.conf(5).
This removes the need to call munmap(2) afterwards.

MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D12767

show more ...


# 6b61e3e4 22-Oct-2017 Edward Tomasz Napierala <[email protected]>

Don't call realpath(3) from libmap rtld code. This gets rid of a few calls
to fstatat(2) at binary startup; the difference looks like this:

--- przed 2017-10-14 13:55:49.983528000 +0100
+++ po

Don't call realpath(3) from libmap rtld code. This gets rid of a few calls
to fstatat(2) at binary startup; the difference looks like this:

--- przed 2017-10-14 13:55:49.983528000 +0100
+++ po 2017-10-14 14:10:39.134343000 +0100
@@ -1,15 +1,10 @@
mmap(0x0,32768,PROT_READ|PROT_WRITE,MAP_PRIVATE|MAP_ANON,-1,0x0) = 34366173184 (0x800623000)
issetugid() = 0 (0x0)
-fstatat(AT_FDCWD,"/etc",{ mode=drwxr-xr-x ,inode=1364352,size=2560,blksize=32768 },AT_SYMLINK_NOFOLLOW) = 0 (0x0)
-fstatat(AT_FDCWD,"/etc/libmap.conf",{ mode=-rw-r--r-- ,inode=1373288,size=102,blksize=32768 },AT_SYMLINK_NOFOLLOW) = 0 (0x0)
openat(AT_FDCWD,"/etc/libmap.conf",O_RDONLY|O_CLOEXEC,00) = 3 (0x3)
fstat(3,{ mode=-rw-r--r-- ,inode=1373288,size=102,blksize=32768 }) = 0 (0x0)
mmap(0x0,102,PROT_READ,MAP_PRIVATE,3,0x0) = 34366205952 (0x80062b000)
close(3) = 0 (0x0)
-fstatat(AT_FDCWD,"/usr",{ mode=drwxr-xr-x ,inode=561792,size=512,blksize=32768 },AT_SYMLINK_NOFOLLOW) = 0 (0x0)
-fstatat(AT_FDCWD,"/usr/local",{ mode=drwxr-xr-x ,inode=561800,size=512,blksize=32768 },AT_SYMLINK_NOFOLLOW) = 0 (0x0)
-fstatat(AT_FDCWD,"/usr/local/etc",{ mode=drwxr-xr-x ,inode=653279,size=1536,blksize=32768 },AT_SYMLINK_NOFOLLOW) = 0 (0x0)
-fstatat(AT_FDCWD,"/usr/local/etc/libmap.d",0x7fffffffcf50,AT_SYMLINK_NOFOLLOW) ERR#2 'No such file or directory'
+open("/usr/local/etc/libmap.d",O_RDONLY|O_NONBLOCK|O_DIRECTORY|O_CLOEXEC,0165) ERR#2 'No such file or directory'
munmap(0x80062b000,102) = 0 (0x0)
openat(AT_FDCWD,"/var/run/ld-elf.so.hints",O_RDONLY|O_CLOEXEC,00) = 3 (0x3)
read(3,"Ehnt\^A\0\0\0\M^@\0\0\0\M-2\0\0"...,128) = 128 (0x80)

Reviewed by: kib
MFC after: 2 weeks
Sponsored by: DARPA, AFRL
Differential Revision: https://reviews.freebsd.org/D12741

show more ...


Revision tags: release/10.4.0, release/11.1.0, release/11.0.1, release/11.0.0, release/10.3.0
# 3deca56f 31-Oct-2015 Warner Losh <[email protected]>

Rather than using the #define for path names, indirect through a char *
variable that could change for different executable types detected.


# b2a4014c 31-Oct-2015 Warner Losh <[email protected]>

Move all the paths into a new path.h to centralize them.


Revision tags: release/10.2.0, release/10.1.0
# 0fa46a42 21-Aug-2014 Pedro F. Giffuni <[email protected]>

Always check the limits of array index variables before using them.

Obtained from: DragonFlyBSD
MFC after: 1 week


Revision tags: release/9.3.0
# 490c68de 18-May-2014 Konstantin Belousov <[email protected]>

Fix LD_LIBMAP.
The r232862 passed the pointer to end of string to lmc_parse() and free().

Submitted by: Wolfgang Jenkner <[email protected]>
MFC after: 1 week


Revision tags: release/10.0.0, release/9.2.0
# 8182b3be 21-Sep-2013 Dag-Erling Smørgrav <[email protected]>

Make the directory mapping functionality, which was previously only
available in 32-bit compatibility mode, unconditional.

Overhaul the man page, which had evolved more by accretion than by design.

Make the directory mapping functionality, which was previously only
available in 32-bit compatibility mode, unconditional.

Overhaul the man page, which had evolved more by accretion than by design.

Approved by: re (gjb)
MFC after: 3 weeks

show more ...


Revision tags: release/8.4.0, release/9.1.0
# e1942829 04-Nov-2012 Jilles Tjoelker <[email protected]>

rtld: Fix fd leak with parallel dlopen and fork/exec.

Rtld did not set FD_CLOEXEC on its internal file descriptors; therefore,
such a file descriptor may be passed to a process created by another th

rtld: Fix fd leak with parallel dlopen and fork/exec.

Rtld did not set FD_CLOEXEC on its internal file descriptors; therefore,
such a file descriptor may be passed to a process created by another thread
running in parallel to dlopen() or fdlopen().

No other threads are expected to be running during parsing of the hints
and libmap files but the file descriptors need not be passed to child
processes so add O_CLOEXEC there as well.

This change will break fdlopen() (as used by OpenPAM) on kernels without
F_DUPFD_CLOEXEC (added in July). Note that running new userland on old
kernels is not supported.

Reviewed by: kib

show more ...


# 5c98f307 05-May-2012 Baptiste Daroussin <[email protected]>

open the resolved path
fix debug message

Submitted by: John Marino <[email protected]>
Approved by: des (mentor)


# faf66437 30-Apr-2012 Baptiste Daroussin <[email protected]>

Add two special directives to libmap.conf:
include <file>:
Parse the contents of file before continuing with the current file.
includedir <dir>:
Parse the contents of every file in dir that ends

Add two special directives to libmap.conf:
include <file>:
Parse the contents of file before continuing with the current file.
includedir <dir>:
Parse the contents of every file in dir that ends in .conf before continuing
with the current file.
Any file or directory encountered while processing include or includedir
directives will be parsed exactly once, even if it is encountered multiple
times.

Reviewed by: kib, des
Approved by: des (mentor)
MFC after: 1 month

show more ...


Revision tags: release/8.3.0_cvs, release/8.3.0
# 6fea10fb 14-Mar-2012 Konstantin Belousov <[email protected]>

Rtld on diet 3.

Stop using strerror(3) in rtld, which brings in msgcat and stdio.
Directly access sys_errlist array of errno messages with private
rtld_strerror() function.

Now,
$ size /libexec/ld-

Rtld on diet 3.

Stop using strerror(3) in rtld, which brings in msgcat and stdio.
Directly access sys_errlist array of errno messages with private
rtld_strerror() function.

Now,
$ size /libexec/ld-elf.so.1
text data bss dec hex filename
96983 2480 8744 108207 1a6af /libexec/ld-elf.so.1

Reviewed by: dim, kan
MFC after: 2 weeks

show more ...


# 68f1db20 12-Mar-2012 Konstantin Belousov <[email protected]>

Rtld on diet part 2:

Do not use stdio for libmap.conf read. Directly map the file and
parse lines from the mappings.

Reviewed by: kan
MFC after: 3 weeks


12