<feed xmlns='http://www.w3.org/2005/Atom'>
<title>src/libexec/rtld-elf/map_object.c, branch release/9.0.0</title>
<subtitle>FreeBSD source tree</subtitle>
<id>https://cgit-dev.freebsd.org/src/atom?h=release%2F9.0.0</id>
<link rel='self' href='https://cgit-dev.freebsd.org/src/atom?h=release%2F9.0.0'/>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/'/>
<updated>2011-09-20T21:49:54Z</updated>
<entry>
<title>Restore the writing of the .bss sections of the dsos (not the main</title>
<updated>2011-09-20T21:49:54Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2011-09-20T21:49:54Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=750b5e3134467ec8257e1a0c01d96c89be5af3cf'/>
<id>urn:sha1:750b5e3134467ec8257e1a0c01d96c89be5af3cf</id>
<content type='text'>
executable) after r190885. The whole region for the dso is mmaped with
MAP_NOCORE flag, doing only mprotect(2) over .bss prevented it from
writing .bss to core files.

Revert the optimization of using mprotect(2) to establish .bss, overlap
the section with mmap(2).

Reported by:	attilio
Reviewed by:	attilio, emaste
Approved by:	re (bz)
MFC after:	2 weeks
</content>
</entry>
<entry>
<title>When loading dso without PT_GNU_STACK phdr, only call</title>
<updated>2011-01-25T21:12:31Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2011-01-25T21:12:31Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=cb38d4941c45e3c72c4b5b3fad87d297d950cf53'/>
<id>urn:sha1:cb38d4941c45e3c72c4b5b3fad87d297d950cf53</id>
<content type='text'>
__pthread_map_stacks_exec() on architectures that allow executable
stacks.

Reported and tested by:	marcel (ia64)
</content>
</entry>
<entry>
<title>In rtld, read the initial stack access mode from AT_STACKPROT as set</title>
<updated>2011-01-08T17:11:49Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2011-01-08T17:11:49Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=212f264cd6bb3e32cabaf98f2340337756acf089'/>
<id>urn:sha1:212f264cd6bb3e32cabaf98f2340337756acf089</id>
<content type='text'>
by kernel, and parse PT_GNU_STACK phdr from linked and loaded dsos.

If the loaded dso requires executable stack, as specified by PF_X bit
of p_flags of PT_GNU_STACK phdr, but current stack protection does not
permit execution, the __pthread_map_stacks_exec symbol is looked up
and called. It should be implemented in libc or threading library and
change the protection mode of all thread stacks to be executable.

Provide a private interface _rtld_get_stack_prot() to export the stack
access mode as calculated by rtld.

Reviewed by:	   kan
</content>
</entry>
<entry>
<title>In rtld's map_object(), use pread(..., 0) rather than read() to read the</title>
<updated>2009-10-06T17:14:39Z</updated>
<author>
<name>Robert Watson</name>
<email>rwatson@FreeBSD.org</email>
</author>
<published>2009-10-06T17:14:39Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=1c232cd509c1fd9cb772bd829c3a220a5a6379bb'/>
<id>urn:sha1:1c232cd509c1fd9cb772bd829c3a220a5a6379bb</id>
<content type='text'>
ELF header from the front of the file.  As all other I/O on the binary
is done using mmap(), this avoids the need for seek privileges on the
file descriptor during run-time linking.

MFC after:	1 month
Sponsored by:	Google
</content>
</entry>
<entry>
<title>Only perform .bss mapping and cleaning operations when segment file size</title>
<updated>2009-07-17T19:32:04Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2009-07-17T19:32:04Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=69ca61ba5e482dda9410c227ca300218bf56c95a'/>
<id>urn:sha1:69ca61ba5e482dda9410c227ca300218bf56c95a</id>
<content type='text'>
is not equal to its memory size.

This eliminates unneeded clearing of the text segment that often
happens due to text end not being page-aligned.

For instance,
$ readelf -l /lib/libedit.so.6
Program Headers:
  Type           Offset   VirtAddr   PhysAddr   FileSiz MemSiz  Flg Align
  LOAD           0x000000 0x00000000 0x00000000 0x139e1 0x139e1 R E 0x1000
  LOAD           0x014000 0x00014000 0x00014000 0x00f04 0x00f14 RW  0x1000
  DYNAMIC        0x014cc4 0x00014cc4 0x00014cc4 0x000d0 0x000d0 RW  0x4
$ procstat -v $$ (for /bin/sh)
68585 0x28097000 0x280aa000 r-x    6    0  21  14 CN vn /lib/libedit.so.6
68585 0x280aa000 0x280ab000 r-x    1    0   1   0 CN vn /lib/libedit.so.6 &lt;==
68585 0x280ab000 0x280ac000 rwx    1    0   1   0 CN vn /lib/libedit.so.6
Note the splitted map entry marked by '&lt;=='.

