History log of /openbsd-current/libexec/ld.so/sparc64/ldasm.S
Revision (<<< Hide revision tags) (Show revision tags >>>) Date Author Comments
# 1.47 10-May-2019 guenther

ld.so boot cleanup support:
- put functions and data which are only used before calling the executable's
start function into their own page-aligned segments for unmapping
(only done on amd64, arm64, armv7, powerpc, and sparc64 so far)
- pass .init_array and .preinit_array functions an addition argument which
is a callback to get a structure which includes a function that frees
the boot text and data
- sometimes delay doing RELRO processing: for a shared-object marked
DF_1_INITFIRST do it after the object's .init_array, for the executable
do it after the .preinit_array
- improve test-ld.so to link against libpthread and trigger its initialization
late
libc changes to use this will come later

ok kettenis@


Revision tags: OPENBSD_6_2_BASE OPENBSD_6_3_BASE OPENBSD_6_4_BASE OPENBSD_6_5_BASE
# 1.46 27-Aug-2017 deraadt

Replace heaps of hand-written syscall stubs with a simpler framework
which is largely MI.
ok visa kettenis


Revision tags: OPENBSD_6_1_BASE
# 1.45 24-Jan-2017 guenther

On fatal errors, kill ourselves with thrkill(0,9,NULL) instead of
simply exiting, via helper functions _dl_die(), _dl_diedie(), and
_dl_oom().

prompted by a complaint from jsing@
ok jsing@ deraadt@


# 1.44 28-Aug-2016 guenther

ld.so doesn't need gettimeofday or lstat stubs any more

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.43 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.42 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


# 1.41 21-Mar-2016 guenther

Switch ld.so's stack smash handler from sendsyslog to sendsyslog2
and pass the LOG_CONS flag like libc's handler.

ok deraadt@ bluhm@ (who had a similar diff)


Revision tags: OPENBSD_5_9_BASE
# 1.40 15-Nov-2015 deraadt

ldd(1) sets environment variable LD_TRACE_LOADED_OBJECTS to tell ld.so
that it should show information about the program it loads, rather than
run it. In that specific case, ld.so can pledge to "stdio rpath" to
ensure that code path in ld.so has no bugs.
Yes, a pledge in ld.so.... who'd have thought!
ok guenther


# 1.39 19-Sep-2015 guenther

kbind has eliminated the need for and use of the bind lock. Delete it, the
the callback, and the sigprocmask stub.
Keep around the DL_SETBINDLCK case until libpthread stops using it.

discussed with miod@ at l2k15
ok kettenis@


# 1.38 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.37 14-Jul-2014 deraadt

Now that we have sendsyslog(2), we can directly use it in the
(previously completely retarded) stack_smash_handler of ld.so
ok beck miod tedu


# 1.36 09-Jul-2014 guenther

_dl_fcntl() is no longer used; kill the stubs

ok otto@ miod@


# 1.35 06-Jul-2014 otto

move from sysclt(KERN_ARND) to getentropy(2); ok miod@, kettenis@


Revision tags: OPENBSD_5_5_BASE
# 1.34 23-Dec-2013 kettenis

Use slightly diffrerent code to get the global offset table address. This
version will match the (upcoming) 32-bit version (for sparc) and allegedly
is slightly faster.


# 1.33 23-Dec-2013 kettenis

Make ld.so pass its cleanup handler in %g1 as required by the SPARC System V
ABI, and stop calling atexit(4) directly from ld.so on sparc64


# 1.32 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.31 01-Jun-2013 miod

Introduce ltrace(1). This tool works with ld.so to inject utrace record for
each plt call, allowing to trace a binary linked against shared library at the
public function call level.

To do so, ltrace(1) sets up some environment variables to enable plt tracing
in ld.so, and invokes ktrace(2) for utrace events. ld.so will force lazy
binding and will send an utrace record in the plt resolver, without updating
the plt.

Minimal filtering capabilities are provided, inspired by Solaris' truss -u,
to limit tracing to libraries and/or symbol names. Non-traced libraries and
symbols will have the regular resolver processing, with the expected plt
update.

