| Commit message (Collapse) | Author | Age | Files | Lines |
|
|
|
|
| |
Otherwise, the prototypes for timespec_get() and aligned_alloc()
are not visible. OK guenther@
|
| |
|
|
|
|
|
|
|
|
| |
- setting up asr in single thread mode and then starting threads using asr
would lead to multiple threads sharing the same resolver.
- destruction of a thread that has been using asr would leak data.
Problem originally reported by Alexey Sokolov and Uli Schlachter.
ok kettenis@
|
|
|
|
|
|
|
| |
like mem{set,cpy,move} or __stack_smash_handler using asm() renaming. So
treat gcc3 like clang and mark such functions as protected instead.
ok ayoma@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
_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@
|
| |
|
|
|
|
|
|
|
|
|
| |
This implementation reduces contention because threads no longer need
to spin calling sched_yield(2) before going to sleep.
Tested by many, thanks!
ok visa@, pirofti@
|
|
|
|
|
|
| |
making the number of pools variable. Do not document the malloc
conf settings atm, don't know yet if they will stay. Thanks to all
the testers. ok deraadt@
|
|
|
|
|
|
|
| |
dance, mark it protected. This works better for both gcc and clang: gcc
blocks overriding of internal calls, while clang permits inlining again.
ok otto@
|
|
|
|
|
|
|
| |
interface is also made available as __cxa_thread_atexit_impl to satisfy the
needs of GNU libstdc++.
ok guenther@, millert@
|
|
|
|
|
|
|
|
|
| |
to builtins like mem{set,cpy,move} and __stack_smash_handler. So, when
building with clang, instead mark those as protected visibility to get rid
of the PLT relocations. We can't take the address of them then, but that's
ok: it's a build-time error not a run-time error.
ok kettenis@
|
|
|
|
|
|
|
|
| |
While it is not clear (to me) why that ports ends up with corrupted
shared libs, reverting those changes fixes the issue and should allow us
to close p2k17 more smoothly.
Discussed with a bunch, ok ajacoutot@ guenther@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
on the stack instead of mallocing the list and move the APIs from libpthread
to libc so that they can be used inside libc.
Note: the standard was explicitly written to permit/support this
"macro with unmatched brace" style and it's what basically everyone
else already does. We xor the info with random cookies with a
random magic to detect/trip-up overwrites.
Major bump to both libc and libpthread due to the API move.
ok mpi@
|
|
|
|
|
|
|
|
| |
pthread_exit from libpthread to libc, along with low-level bits to
support them. Major bump to both libc and libpthread.
Requested by libressl team. Ports testing by naddy@
ok kettenis@
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
This gives fast access to the address on systems that implement
the UserLocal register. TCB caching is still used when running
in the single-threaded mode in order not to penalize old systems.
The kernel counterpart of this change must be in place before
using this diff!
With guenther@
|
|
|
|
|
| |
prodded by otto@
ok kettenis@ otto@
|
|
|
|
| |
tested by many (thanks!) ok tedu, guenther@
|
|
|
|
|
|
|
| |
locale implementation: _{Current,Default}*Locale, __[mn]locale_changed,
__mb_len_max_runtime
ok millert@ schwarze@ deraadt@
|
|
|
|
| |
slow TCB_GET (alpha, arm, mips64, sh) was broken when I switched CPP symbols.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
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@
|
| |
|
|
|
|
| |
prodded by deraadt@
|
|
|
|
|
|
|
|
|
| |
into libc, and move pthread_sigmask() as well (just a trivial wrapper).
This provides consistent handling of SIGTHR between single- and multi-threaded
programs and is a step in the merge of all the libpthread overloads, providing
some ASM and Makefile bits that the other wrappers will need.
ok deraadt@ millert@
|
|
|
|
| |
ok deraadt@
|
|
|
|
|
|
|
|
| |
so that we can provide asm labels for the memcpy/memset/__stack_smash_handler
calls that it generates ab initio. Eliminate direct #includes of it. Make
sure it's a dependency of all objects (unnecessary for asm, but close enough).
ok deraadt@
|
|
|
|
| |
ports scan by sthen@
|
|
|
|
|
|
| |
to eliminate duplicate copies of the tables and get direct access internally
ok kettenis@ deraadt@
|
|
|
|
|
|
| |
_cat* in the process.
ok kettenis@
|
|
|
|
|
|
|
|
|
|
|
|
| |
wrapper .h files and asm labels to let internal calls resolve directly and
not be overridable or use the PLT. Then, apply that framework to most of
the functions in stdio.h, string.h, err.h, and wchar.h. Delete the
should-have-been-hidden-all-along _v?(err|warn)[cx]? symbols while here.
tests clean on i386, amd64, sparc64, powerpc, and mips64
naming feedback from kettenis@ and millert@
ok kettenis@
|
|
|
|
|
|
| |
symbols that are not longer exported. (This improves the generated code.)
ok deraadt@
|
|
|
|
|
|
|
|
|
|
| |
unregistering callbacks if the DSO is unloaded. Move the callback
handling from libpthread to libc, though libpthread still overrides the
inner call to handle locking and thread-library reinitialization.
Major version bump for both libc and libpthread.
verification that this fixes various ports ajacoutot@
asm assistance miod@; ok millert@ deraadt@
|
|
|
|
|
|
|
|
| |
handling to fix up the alignment of 64bit arguments so that they do
the same dance where _thread_sys_FOO is the real stub and FOO is a
weak alias. For some of them, this is needed for cancellation handling.
From discussions with fgsch@, ok millert@
|
| |
|
| |
|
|
|
|
|
|
|
|
|
|
|
| |
instead of the generic pthread macros since free(3) uses __arc4_getbyte()
when freeing small sized allocations and the generic pthread macros call
malloc(3).
- eliminate passing pointers to a static variable with global scope (rs)
for additional code clarity and reduction.
- shlib minor bumps for libc and libpthread due to new functions.
From andreas@ with some bits from me. okay tedu@ marc@ w/some spot
checking from millert@
|
|
|
|
| |
both static and non-static mutexs.
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
isolate its usage to libpthread only and replace with generic non-static
mutex support in the one place it is needed:
- remove _FD_LOCK/UNLOCK from lseek and ftruncate in libc and make the
functions weak so that libpthread can override with its own new
versions that do the locking.
- remove _thread_fd_lock/unlock() weak functions from libc and adjust
libpthread for the change.
- add generic _thread_mutex_lock/unlock/destroy() weak functions in libc
to support non-static mutexes in libc and add libpthread and librthread
implementations for them. libc can utilize non-static mutexes via the
new _MUTEX_LOCK/UNLOCK/DESTROY() macros. Actually these new macros can
support both static and non-static mutexes but currently only using
them for non-static.
- make opendir/closedir/readdir/readdir_r/seekdir/telldir() thread-safe
for both thread libraries by using a non-static mutex in the struct
_dirdesc (typedef DIR), utilizing it in the *dir functions and remove
remaining and incorrect _FD_LOCK/UNLOCK() use in libc.
- add comments to both thread libraries to indicate libc depends on the
current implementation of static mutex initialization. suggested by
marc@
- major bump libc and libpthread due to function removal, structure
change and weak symbol conversions.
okay marc@, tedu@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| |
Adjust design of file descriptor table to eliminate races
with both opening and closing of file descriptor entries
and eliminates one class of deadlocks. One nice side effect
of this change in design should be better performance for
applications that open and close many file descriptors due
to reduced fd_table_lock contention and fd entry reuse.
- Add entry states to manage use of entry and eliminate
some closing races. fd entries are not deallocated upon
close() now.
- Call _thread_fd_table_init with one of five discreet
modes to properly initialize an entry and manage the
state transition to open.
- When closing an entry hold the entry spinlock locked
across the state transition and the _thread_sys_close
call to close another race.
- Introduce a new lock type FD_RDWR_CLOSE that transitions
either a closed entry or an open entry into closing state
and then waits for a RDWR lock so that the lock queue can
unwind normally. All subsequent fd lock attempts for that
entry are rejected with EBADF until the fd is fully closed,
or reopened by dup2(). Once a thread holds the FD_RDWR_LOCK
it is safe to close() it or dup2() on it.
- When a thread creates a new fd there is a window of time
when another thread could attempt to use the fd before the
creating thread has initialized the entry for it. This can
result in improper status_flags for the entry, so record
the entries init mode, detect when this has happened and
correct the status_flags when needed.
reviewed by marc@ & brad@, tested by several, okay brad@
|
|
|
|
|
| |
originally reported by Gergely Kovacs; help from dhartmei@;
ok tedu@ millert@
|
|
|
|
|
|
| |
it has already been defined by previous includes. While this
is true at the moment, it will no longer be true after a pending
includes cleanup. OK marc@
|
|
|
|
|
|
|
| |
Make sure tolower/toupper use the whole 8 bits.
okay deraadt@
thanks to everyone who tested
|
|
|
|
|
|
| |
particular implementation of libpthread for libc. libc no longer
needs pthread.h to compile.
OK millert@, brad@, tedu@
|
|
|
|
|
|
|
|
|
|
| |
Access to the global _res structure replaced by pointers to a
per thread instance. If unthreaded the pointer is to the
global structure.
Also replaced a 64k stack array with malloc-ed memory so
threaded aps (with a default 64k stack) have a chance at working.
ok deraadt@
|
|
|
|
| |
Thanks to miod@ for m68k and vax fixes
|
| |
|
|
|
|
|
|
|
| |
alpha (millert@), i386 (marc@), m68k (millert@ and miod@),
powerpc (drahn@ and dhartmei@), sparc (millert@ and marc@),
sparc64 (marc@), and vax (millert@ and miod@).
Thanks to millert@, miod@, and mickey@ for fixes along the way.
|
|
|
|
| |
hand editing to make comments line up correctly. Another pass is forthcoming that handles the cases that could not be done automatically.
|
| |
|
|
|
|
| |
Test next time, ok?
|