d753779f | 09-Jun-2022 |
Matthew Dillon <dillon@apollo.backplane.com> |
libc - Fix bug in recent malloc_usable_size() support
* Add missing unlock in the bigalloc check path
* Fixes miniruby deadlock and other threaded uses of malloc_usable_size() on large memory blo
libc - Fix bug in recent malloc_usable_size() support
* Add missing unlock in the bigalloc check path
* Fixes miniruby deadlock and other threaded uses of malloc_usable_size() on large memory blocks.
show more ...
|
c936cb6f | 19-May-2022 |
Matthew Dillon <dillon@apollo.backplane.com> |
kernel - Implement mlockall() properly
* Implement mlockall()'s MCL_CURRENT, and generalaly reimplement mlockall() using linux-like expectations. This generally means that the system will do a
kernel - Implement mlockall() properly
* Implement mlockall()'s MCL_CURRENT, and generalaly reimplement mlockall() using linux-like expectations. This generally means that the system will do a best-effort to allocate and lock the memory associated with the process's address space.
* Prior semantics which disallowed protection changes on locked memory have been removed. Modern applications assume that protection changes will work on locked memory, even if it would force a fault.
* As with linux, some license is taken and mlockall() will only force fault any copy-on-write flagged anonymous pages at the time of the call. It will not force a copy-on-write operation on unmodified file-backed pages that have been mapped MAP_PRIVATE, but not yet modified (still represent the file's actual content). Nor will it force-fault the parent process's pages when the parent issues a fork() (which forces all anonymous pages in both the parent and child to become copy-on-write).
Such pages can still take a write-fault and be COWd. The resulting newly allocated page will be wired as expected.
Submitted-by: tuxillo Testing-by: tuxillo, dillon
show more ...
|
56e344b8 | 03-May-2022 |
Sascha Wildner <saw@online.de> |
libc/stdtime: Set errno to EOVERFLOW when there is an overflow.
This fixes various issues such as gmtime() returning NULL on an out-of-bounds time_t but not setting errno, as POSIX requires.
Also,
libc/stdtime: Set errno to EOVERFLOW when there is an overflow.
This fixes various issues such as gmtime() returning NULL on an out-of-bounds time_t but not setting errno, as POSIX requires.
Also, in ctime() and ctime_r(), check the result of localtime() before passing it to asctime{,_r}().
See: https://github.com/eggert/tz/commit/4d306b3a17ce5ce0b33a73a90dc713d3601ea89a
show more ...
|
3bf574a9 | 30-Apr-2022 |
Aaron LI <aly@aaronly.me> |
libc/net: Fix b64_pton() for some exact-sized buffer
When decoding a base64 string with padding, b64_pton() can fail when the output buffer is exactly the needed size. For example, decoding the fol
libc/net: Fix b64_pton() for some exact-sized buffer
When decoding a base64 string with padding, b64_pton() can fail when the output buffer is exactly the needed size. For example, decoding the following base64 string to buffer[32] would fail:
% dd if=/dev/random bs=32 count=1 | base64 FCiWkKuhdRq3tMmtAt9CpchTTYMlIW3U3gJsavDNxZI=
This commit fixes the above issue.
Reported-by: dczheng Obtained-from: OpenBSD See also: FreeBSD revision 275060, https://reviews.freebsd.org/D1218
show more ...
|
bd5862e7 | 20-Apr-2022 |
Matthew Dillon <dillon@apollo.backplane.com> |
libc - Protect dbm_*() API with a mutex
* The dbm_*() API is not thread-safe. Generally speaking, libc is expected to be thread-safe these days.
* Protect the dbm_*() API with a mutex in the DB
libc - Protect dbm_*() API with a mutex
* The dbm_*() API is not thread-safe. Generally speaking, libc is expected to be thread-safe these days.
* Protect the dbm_*() API with a mutex in the DB (aka DBM) structure. We use available pthread_mutex_*() stubs for the locking, so they are basically NOPs for applications not linked against pthreads.
* Also protect dbm_delete() and dbm_store() with our new sigblockall() / sigunblockall() mechanism to prevent corruption due to ^C and other regular signals. This mechanism implements a simple kernel/user shared-memory counter and flag, and imposes no additional system calls in DBM's critical paths.
show more ...
|
839f7d62 | 21-Mar-2022 |
Sascha Wildner <saw@online.de> |
printf(3)/scanf(3): Make ll and L length modifiers equivalent.
POSIX defines L only for floating point numbers (long double) and ll only for integer numbers (long long), leaving for example %Ld or %
printf(3)/scanf(3): Make ll and L length modifiers equivalent.
POSIX defines L only for floating point numbers (long double) and ll only for integer numbers (long long), leaving for example %Ld or %llg undefined. GCC allows these non-portable combinations as an extension, i.e. -Wformat will not warn about them unless -pedantic is passed.
To avoid surprises with Linux code, go with glibc and make ll and L equivalent. For base code, we still prefer going with the standard, of course.
Interestingly, the alternate printf(3) implementation in libc (enabled by defining USE_XPRINTF in the environment) already treats them equally.
In-discussion-with: zrj
show more ...
|
cd85487e | 19-Feb-2022 |
Aaron LI <aly@aaronly.me> |
getopt.3: Clarify option string syntax
The recently added 'option::' syntax requires the following argument (if present) *must* be in the same word as the option name itself (e.g., "-x<arg>"). This
getopt.3: Clarify option string syntax
The recently added 'option::' syntax requires the following argument (if present) *must* be in the same word as the option name itself (e.g., "-x<arg>"). This is different than the normal 'option:' syntax, for which the argument may have a leading white space (e.g., "-x <arg>"). Update the man page to explicitly describe the syntax.
Update to use a list to describe the 3 types of option string syntaxes with examples.
show more ...
|