"Get it in" deraadt


# 1.30 05-Apr-2013 kurt

- Add ORIGIN, OSNAME, OSREL and PLATFORM substitution support for rpaths.
Improvements and okay matthew@, millert@, guenther@


Revision tags: OPENBSD_5_3_BASE
# 1.29 24-Oct-2012 guenther

Garbage-collect the _dl_stat() routine, now unused

ok matthew@ deraadt@


# 1.28 22-Oct-2012 kettenis

Stop passing around PS_STRINGS in %g1. The ELF ABI reserves this register
for passing around a pointer to a cleanup function and we'd like to use it
for that purpose in the near future.

ok miod@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.27 27-Oct-2010 millert

Fix comment; no binary change. OK deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.26 09-May-2010 kettenis

Reserve space for 6 extended word argument slots required by the ABI.
Apparently gcc4 uses them in cases where gcc3 didn't. Fixes segmentation
faults with gcc4 because the space for the slots was colliding with
the space for dl_data that we allocated on the stack.

ok miod@


# 1.25 24-Apr-2010 kettenis

Fix handling of more than 32768 PLT entries. Mostly from NetBSD.

eyeballed by deraadt@ and drahn@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.24 03-May-2006 drahn

prebind - how to prelink a binary without throwing security out the window

Prelink fixes the address of libraries making 'return to libc' attacks trival,
prebind uses a different method to achieve most of the same gains, however
without adding any security conerns.

Still under development, now in-tree.


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.23 25-May-2004 deraadt

spacing


Revision tags: OPENBSD_3_5_BASE
# 1.22 10-Jan-2004 pvalchev

the sparcv9 ABI requires registers %g2, %g3 to be first announced before
it can use them, and gcc3 catches this
ok henric


Revision tags: OPENBSD_3_4_BASE
# 1.21 12-Aug-2003 jason

use _ENTRY consistently, remove some #if 0 code, and clean up some comments; ok drahn


# 1.20 09-Jul-2003 drahn

changes to ld.so to be compatible with newer binutils, requires
slight changes in the startup code on most archs. ok art@ brad@


# 1.19 02-Jun-2003 jason

nuke clause 3 & 4


# 1.18 30-May-2003 drahn

When loading a shared object or libraries dependant object, load them
in random order. This will reduce the possiblity of a buffer overflow
being able to predict the addresss of useful code. Can be disabled
with the LD_NORANDOM environment variable for debugging purposes.
ok deraadt.


Revision tags: OPENBSD_3_3_BASE
# 1.17 02-Feb-2003 deraadt

knf & ansi; drahn ok


# 1.16 18-Dec-2002 drahn

Prepare for an upcoming ELF executable change. This will allow ld.so to
protect the GOT and PLT sections of the executable from being overwritten.
This behavior is enabled by changes in the executable/shared object layout,
and does not occur without the ld changes.


# 1.15 23-Nov-2002 drahn

clean up comments.


# 1.14 21-Oct-2002 drahn

Simplify the ld.so asm api, the data is available other ways.
tested by naddy@ and myself.


Revision tags: OPENBSD_3_2_BASE
# 1.13 11-Aug-2002 drahn

The parameter dynp was never used, rather than pass in a dummy on most
archs and a nasty calcuation on others, remove the parameter.


# 1.12 12-Jul-2002 drahn

Change ld.so search order/method to match the a.out ld.so.

run destructors on dlclose()

Move more symbols into _dl_ private space, so that the proper (libc)
version of the function will be used.

Add readdir() functionality to perform the proper library searching.

Support DL_PRELOAD

Do not relocate symbols if ld.so is being traced (and will exit).

Misc lint cleanup.

ok art@


# 1.11 24-May-2002 deraadt

more KNF


# 1.10 24-May-2002 deraadt

various KNF


Revision tags: OPENBSD_3_1_BASE
# 1.9 17-Mar-2002 art

Clean up the zapping of bad variables. Instead of implementing
_dl_suid_ok, just use the issetugid syscall.
ok drahn@.


