Commit Graph

20022 Commits

Author SHA1 Message Date
ryo 3bf82836bf patbuf must be updated if the length of patbuf is greater than or equal to 0. (that is always)
fix of r1.7 was incorrect.
2020-03-30 06:56:38 +00:00
ryo 1148c4261d fix build error with SDEBUG, MAP_DEBUG, DEBUG_REFRESH 2020-03-30 06:54:37 +00:00
roy 2d748ff84b terminfo: satisfy gcc bitching 2020-03-30 02:08:11 +00:00
roy 7f0204b5ec terminfo: v3 records should create v3 aliases 2020-03-30 00:09:06 +00:00
roy 5159a4258d terminfo: Promote a terminfo description to v3 when required
Blindly scanning the capabilities for # and checking that the following
number is bigger than a short isn't reliable because this could be a
string value:

SomeString#1234

Instead, if we process the numeric as normal and if it's value is too big
for v1 then promote the record to v3.
2020-03-29 21:46:22 +00:00
roy 59ea2669e1 terminfo: allow _ti_getname to convert from and to any version 2020-03-29 18:54:57 +00:00
roy 664218069f terminfo: Clamp numeric bounds to storage not API.
While here, fix decoding of numeric -1 stored in uint16_t to still be -1.
2020-03-29 18:32:45 +00:00
christos e2a9896bc4 PR/55118: Andreas Gustafsson: Oops, set the right flag variable. 2020-03-28 15:45:56 +00:00
roy 0b457be2fc terminfo: Add a comment for prior change. 2020-03-28 15:27:54 +00:00
roy 171093fef0 terminfo: use , as a record version delimiter rather than @
@ is allowed in a terminfo description, but a comma is not.
2020-03-28 15:25:53 +00:00
roy 96d0e34238 Whitespace 2020-03-28 15:23:33 +00:00
christos f5703f6ba1 support for older compilers 2020-03-28 02:38:15 +00:00
christos 1d30fdae10 Introduce a bunch of inline functions and utilities to avoid code duplication. 2020-03-27 17:39:53 +00:00
christos 3958d16a96 As described in tech-userlevel:
- Modify the writing code to only write entries in the new
  format for the terminal descriptions that require it.
- Store new format entries as <name>@v3
- Store old format entries with clamped values as <name> for
  backwards compatibility
- Lookup first <name>@v3 and then <name> if that is not found.
- Don't create terminfo2 anymore; old programs keep working with
  clamped entries, and new programs be able to use the wide
  fields with using the original db file.
2020-03-27 15:11:57 +00:00
wiz 2d8be20973 Remove trailing whitespace. 2020-03-25 22:09:48 +00:00
christos 703562b76a new paragraph 2020-03-25 21:26:12 +00:00
christos 00c598c3f1 more info 2020-03-25 21:24:08 +00:00
christos 6fa2277528 Revert putting a $ as the final character for blowfish. It is not required by
MCF and we want to be compatible.
2020-03-25 21:02:26 +00:00
wiz 51ad823948 Fix typos. Use more markup. New sentence, new line. 2020-03-25 18:53:50 +00:00
kre 4f0910e281 Delete the BUGS paragraph about the "missing" const qualifier for the
result type of strerror() (and strerror_l()).   While that once should
really have been present, when strerror() was invented, there was no
"const" qualifier in C to apply, and now the way the code is writtem
(really needs to be because of NLS support) the const is no longer
really appropriate.