Reviewed by:	kan
Approved by:	re (kensmith)
MFC after:	1 month
</content>
</entry>
<entry>
<title>Currently, when mapping an object, rtld reserves the whole address space</title>
<updated>2009-04-10T10:14:04Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2009-04-10T10:14:04Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=a3c8e04ef731511cdb39c2f8f2c2079da1b30624'/>
<id>urn:sha1:a3c8e04ef731511cdb39c2f8f2c2079da1b30624</id>
<content type='text'>
for the mapping by the object' file with the protection and mode of
the first loadable segment over the whole region. Then, it maps other
segments at the appropriate addresses inside the region.

On amd64, due to default alignment of the segments being 1Gb, the
subsequent segment mappings leave the holes in the region, that usually
contain mapping of the object' file past eof. Such mappings prevent
wiring of the address space, because the pages cannot be faulted in.

Change the way the mapping of the ELF objects is constructed, by first
mapping PROT_NONE anonymous memory over the whole range, and then
mapping the segments of the object over it. Take advantage of this new
order and allocate .bss by changing the protection of the range instead
of remapping.

Note that we cannot simply keep the holes between segments, because
other mappings may be made there. Among other issues, when the dso is
unloaded, rtld unmaps the whole region, deleting unrelated mappings.

The kernel ELF image activator does put the holes between segments, but
this is not critical for now because kernel loads only executable image
and interpreter, both cannot be unloaded. This will be fixed later, if
needed.

Reported and tested by:	Hans Ottevanger &lt;fbsdhackers beasties demon nl&gt;
Suggested and reviewed by:	kan, alc
</content>
</entry>
<entry>
<title>Update comment to the reality, rtld supports any number of loadable segments.</title>
<updated>2009-04-10T09:52:42Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2009-04-10T09:52:42Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=11e0093f28feefb0f060c480439de0ade62b5305'/>
<id>urn:sha1:11e0093f28feefb0f060c480439de0ade62b5305</id>
<content type='text'>
Fix spacing.

Reviewed by:	kan
</content>
</entry>
<entry>
<title>Implement the dynamic string token substitution in the rpath and</title>
<updated>2009-03-18T13:40:37Z</updated>
<author>
<name>Konstantin Belousov</name>
<email>kib@FreeBSD.org</email>
</author>
<published>2009-03-18T13:40:37Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=28551690e093233d3c124b7d2642389934aaafe3'/>
<id>urn:sha1:28551690e093233d3c124b7d2642389934aaafe3</id>
<content type='text'>
soneeded pathes. The $ORIGIN, $OSNAME, $OSREL and $PLATFORM tokens
are supported. Enabling the substitution requires DF_ORIGIN flag in
DT_FLAGS or DF_1_ORIGIN if DF_FLAGS_1, that may be set with -z origin
gnu ld flag. Translation is unconditionally disabled for setuid/setgid
processes.

The $ORIGIN translation relies on the AT_EXECPATH auxinfo supplied
by kernel.

Requested by:	maho
Tested by:	maho, pho
Reviewed by:	kan
</content>
</entry>
<entry>
<title>Implement dl_iterate_phdr function.</title>
<updated>2007-04-03T18:31:20Z</updated>
<author>
<name>Alexander Kabaev</name>
<email>kan@FreeBSD.org</email>
</author>
<published>2007-04-03T18:31:20Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=49f90ad2822286dfdf9e8d63df93bfeb22ed72c2'/>
<id>urn:sha1:49f90ad2822286dfdf9e8d63df93bfeb22ed72c2</id>
<content type='text'>
Convert boolean flags in internal Obj_Entry structure into bitfields.
Properly check for loaded segment alignment in map_object.
</content>
</entry>
<entry>
<title>Implement ELF symbol versioning using GNU semantics. This code aims</title>
<updated>2005-12-18T19:43:33Z</updated>
<author>
<name>Alexander Kabaev</name>
<email>kan@FreeBSD.org</email>
</author>
<published>2005-12-18T19:43:33Z</published>
<link rel='alternate' type='text/html' href='https://cgit-dev.freebsd.org/src/commit/?id=0eb88f20298d056bf09b52ec2d84d3662b8fd152'/>
<id>urn:sha1:0eb88f20298d056bf09b52ec2d84d3662b8fd152</id>
<content type='text'>
to be compatible with symbol versioning support as implemented by
GNU libc and documented by http://people.redhat.com/~drepper/symbol-versioning
and LSB 3.0.

Implement dlvsym() function to allow lookups for a specific version of
a given symbol.
</content>
</entry>
</feed>