# 1.8 15-Mar-2002 drahn

Add support for binutils 2.11. Work around change in PLT generation new ld
generates. From NetBSD. ok art@


Revision tags: OPENBSD_3_0_BASE
# 1.7 25-Sep-2001 art

Do mmap the right way.


# 1.6 25-Sep-2001 art

Another attempt at getting this right. This time, play safe.


# 1.5 24-Sep-2001 art

Some cleanup.


# 1.4 24-Sep-2001 art

Get the bootstrapping right.


# 1.3 24-Sep-2001 art

dl_data is at the start of the stack, not after env. load loff.
Now _dl_boot starts correctly.


# 1.2 23-Sep-2001 drahn

add munmap syscall
change _rtld references to _dl to match C code.
change relocation types in archdep.h to be sparc64 relocs.

rtld_machine.c copied from alpha, with some modes to compile for sparc64

This is in-tree development.


# 1.1 21-Sep-2001 jason

first whack at ldasm.S... this will not work yet (partially based on NetBSD,
partially based on alpha)


Revision tags: OPENBSD_6_2_BASE
# 1.46 27-Aug-2017 deraadt

Replace heaps of hand-written syscall stubs with a simpler framework
which is largely MI.
ok visa kettenis


Revision tags: OPENBSD_6_1_BASE
# 1.45 24-Jan-2017 guenther

On fatal errors, kill ourselves with thrkill(0,9,NULL) instead of
simply exiting, via helper functions _dl_die(), _dl_diedie(), and
_dl_oom().

prompted by a complaint from jsing@
ok jsing@ deraadt@


# 1.44 28-Aug-2016 guenther

ld.so doesn't need gettimeofday or lstat stubs any more

ok deraadt@


Revision tags: OPENBSD_6_0_BASE
# 1.43 07-May-2016 guenther

Use a Thread Information Block in both single and multi-threaded programs.
This stores errno, the cancelation flags, and related bits for each thread
and is allocated by ld.so or libc.a. This is an ABI break from 5.9-stable!

Make libpthread dlopen'able by moving the cancelation wrappers into libc
and doing locking and fork/errno handling via callbacks that libpthread
registers when it first initializes. 'errno' *must* be declared via
<errno.h> now!

Clean up libpthread's symbol exports like libc.

On powerpc, offset the TIB/TCB/TLS data from the register per the ELF spec.

Testing by various, particularly sthen@ and patrick@
ok kettenis@


# 1.42 21-Mar-2016 bluhm

Rename the system call sendsyslog2 to sendsyslog. Keep the old one
as osendsyslog for a while. The three argument variant is the only
one that will stay.
input kettenis@; OK deraadt@


# 1.41 21-Mar-2016 guenther

Switch ld.so's stack smash handler from sendsyslog to sendsyslog2
and pass the LOG_CONS flag like libc's handler.

ok deraadt@ bluhm@ (who had a similar diff)


Revision tags: OPENBSD_5_9_BASE
# 1.40 15-Nov-2015 deraadt

ldd(1) sets environment variable LD_TRACE_LOADED_OBJECTS to tell ld.so
that it should show information about the program it loads, rather than
run it. In that specific case, ld.so can pledge to "stdio rpath" to
ensure that code path in ld.so has no bugs.
Yes, a pledge in ld.so.... who'd have thought!
ok guenther


# 1.39 19-Sep-2015 guenther

kbind has eliminated the need for and use of the bind lock. Delete it, the
the callback, and the sigprocmask stub.
Keep around the DL_SETBINDLCK case until libpthread stops using it.

discussed with miod@ at l2k15
ok kettenis@


# 1.38 13-Sep-2015 guenther

Rename __sysctl syscall to just sysctl, as the userland wrapper is no longer
necessary

ok deraadt@ jsing@


Revision tags: OPENBSD_5_6_BASE OPENBSD_5_7_BASE OPENBSD_5_8_BASE
# 1.37 14-Jul-2014 deraadt

Now that we have sendsyslog(2), we can directly use it in the
(previously completely retarded) stack_smash_handler of ld.so
ok beck miod tedu