Applications still shouldn't attempt to modify the result however.
2020-03-25 18:50:47 +00:00
kre 5388a00941 Document strerror_l()
While here also document (but comment it out since it isn't
available - yet) strerror_lr().   To include that, simply
uncomment the relevant lines, and (twice I think) s/returns/return/
on lines just after currently commented out lines (that is, it
currently says, "A returns" after the comments are returned, we
need it to be "A and B return" - the "and B" appears when the comment
markers are removed, removing the 's' from returns must be done manually.

In addition to adding strerror_l() some additional enhancements were
made to the general strerror() doc.
2020-03-25 18:45:42 +00:00
christos 3178d52ed6 - bump blowfish size, explain version
- add passwd xref
2020-03-25 18:37:08 +00:00
christos fd9ae3edee Add missing trailing $ for blowfish 2020-03-25 18:36:29 +00:00
gdt d5db881aeb Relax fdatasync restriction that fd be writable
The restriction that a fd passed to fdatasync(2) must be writable was
added in 2003 in order to comply with POSIX.  Since then, POSIX has
removed that requirement, and POSIX-valid programs have been therefore
encountering errors on NetBSD.

Patch by Paul Ripke after discussion on netbsd-users.  Issue
discovered with pkgsrc/databases/mongodb3 as used by pkgsrc/net/unifi.
2020-03-25 18:08:34 +00:00
christos 54fcd90b42 PR/55095: David A. Holland: pw_gensalt(3) undocumented 2020-03-25 17:11:06 +00:00
kre 219987b252 Arrange that strerror(-1) prints "Unknown error: -1" and not the
unsigned equivalent of -1.

While here, guarantee, even when !NLS, that nothing here (not even
snprintf deciding to complain about EILSEQ or something) can ever
alter errno (ie: always save and restore it, not only in the NLS case).
The functions here must never alter errno, whatever happens.
2020-03-25 16:15:41 +00:00
kre 93b9d85a0a Protect against malloc failure corrupting errno, which is not
permitted of these functions.
2020-03-25 16:10:17 +00:00
kre 12f8bae508 If we're going to loop, pausing and then retrying malloc() after it
has failed, in the hope that some other thread has free'd some memory,
but we want to bound the number of attempts, it helps if we actually
count them - otherwise we never get nearer to the limit.

In practice, malloc() for a reasonable application on a modern system
almost never fails, so the code containing this bug has probably never
been, and never will be, executed, but just in case, someday.

For this, it isn't clear if the intent was to have 10 retries (ie: 11
attempts) or 10 tries, but as the code said "retries > 10", I am
assuming the former (not that it matters, if the malloc() has failed
10 times in a row, with 10 second pauses between, the chances of an
11th succeeding aren't great).
2020-03-24 14:56:31 +00:00
kamil 15f8c76f05 Revert previous
It will be addressed in a better way.

Requested by <kre>
2020-03-24 14:47:02 +00:00
kamil 43bf7c3563 Avoid buffer overflow
Detected with ASan + RUMPKERNEL.
2020-03-24 01:56:56 +00:00
kamil 05ac20bb1c Fix off-by-one
Before accessing array member, check whether it is not out of valid range.

Detected with ASan + RUMPKERNEL.
2020-03-24 01:13:41 +00:00
wiz e9fe6f785f Fix synopsis, use more markup. 2020-03-23 16:14:20 +00:00
roy 41aea6ac80 Add missing man page for curses mouse functions. 2020-03-23 15:32:56 +00:00
roy bb2ce1fb3d curses: Add stubs for mouse functions
No mouse support actually included.
But that doesn't matter because most terms don't actually support a mouse.

We should look into hooking these into wsmouse(4) and xterm mouse
in the future.

Compatable with nCurses mouse API version 2.
2020-03-23 13:37:36 +00:00
pgoyette 561f1f3c9a Teach rump to process __link_set_evcnts entries. (Second part of
fix for PR kern/55088)
2020-03-22 13:30:10 +00:00
pgoyette 5996efe558 Teach rump how to process __link_set_sysctl_funcs so it can handle
modules the same as a real kernel.

Partly addresses PR kern/55088 - __link_set_evcnts not yet handled
(that will happen later)
2020-03-21 04:48:37 +00:00
tnn 15173c72e8 libp2k still needs to be under MKRUMP 2020-03-18 00:37:29 +00:00
christos a3dab7b65f pam and tpm have nothing to do with rump, so limit them to the libraries that
need MKRUMP. (from Tobias Nygren)
2020-03-17 22:20:48 +00:00
uwe eea4ed980c werase, wclrtobot, wclrtoeol - make code even more similar.
Rename attr to battr to match bch and WINDOW::battr.
No functional change intended.
2020-03-15 01:18:43 +00:00
uwe 878e2e095f __NEED_ERASE - don't shadow __LDATA::attr with macro parameter name. 2020-03-15 01:12:47 +00:00
roy aadfdb111b terminfo: promote numeric parameters from short to int
POSIX mandates implementations must support upto a short but may exceed it.
When NetBSD terminfo was implemented, no terminfo description used over
a short, but because ncurses has supported ints for some time, some now do.

Infact, such a terminfo description was imported where colour pairs for
screen-256color went up to 65536 which exposed a bug in the existing
implementation where it set to zero. Because the number might mean
something more than a range, we need to be able to store it accurately.

This requires a version bump because whilst the API hasn't changed thanks
to C int promotion, the ABI has. Also the underlying database structure
has changed as well - we now store the numeric paramter inside a uint32_t
field rather than a uint16_t one.
Whilst this change can still read the old style database, the old one
cannot read the new one and thus we now maintain the database as
terminfo2.cdb, leaving the old library and database alone so old programs
still work fine.

libcurses, libfrom, libmenu and libpanel have also been bumped to
accomoate this change.
2020-03-13 15:19:24 +00:00
roy 66ae8b28c2 curses: wrap the erase logic in a macro
Easier to use, it's in one place and now hopefully everyone is happy.

X
2020-03-13 02:57:26 +00:00
roy 8a456320fe curses: use perror rather than err in initscr
libhack lacks err and perror is more portable.
2020-03-12 15:50:11 +00:00
roy 62c320f6cd terminfo: truncate numeric parameters to a short
Because that is what our API demands.
We should probably change to int when we next bump the API.
2020-03-12 14:52:04 +00:00
roy d93d20bc2b curses: normalise erase logic with clrtoeol and clrtobot
Define WA_ATTRIBUTES as 0 for the non wide case just to make our code
easier to write.
2020-03-12 12:17:15 +00:00
roy 8e383c4d06 curses: note the change in initscr in our fine man page. 2020-03-12 11:38:28 +00:00
roy 63d07d6408 curses: Fix werase(3) wide character support
We need to consider erasing all attributes, not just WA_ATTRIBUTES.
Fixes PR lib/23910.

While here, make the function a little more readable.
2020-03-11 23:47:40 +00:00
roy 5e81f724dc curses: application should exit if initscr(3) fails
POSIX defines this behaviour here:
https://pubs.opengroup.org/onlinepubs/7908799/xcurses/initscr.html

Partial fix for PR lib/23910
2020-03-11 21:33:38 +00:00
mgorny 52ba4403cb Bump new libc minor due to new errno codes 2020-03-08 22:27:38 +00:00
mgorny 558ea2bcab PR standards/44921: Add errno consts for robust mutexes
Add the two missing errno.h constants: EOWNERDEAD and ENOTRECOVERABLE.
While technically they're used for robust mutexes which we do not
support at the moment, they are listed in POSIX and used by libc++.
While libc++ can be made to build without it, it just locally redefines
the values then, so we may as well define them globally.
2020-03-08 22:09:42 +00:00
mgorny 11397e5cf3 Sync signal messages between catalog and sys_siglist 2020-03-08 22:06:05 +00:00
mgorny b967d10fab Sync errno messages between catalog and errno.h 2020-03-08 22:05:40 +00:00
rin 26ac97dee2 Fix broken printf(3) %d output for numbers more than two digits, e.g.,
printf("%d\n", 42) ---> "::" instead of "42"

Our __{,u}modsi3 codes assume that __udivsi3 returns remainder to
%d1 (volatile register). __udivsi3 in libgcc does not, and therefore
mixing them up results in mess.
2020-03-08 06:30:06 +00:00
chs 86de7c20e3 use a binary search in _kvm_pa2off(). this helps a lot for sparse dumps,
which can have millions of memory segments.
2020-03-08 00:14:18 +00:00
chs 29a37a72ce only do bounce buffering for character devices. 2020-03-08 00:06:42 +00:00
msaitoh 05893f30c2 miscelaneous -> miscellaneous in comment. 2020-03-05 15:56:20 +00:00
christos 66ab3c9c4f move the pam module after the trench where pam is being build 2020-03-03 20:01:01 +00:00
rin 1bdcb77c81 Comment that libpam depends on libssh. 2020-03-03 14:29:57 +00:00
christos e54fad504b Move libpam to the next trench since it depends on ssh 2020-03-03 12:54:51 +00:00
riastradh 422017511d Remove unfinished hack I accidentally committed in 2017.
This caused make to unconditionally take ages running useless
submakes in every subdirectory.  Accidentally committed during the
MKCRYPTO option removal when I was presumably experimenting with
automating library dependency generation in lib.

Should shave a few seconds at least off every build!
2020-03-03 04:20:50 +00:00
christos 793e7dfe1f Add debugging commented out. 2020-03-03 00:46:06 +00:00
christos 06535827bc Add libcbor, libfido2 2020-03-03 00:37:05 +00:00
christos 454e43c47d Add sysloglike attr. 2020-03-02 15:30:25 +00:00
christos f064f71d05 fix print-like attrs 2020-03-02 14:18:50 +00:00
christos 74707f6a8a PR/55041: Fix printf format in syslog(3) error message. 2020-03-02 14:10:24 +00:00
christos a2362fee00 Redo the sshsk_sign() stuff properly, but putting the helper in libssh.so 2020-03-01 20:59:52 +00:00
christos 30dba8ff06 Add the sign client part. 2020-03-01 14:50:43 +00:00
christos 36f537f56c This takes a provider now 2020-02-27 03:25:08 +00:00
christos 53702d90ff one more level down 2020-02-27 02:56:46 +00:00
mrg 046701c57b probably fix previous: it wants mod.mk's PARSEDIR/.., not ../..,
so it picks up the libpam/Makefile.inc.
2020-02-27 00:02:56 +00:00
christos 65b3e3c5b8 Handle pam modules that are not in this subtree. 2020-02-26 19:33:30 +00:00
rin 4ecd76e535 0x%p --> %p for non-external codes. 2020-02-24 12:20:29 +00:00
ad f340434d23 +EINVAL 2020-02-23 20:41:41 +00:00
ad d2a0ebb67a UVM locking changes, proposed on tech-kern:
- Change the lock on uvm_object, vm_amap and vm_anon to be a RW lock.
- Break v_interlock and vmobjlock apart.  v_interlock remains a mutex.
- Do partial PV list locking in the x86 pmap.  Others to follow later.
2020-02-23 15:46:38 +00:00
kamil 21056e8a10 Change the previous cast from unsigned int to unsigned long
This code produces the same result and is consistent with the previous
lines. Only the least significant 16 bites (unsigned short) are meaningful.
2020-02-23 09:53:42 +00:00
kamil 6f201b686b Avoid undefined behavior in fread(3)
On the first call to fread(3), just after fopen(3) the internal buffers
are empty. This means that _r and _p (among others) are zeroed.

Passing NULL to the 2nd argument of memcpy(3) for the zero length is
undefined. Calling _p += 0 triggers LLVM UBSan (NULL pointer arithmetic).
Calling _p += 0, p += 0 and resid -= 0 has no effect.

Replace the "fp->_r = 0;" logic with a short circuit jump to __srefill()
that sets _r internally and refills the FILE buffers.

No functional change from an end user point of view, except skipping a few
dummy operations on the first call, for a FILE pointer, to fread(3).
2020-02-22 22:02:46 +00:00
kamil 6aee95b41f Avoid undefined behavior in the rand48(3) implementation
Instead of implicid promotion to signed int,
explicitly cast the arguments to unsigned int.

_rand48.c:53:27, signed integer overflow:
58989 * 58970 cannot be represented in type 'int'

_rand48.c:53:38, signed integer overflow:
-2093025904 + -1496809120 cannot be represented in type 'int'

_rand48.c:53:57, signed integer overflow:
57068 * 42787 cannot be represented in type 'int'

New and old code produce the same code as tested with:

#include <stdio.h>
#include <stdlib.h>

#define COUNT 1000 * 1000

int
main(void)
{
	FILE *fp;
        int i;

        fp = fopen("numbers.txt", "w+");
	if (!fp)
		abort();

        for(i = 0; i < COUNT; i++) {
                fprintf(fp, "%f\n", drand48());
                fprintf(fp, "%ld\n", lrand48());
                fprintf(fp, "%ld\n", mrand48());
        }

        fclose(fp);

        return 0;
}
2020-02-22 14:07:57 +00:00
pgoyette 79e45209ec Remove vestigial remnant of an earlier modification to the module
implementation.  There currently is no such thing as a module's
"alias".
2020-02-22 14:06:05 +00:00
kamil 57225a2ce5 Reorder words to fix grammar
Noted by <leot>
2020-02-22 13:20:21 +00:00
kamil 756b86e872 rand48: Document that short integers are unsigned 2020-02-22 11:56:13 +00:00
kamil 2bddf73745 Improve readability of __dorand48()
Break long lines into shorter instructions per line.

No Functional Change.
2020-02-22 11:24:47 +00:00
kamil 6ab39b6716 Avoid undefined behavior in left shift
crypt.c:772:11, left shift of 1363235140 by 1 places cannot be represented
in type 'int32_t' (aka 'int')
2020-02-22 10:29:17 +00:00
kamil 96be1c9965 Avoid undefined behavior in bit shift operations
crypt.c:839:40, left shift of negative value -1197182952
crypt.c:840:40, left shift of negative value -264997776
2020-02-22 10:22:32 +00:00
kamil e1278de2f9 Avoid NULL pointer arithmetics on environ
_env.c:260:9, pointer expression with base 0 overflowed to 0
_env.c:260:9, load of null pointer of type 'char *'
2020-02-22 10:05:12 +00:00
kamil 35ea0de335 Avoid unportable left shift construct
left shift of 9 by 28 places cannot be represented in type 'int'
2020-02-22 00:38:14 +00:00
kamil ca9a018f12 Avoid undefined behavior in *BIT macros
hash_page.c:792:2, left shift of 1 by 31 places cannot be represented in type 'int'
hash_page.c:855:2, left shift of 1 by 31 places cannot be represented in type 'int'
hash_page.c:779:3, left shift of 1 by 31 places cannot be represented in type 'int'
2020-02-21 22:04:06 +00:00
riastradh f638f19cd2 Fix kassert in lfs by initializing vp first. 2020-02-20 15:48:52 +00:00
rin e3331ab957 libpthread sets initial value of MSR for lwp's. However, appropriate
value differs b/w oea/booke/ibm4xx, and there's no way to obtain it
from userland. Therefore, this initial value should be corrected by
cpu_setmcontext().

- Comment this in libpthread
- Add KASSERT in cpu_mcontext_validate()
2020-02-20 07:07:02 +00:00
kamil 331480e6b2 Revert "Enhance the pthread(3) + malloc(3) init model"
It is reported to hand on aarch64 with gzip.
2020-02-16 17:45:11 +00:00
kamil bcfb2645e2 Set __isthreaded before bootstrapping malloc(3)
jemalloc depends on the __isthreaded dynamic state logic.

Reported by <wiz> for mpv and by <tih> for gzip.
2020-02-16 17:14:31 +00:00
kamil 5fa609827b Enhance the pthread(3) + malloc(3) init model
Separate the pthread_atfork(3) call from pthread_tsd_init()
and move it into a distinct function.

Call inside pthread__init() late TSD initialization route, just after
"pthread_atfork(NULL, NULL, pthread__fork_callback);".

Document that malloc(3) initialization is now controlled again and called
during the first pthread_atfork(3) call.

Remove #if 0 code from pthread_mutex.c as we no longer initialize malloc
prematurely.
2020-02-15 23:59:30 +00:00
riastradh 57d4369975 Let's not write temporary files to fixed paths in /tmp, shall we?
XXX pullup
2020-02-15 22:55:22 +00:00
kamil 418e457ef1 Change types of DUP2ALIAS and DUP2FDMASK bit masks to unsigned
This is for consistency with the DUP2BIT change.
2020-02-10 23:21:42 +00:00
kamil a6c4eb28f3 Avoid unportable bit shift semantics
hijack.c:451:52, left shift of 1 by 31 places cannot be represented in type 'int
2020-02-10 09:10:58 +00:00
maxv 1273dfb58e Reference nvmmctl(8). 2020-02-09 12:19:01 +00:00
kamil f66ccdf057 Change the behavior of pthread_equal()
On error when not aborting, do not return EINVAL as it has a side effect
of being interpreted as matching threads. For invalid threads return
unmatched.

Check pthreads for NULL, before accessing pt_magic field. This avoids
faults on comparision with a NULL pointer.

This behavior is in the scope of UB, but should be easier to deal with
buggy software.
2020-02-08 17:06:03 +00:00
christos e404e1832c there is no potential overflow anymore (thanks Kamil) 2020-02-07 23:28:59 +00:00
christos 73c6a60ccf stop using sprintf and check for buffer overflow. 2020-02-07 22:13:35 +00:00
ryoon 2da2192d78 Remove trailing whiteapaces and tab 2020-02-05 14:56:04 +00:00
kamil 91719d9fbd Retire ifdef ERRORCHECK in pthread(3)
It is enabled unconditionally since 2003 and used only for rwlocks and
spinlocks.

LLVM sanitizers make assumptions that these checks are enabled always.
2020-02-05 11:05:10 +00:00
wiz d210ba75a0 Remove trailing whitespace. 2020-02-05 08:14:36 +00:00
christos 8d83da913d Mention that we don't honor the other mode bits. 2020-02-04 18:36:16 +00:00
kamil 31ebab1943 Revert previous
'git grep' breaks now.
2020-02-01 18:14:16 +00:00
kamil f93ad70739 Remove 'ifdef 0' hacks
It is no longer needed as the proper fix avoiding premature malloc()
landed the sources.
2020-02-01 15:39:56 +00:00
kamil 089c97bd22 Switch atform allocations from malloc()+free() to mmap()+munmap()
This avoid bootstrapping malloc too early when libc+libpthread are not
ready. It is called through pthread__init() -> _pthread_atfork().

This also helps LLVM Leak Sanitizer to pacify false positive reports.
2020-02-01 15:38:46 +00:00
kamil 260b3a1721 Refactor libpthread checks for invalid arguments
Switch from manual functions to pthread__error().
2020-01-31 17:52:14 +00:00
christos bbb79fe856 In the same spirit as the previous pthread_mutex_init change for jemalloc,
make pthread_mutexattr_init do always a full initialization, so that the
attribute that will be used later when we become threaded is properly
initialized.
2020-01-31 02:37:46 +00:00
joerg 782b126d2c Provide frexpl on non-long-double systems as alias to frexp. 2020-01-30 20:31:50 +00:00
kamil 12ee584ac8 Use pthread_mutexattr_t and pthread_mutex_t magic fields
Validate _PT_MUTEX_MAGIC in pthread_mutex_t and _PT_MUTEXATTR_MAGIC
in pthread_mutexattr_t accordingly.
2020-01-29 21:11:24 +00:00
ad fb0af629d1 - pthread_join(): remove temporary hack now kernel returns correct errno.
- kill(getpid(), SIGABRT)  ->  _lwp_kill(_lwp_self(), SIGABRT)
2020-01-29 17:11:57 +00:00
kamil 08c17fb31c Check thread->pt_magic with PT_MAGIC promptly 2020-01-29 16:34:09 +00:00
kamil 20668e1417 Chack thread->pt_magic with PT_MAGIC promptly
Rearrange some checks to avoid verifying pthread_t after using it.
2020-01-29 16:03:44 +00:00
kamil ac02e87024 Revert previous
Two assignments are correct.
2020-01-29 15:31:14 +00:00
kamil 0b0b4cd405 Do not set stackbase2 twice for !__MACHINE_STACK_GROWS_UP 2020-01-29 15:15:00 +00:00
kamil e06a99c91d Use pthread_condattr_t and pthread_cond_t magic fields
Validate _PT_CONDATTR_MAGIC and _PT_COND_MAGIC respectively.
2020-01-29 15:07:46 +00:00
kamil 7f6f4173b3 Use pthread_barrierattr_t and pthread_barrier_t magic fields
Set respectively _PT_BARRIER_DEAD for pthread_barrier_destroy() and
_PT_BARRIERATTR_DEAD for pthread_barrierattr_destroy().

Validate _PT_BARRIER_MAGIC in pthread_barrier_t and _PT_BARRIERATTR_MAGIC
in pthread_barrierattr_t accordingly.
2020-01-29 14:41:57 +00:00
kamil b3401c13c3 Use the pta_magic field in pthread attribute
Set PT_ATTR_DEAD on pthread_attr_destroy().
Check pta_magic before using pthread_attr_t in a bunch of other functions.
2020-01-29 13:47:31 +00:00
kamil d48cac510b Mark destroyed pthread_mutexattr_t as dead 2020-01-29 10:55:23 +00:00
ad c6559e920a - A bit more alignment in __pthread_st especially for the rbtree node.
- Use COHERENCY_UNIT from sys/param.h.
2020-01-28 13:08:40 +00:00
ad a15e545ef6 pthread_join(): add a temporary hack to make lib/libpthread/t_detach pass.
The correct fix is to do this in kernel (I have that change, but it's part
of the wider change to index LWPs in a tree).
2020-01-28 09:23:15 +00:00
ad 60f1ad4e64 Make x86 use the C versions of bcmp() and memcmp(). 2020-01-27 22:08:08 +00:00
ad cd1754ab41 pthread_detach(), pthread_join(): go back to using _lwp_detach() and
_lwp_wait(), rather than doing it all in userspace.  There's less to go
wrong.  Doesn't seem to be a performance penalty.
2020-01-27 20:50:05 +00:00
ad e354694931 Adjustment to previous: don't call _lwp_unpark_all() with nwaiters == 0. 2020-01-25 18:30:41 +00:00
ad 047ca71b68 pthread_exit(): it looks there there is at least one path through which
a thread can exit with waiters still hanging off it (cancellation when
waiting on a condvar) so deal with all/any crappy failure like that and
make sure there are never any waiters left before exiting.  Maybe of help
for:

PR: bin/50350: rump/rumpkern/t_sp/stress_{long,short} fail on Core 2
2020-01-25 18:01:28 +00:00
ad 769155beb0 pthread__mutex_unlock_slow(): ignore the DEFERRED bit. It's only purpose
is to get the thread to go through the slow path.  If there are waiters,
process them there and then.  Should not affect well behaved apps.  Maybe
of help for:

PR bin/50350: rump/rumpkern/t_sp/stress_{long,short} fail on Core 2 Quad
2020-01-25 17:58:28 +00:00
ad edf01486dd - Fix a race between the kernel and libpthread, where a new thread can start
life without its self->pt_lid being filled in.

- Fix an error path in _lwp_create().  If the new LID can't be copied out,
  then get rid of the new LWP (i.e. either succeed or fail, not both).

- Mark l_dopreempt and l_nopreempt volatile in struct lwp.
2020-01-25 15:41:52 +00:00
pgoyette fccfbe317e Fix name of keyword so it will worwk correctly. :) 2020-01-23 16:34:12 +00:00
mgorny ac78ffd6ff Fix using gcc's unwind.h 2020-01-22 16:07:40 +00:00
mgorny 26a48dd100 Install gcc's unwind.h instead of libexecinfo's
The prototypes in libexecinfo's unwind.h do not match those commonly
used (e.g. by gcc, clang, GNU libunwind, LLVM libunwind...), causing
C++ programs to fail to build on type mismatches (e.g. compiler-rt,
libc++abi).  Rather than providing our own header, reuse the one
included in gcc.
2020-01-22 15:10:31 +00:00
kamil e4e4859de1 Adjust the error return value of pthread_sigmask for !libpthread usage
Instead of returning -1, return errno on error.

