History log of /openbsd-src/lib/libc/dlfcn/init.c (Results 1 – 24 of 24)
Revision Date Author Comments
# 17423a06 22-Jul-2024 kettenis <kettenis@openbsd.org>

Specify a priority for _libc_preinit() to make sure it runs before other
constructors (such as the constructor for libcompiler_rt).

ok guenther@


# ef873df0 14-Jul-2024 jca <jca@openbsd.org>

Add elf_aux_info(3)

Designed to let userland peek at AT_HWCAP and AT_HWCAP2 using an already
existing interface coming from FreeBSD. Headers bits were snatched from
there. Input & ok kettenis@

lib

Add elf_aux_info(3)

Designed to let userland peek at AT_HWCAP and AT_HWCAP2 using an already
existing interface coming from FreeBSD. Headers bits were snatched from
there. Input & ok kettenis@

libc bump and sets sync will follow soon

show more ...


# 51689999 21-Jan-2024 kettenis <kettenis@openbsd.org>

Static non-PIE binaries always have a base address of 0 (even if the ELF
headers start at a higher address). Using the wrong base address meant
that we were protecting the wrong address range for th

Static non-PIE binaries always have a base address of 0 (even if the ELF
headers start at a higher address). Using the wrong base address meant
that we were protecting the wrong address range for the malloc internals
which made the code error out now that mimmutable(2) no longer allows an
RW->R transition. Issue found by gkoehler@ who got most of the way
towards a proper fix.

ok deraadt@

show more ...


# c5e6b56a 19-Jan-2024 deraadt <deraadt@openbsd.org>