# 1.36 09-Jul-2014 guenther

_dl_fcntl() is no longer used; kill the stubs

ok otto@ miod@


# 1.35 06-Jul-2014 otto

move from sysclt(KERN_ARND) to getentropy(2); ok miod@, kettenis@


Revision tags: OPENBSD_5_5_BASE
# 1.34 23-Dec-2013 kettenis

Use slightly diffrerent code to get the global offset table address. This
version will match the (upcoming) 32-bit version (for sparc) and allegedly
is slightly faster.


# 1.33 23-Dec-2013 kettenis

Make ld.so pass its cleanup handler in %g1 as required by the SPARC System V
ABI, and stop calling atexit(4) directly from ld.so on sparc64


# 1.32 13-Aug-2013 guenther

Switch time_t, ino_t, clock_t, and struct kevent's ident and data
members to 64bit types. Assign new syscall numbers for (almost
all) the syscalls that involve the affected types, including anything
with time_t, timeval, itimerval, timespec, rusage, dirent, stat,
or kevent arguments. Add a d_off member to struct dirent and replace
getdirentries() with getdents(), thus immensely simplifying and
accelerating telldir/seekdir. Build perl with -DBIG_TIME.

Bump the major on every single base library: the compat bits included
here are only good enough to make the transition; the T32 compat
option will be burned as soon as we've reached the new world are
are happy with the snapshots for all architectures.

DANGER: ABI incompatibility. Updating to this kernel requires extra
work or you won't be able to login: install a snapshot instead.

Much assistance in fixing userland issues from deraadt@ and tedu@
and build assistance from todd@ and otto@


Revision tags: OPENBSD_5_4_BASE
# 1.31 01-Jun-2013 miod

Introduce ltrace(1). This tool works with ld.so to inject utrace record for
each plt call, allowing to trace a binary linked against shared library at the
public function call level.

To do so, ltrace(1) sets up some environment variables to enable plt tracing
in ld.so, and invokes ktrace(2) for utrace events. ld.so will force lazy
binding and will send an utrace record in the plt resolver, without updating
the plt.

Minimal filtering capabilities are provided, inspired by Solaris' truss -u,
to limit tracing to libraries and/or symbol names. Non-traced libraries and
symbols will have the regular resolver processing, with the expected plt
update.

"Get it in" deraadt


# 1.30 05-Apr-2013 kurt

- Add ORIGIN, OSNAME, OSREL and PLATFORM substitution support for rpaths.
Improvements and okay matthew@, millert@, guenther@


Revision tags: OPENBSD_5_3_BASE
# 1.29 24-Oct-2012 guenther

Garbage-collect the _dl_stat() routine, now unused

ok matthew@ deraadt@


# 1.28 22-Oct-2012 kettenis

Stop passing around PS_STRINGS in %g1. The ELF ABI reserves this register
for passing around a pointer to a cleanup function and we'd like to use it
for that purpose in the near future.

ok miod@


Revision tags: OPENBSD_4_9_BASE OPENBSD_5_0_BASE OPENBSD_5_1_BASE OPENBSD_5_2_BASE
# 1.27 27-Oct-2010 millert

Fix comment; no binary change. OK deraadt@


Revision tags: OPENBSD_4_8_BASE
# 1.26 09-May-2010 kettenis

Reserve space for 6 extended word argument slots required by the ABI.
Apparently gcc4 uses them in cases where gcc3 didn't. Fixes segmentation
faults with gcc4 because the space for the slots was colliding with
the space for dl_data that we allocated on the stack.

ok miod@


# 1.25 24-Apr-2010 kettenis

Fix handling of more than 32768 PLT entries. Mostly from NetBSD.

eyeballed by deraadt@ and drahn@


Revision tags: OPENBSD_4_0_BASE OPENBSD_4_1_BASE OPENBSD_4_2_BASE OPENBSD_4_3_BASE OPENBSD_4_4_BASE OPENBSD_4_5_BASE OPENBSD_4_6_BASE OPENBSD_4_7_BASE
# 1.24 03-May-2006 drahn