Catch up after the fix in libpthread by Andrew Doran in 2008
in lib/libpthread/pthread_misc.c r.1.9.

It's an open question whether this function shall be used without linked
in the POSIX thread library.

Detected by Bruno Haible (GNU) and documented in gnulib in commit
"pthread_sigmask: Avoid test failure on NetBSD 8.0. " r. 4d16a83b0c1fcb6c.
2020-01-14 18:18:59 +00:00
joerg 174eb28ace Fix atfork malloc handling to include all the locks in old jemalloc. 2020-01-13 19:14:37 +00:00
joerg 2de10fd665 Fix aarch64 definition in old jemalloc
There is no platform-specific reason for avoiding TLS. The tiny
allocations should be aligned the same as small allocations for ABI
reasons.
2020-01-13 19:14:02 +00:00
ad 510021886a Rip out some very ambitious optimisations around pthread_mutex that are
don't buy much.  This stuff is hard enough to get right in the kernel let
alone userspace, and I don't trust that it's right.
2020-01-13 18:22:56 +00:00
abhinav 2d114b3c14 PR lib/54510 - when user supplied completion function is there,
don't unescape the string to be completed.
2020-01-05 07:12:05 +00:00
tih 52de8937af Summary: Remove over-simplified extraneous test
The file name matching code in libedit tries to adjust to the presence
of explicit " or ' characters in the input line, but tries too hard.
Remove a conditional that goes overboard, and causes the completion
code to fail if a quoted string is seen before the filename to be
expanded, as in

	  grep 'foo' bar<TAB>