Stop initializing pinsyscall(SYS_execve in static binaries that contain
an execve(2) stub. The new pinsyscalls(2) that applies to all system
calls has made this redundant.


# 7e9312b9 18-Jan-2024 deraadt <deraadt@openbsd.org>

the warning about syscall going away is a bit dated now.
ok miod tb


# 15330de0 12-Oct-2023 deraadt <deraadt@openbsd.org>

Static binaries which do not call execve() were not calling
pinsyscall(SYS_execve, ...). Upon review, this is a fairly small
set of programs which either pledge() aggressively or don't usually
opera

Static binaries which do not call execve() were not calling
pinsyscall(SYS_execve, ...). Upon review, this is a fairly small
set of programs which either pledge() aggressively or don't usually
operate in a risky operating environment. We now point at a location
which is definately not a "syscall" instruction.
ok kettenis

show more ...


# c35fbcd4 27-Feb-2023 deraadt <deraadt@openbsd.org>

use the correct size of the execve syscall stub


# 50581e41 24-Feb-2023 deraadt <deraadt@openbsd.org>

Try to warn about syscall() possibly being deleted from libc in the
future. The ports team is already running around with axes and mops,
but don't worry such an action won't happen quickly.
with tb


# 0a5dddd9 21-Feb-2023 deraadt <deraadt@openbsd.org>

hppa does some weird callgate stuff, so the pinsyscall() provides the
wrong address to the kernel. disable for now.


# a8b84ed6 21-Feb-2023 deraadt <deraadt@openbsd.org>

dlfcn/init.c


# 1c92691b 21-Feb-2023 deraadt <deraadt@openbsd.org>

Do pinsyscall() after static libc is configured for errno storage.


# 69954aaa 21-Feb-2023 deraadt <deraadt@openbsd.org>

In static binaries, if WEAK execve can be found, use pinsyscall(2) to
tell the kernel where the execve stub is found. With this mechanism
we cannot tell the size, so use 128 as an estimate for the m

In static binaries, if WEAK execve can be found, use pinsyscall(2) to
tell the kernel where the execve stub is found. With this mechanism
we cannot tell the size, so use 128 as an estimate for the most we expect
from any architecture.
discussed with kettenis, ok guenther

show more ...


# b18b10d8 16-Jan-2023 guenther <guenther@openbsd.org>

Currently we disable kbind(2) for static program from libc.a's
preinit hook. Delete that and instead have the kernel disable kbind
at exec-time if the program doesn't have an ELF interpreter. For
n

Currently we disable kbind(2) for static program from libc.a's
preinit hook. Delete that and instead have the kernel disable kbind
at exec-time if the program doesn't have an ELF interpreter. For
now, permit userland calls to disable it when already disabled so
existing static programs continue to work.

prompted by deraadt@ questioning about the call in libc.a

ok deraadt@ miod@

show more ...


# 2c53affb 27-Dec-2022 jmc <jmc@openbsd.org>

spelling fixes; from paul tagliamonte
any changes not taken noted on tech, but chiefly here i did not take the
cancelation - cancellation changes;


# 493e9f46 06-Nov-2022 deraadt <deraadt@openbsd.org>

When a TEXTREL binary is loaded, non-writeable LOADs are not made immutable
because a loader may want to perform text relocations wrapped inside
mprotect permission flips. So static TEXTREL binaries

When a TEXTREL binary is loaded, non-writeable LOADs are not made immutable
because a loader may want to perform text relocations wrapped inside
mprotect permission flips. So static TEXTREL binaries need to perform
this operation themselves, at this fairly late point.
ok kettenis

show more ...


# 22966de3 16-Jul-2020 tedu <tedu@openbsd.org>

allow setenv LIBC_NOUSERTC to disable userland timekeeping, for ktrace.
ok deraadt pirofti


# d82e6535 06-Jul-2020 pirofti <pirofti@openbsd.org>

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they

Add support for timeconting in userland.

This diff exposes parts of clock_gettime(2) and gettimeofday(2) to
userland via libc eliberating processes from the need for a context
switch everytime they want to count the passage of time.

If a timecounter clock can be exposed to userland than it needs to set
its tc_user member to a non-zero value. Tested with one or multiple
counters per architecture.

The timing data is shared through a pointer found in the new ELF
auxiliary vector AUX_openbsd_timekeep containing timehands information
that is frequently updated by the kernel.

Timing differences between the last kernel update and the current time
are adjusted in userland by the tc_get_timecount() function inside the
MD usertc.c file.

This permits a much more responsive environment, quite visible in
browsers, office programs and gaming (apparently one is are able to fly
in Minecraft now).

Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others!

OK from at least kettenis@, cheloha@, naddy@, sthen@

show more ...


# 5c7d06e5 02-Jun-2019 guenther <guenther@openbsd.org>

Complete the ld.so boot cleanup: move most libc initialization from
_csu_finish() to _libc_preinit(), which is an .init_array function
in shared libc (and mark it INITFIRST) or a .preinit_array funct

Complete the ld.so boot cleanup: move most libc initialization from
_csu_finish() to _libc_preinit(), which is an .init_array function
in shared libc (and mark it INITFIRST) or a .preinit_array function
in static libc, grabbing the _dl_cb callback there from ld.so. Then
in _csu_finish(), invoke the dl_clean_boot() callback to free ld.so's
startup bits before main() gets control.

Other cleanups this permits:
- move various startup structures into .data.rel.ro
- the dl* stubs in libc can be strong and call the callbacks provided
via _dl_cb
- no longer need to conditionalize dlctl() calls on presence of _DYNAMIC

original concept and full diff ok kettenis@
ok deraadt@

show more ...


# f54aa464 01-Dec-2017 guenther <guenther@openbsd.org>

Redo the calculation of the alignment and placement of static TLS data to
correctly take into account the segment p_align. Previously, anything
with a size belong the natural alignment or with align

Redo the calculation of the alignment and placement of static TLS data to
correctly take into account the segment p_align. Previously, anything
with a size belong the natural alignment or with alignment larger than
the natural one would either not be intialized correctly, be misaligned,
or result in the TIB being misaligned.

Problems reported by Charles Collicutt (charles (at) collicutt.co.uk)
ok kettenis@

show more ...


# 767451c3 06-Sep-2016 guenther <guenther@openbsd.org>

Implement dl_iterate_phdr() for static PIE executables using info extracted
from the aux vector.

ok patrick@ kettenis@


# fe38b55c 07-May-2016 guenther <guenther@openbsd.org>

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

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@

show more ...


# d97c60ea 21-Mar-2016 guenther <guenther@openbsd.org>

The asm in the MD_DISABLE_KBIND macro was too fragile and broke alpha and hppa.
So instead, do the kbind disabling with syscall().

debugging and ok deraadt@, ok kettenis@


# 70a1bc6e 20-Mar-2016 guenther <guenther@openbsd.org>

Add $OpenBSD line


# 5af055cd 20-Mar-2016 guenther <guenther@openbsd.org>

Rearrange C runtime bits: now that ld.so exports environ and __progname,
move their definitions and initialization in static links to libc.a
Make crt0 always invoke a new func _csu_finish() in libc t

Rearrange C runtime bits: now that ld.so exports environ and __progname,
move their definitions and initialization in static links to libc.a
Make crt0 always invoke a new func _csu_finish() in libc to process the auxv
and to either register the ld.so cleanup function (in dynamic links) or
initialize environ and __progname and do MC_DISABLE_KBIND (in static links).
In libc, get pagesize from auxv; cache that between getpagesize() and
sysconf(_SC_PAGESIZE)

ok mpi@ "good time" deraadt@

show more ...