prebind - how to prelink a binary without throwing security out the window

Prelink fixes the address of libraries making 'return to libc' attacks trival,
prebind uses a different method to achieve most of the same gains, however
without adding any security conerns.

Still under development, now in-tree.


Revision tags: OPENBSD_3_6_BASE OPENBSD_3_7_BASE OPENBSD_3_8_BASE OPENBSD_3_9_BASE
# 1.23 25-May-2004 deraadt

spacing


Revision tags: OPENBSD_3_5_BASE
# 1.22 10-Jan-2004 pvalchev

the sparcv9 ABI requires registers %g2, %g3 to be first announced before
it can use them, and gcc3 catches this
ok henric


Revision tags: OPENBSD_3_4_BASE
# 1.21 12-Aug-2003 jason

use _ENTRY consistently, remove some #if 0 code, and clean up some comments; ok drahn


# 1.20 09-Jul-2003 drahn

changes to ld.so to be compatible with newer binutils, requires
slight changes in the startup code on most archs. ok art@ brad@


# 1.19 02-Jun-2003 jason

nuke clause 3 & 4


# 1.18 30-May-2003 drahn

When loading a shared object or libraries dependant object, load them
in random order. This will reduce the possiblity of a buffer overflow
being able to predict the addresss of useful code. Can be disabled
with the LD_NORANDOM environment variable for debugging purposes.
ok deraadt.


Revision tags: OPENBSD_3_3_BASE
# 1.17 02-Feb-2003 deraadt

knf & ansi; drahn ok


# 1.16 18-Dec-2002 drahn

Prepare for an upcoming ELF executable change. This will allow ld.so to
protect the GOT and PLT sections of the executable from being overwritten.
This behavior is enabled by changes in the executable/shared object layout,
and does not occur without the ld changes.


# 1.15 23-Nov-2002 drahn

clean up comments.


# 1.14 21-Oct-2002 drahn

Simplify the ld.so asm api, the data is available other ways.
tested by naddy@ and myself.


Revision tags: OPENBSD_3_2_BASE
# 1.13 11-Aug-2002 drahn

The parameter dynp was never used, rather than pass in a dummy on most
archs and a nasty calcuation on others, remove the parameter.


# 1.12 12-Jul-2002 drahn

Change ld.so search order/method to match the a.out ld.so.

run destructors on dlclose()

Move more symbols into _dl_ private space, so that the proper (libc)
version of the function will be used.

Add readdir() functionality to perform the proper library searching.

Support DL_PRELOAD

Do not relocate symbols if ld.so is being traced (and will exit).

Misc lint cleanup.

ok art@


# 1.11 24-May-2002 deraadt

more KNF


# 1.10 24-May-2002 deraadt

various KNF


Revision tags: OPENBSD_3_1_BASE
# 1.9 17-Mar-2002 art

Clean up the zapping of bad variables. Instead of implementing
_dl_suid_ok, just use the issetugid syscall.
ok drahn@.


# 1.8 15-Mar-2002 drahn

Add support for binutils 2.11. Work around change in PLT generation new ld
generates. From NetBSD. ok art@


Revision tags: OPENBSD_3_0_BASE
# 1.7 25-Sep-2001 art

Do mmap the right way.


# 1.6 25-Sep-2001 art

Another attempt at getting this right. This time, play safe.


# 1.5 24-Sep-2001 art

Some cleanup.


# 1.4 24-Sep-2001 art

Get the bootstrapping right.


# 1.3 24-Sep-2001 art

dl_data is at the start of the stack, not after env. load loff.
Now _dl_boot starts correctly.


# 1.2 23-Sep-2001 drahn

add munmap syscall
change _rtld references to _dl to match C code.
change relocation types in archdep.h to be sparc64 relocs.

rtld_machine.c copied from alpha, with some modes to compile for sparc64

This is in-tree development.


# 1.1 21-Sep-2001 jason

first whack at ldasm.S... this will not work yet (partially based on NetBSD,
partially based on alpha)