Before this change, the above would not expand any possible
completions, even if they existed, because it would choose to look for
files whose names started with " bar".
2020-01-05 00:03:27 +00:00
kamil 4677d24ff4 Document PT_LWPSTATUS and PT_LWPNEXT in ptrace(2)
Remove mentions of obsolete PT_LWPINFO.
2020-01-04 04:40:17 +00:00
msaitoh 417c7af79c s/conjuction/conjunction/ 2019-12-27 10:13:59 +00:00
msaitoh ba5c90c4a4 s/sucess/success/ in comment. 2019-12-27 09:45:26 +00:00
msaitoh a0403cde04 s/transfered/transferred/ 2019-12-27 09:41:48 +00:00
msaitoh a5effc3ce9 s/inital/initial/ 2019-12-27 09:25:57 +00:00
msaitoh 40064e2457 s/lenght/length/ 2019-12-26 04:53:11 +00:00
joerg 8e5b2c30bd Since pthread_setspecific requires locks, ensure that they are acquired
before fork and dropped in both parent and child. At least Python
depends on TSD after fork, even though it is undefined behavior in
POSIX.
2019-12-25 00:44:45 +00:00
reed 030d4fb522 Simply Subsection headers
There was a formatting issue with mandoc showing the
literal "Ss" macros. I reported this bug to mandoc since groff
didn't have same formatting. It was recommended to simplify
the formatting due to the weird feature.
Note because of this for groff I didn't use the Ux macro but spelled
out UNIX literally for these subsection headers
(since the macro reset the subsection formatting which was why
the Ss macro was repeated before to reactivate it).
2019-12-23 17:51:57 +00:00
kamil cd653c6e17 Explain in kevent(2) the semantics of EINTR
All changes contained in the changelist are applied before returning this
error.
2019-12-23 01:46:09 +00:00
kamil e6ecafaf7d Document udata type switch in struct kevent in the kqueue(2) 2019-12-22 17:01:15 +00:00
leot 4bf7b66e0f tcgetsid() is defined in <termios.h>, not <sys/types.h> or <unistd.h>. 2019-12-19 16:12:21 +00:00
joerg 7ed25834ce Bump PTHREAD__UNPARK_MAX to 128 as bandaid for locking related hangs. 2019-12-18 15:11:57 +00:00
christos 8282cab4e4 move file/lib after xz 2019-12-18 02:46:21 +00:00
uwe df1f230d9f pthread__rwlock_spin - clarify the test.
It's more pedantically correct to check RW_WRITE_LOCKED before
obtaining the thread id of the owner.  And since there must be an
owner annotate the guard NULL check as unlinkely.

No functional change intended.  Ok ad@.
2019-12-16 22:22:11 +00:00
uwe ba77a23d10 G/c unused rwlock owner macros copy-pasted from the kernel.
They were brought along with the rwlock flags but never used and never
even adapted to the new home (the struct member name is different
here).  I looked at adapting and using them, but they don't really
help readability that much and there are cases where we need to deal
with "fused" owner values anyway and so can't use them.
2019-12-16 20:45:40 +00:00