summaryrefslogtreecommitdiff
path: root/src/lib/libc (follow)
Commit message (Collapse)AuthorAgeFilesLines
...
* spelling fixes; from paul tagliamontejmc2022-12-278-15/+15
| | | | | any changes not taken noted on tech, but chiefly here i did not take the cancelation - cancellation changes;
* tolower(3) guarantees to return its argument unchanged if it's notflorian2022-11-161-10/+3
| | | | | | | uppercase. While here use the correct idiom of casting to unsigned char. OK millert, farewell to ultrix deraadt
* In __cxa_atexit(), there is no need to initialize local pointer beforederaadt2022-10-221-2/+2
| | | | | the lock, when it is correctly initialized after the lock ok otto millert
* put the malloc_readonly struct into the "openbsd.mutable" section, soderaadt2022-10-141-2/+3
| | | | | that the kernel and ld.so will know not to mark it immutable. malloc handles the read/write transitions by itself.
* use Fn rather than Nm for swab(); from josiah frentsosjmc2022-09-281-6/+6
|
* .Li -> .Vt where appropriate;jmc2022-09-1124-106/+103
| | | | | | from josiah frentsos, tweaked by schwarze ok schwarze
* remove unused blowfish inline definesjsg2022-08-281-8/+1
| | | | inline use was removed in 1998
* For putenv(3), return an error if string starts with a '=' character.millert2022-08-082-5/+10
| | | | Both FreeBSD and NetBSD have this behavior. OK deraadt@
* change some 4.4BSD references to earlier releasesjsg2022-08-042-6/+6
| | | | ok schwarze@
* libc string functions were not ported from pwb to v7jsg2022-08-013-15/+9
| | | | | | https://minnie.tuhs.org/pipermail/tuhs/2017-August/011807.html ok schwarze@
* strlen was in v6 libc (s5/perror.c) but not documented till v7jsg2022-07-311-5/+4
| | | | ok schwarze@
* fix indenttb2022-07-311-2/+2
|
* Randomise the rekey interval a little. Previously, the chacha20djm2022-07-311-2/+8
| | | | | | | instance would be rekeyed every 1.6MB. This makes it happen at a random point somewhere in the 1-2MB range. Feedback deraadt@ visa@, ok tb@ visa@
* If a command or interface first appeared in PWB/UNIX, UNIX System III orjsg2022-07-252-6/+10
| | | | | | | | | | | | UNIX System V mention it. Only do so in manual pages with a pre-existing HISTORY section. Prompted by the comparison of System V and BSD commands and interfaces in Sun's "System V Enhancements Overview" document. checked against manuals on bitsavers, TUHS archive and CSRG archive CDs ok jmc@ schwarze@
* To figure our whether a large allocation can be grown into theguenther2022-06-301-12/+2
| | | | | | | | | | | following page(s) we've been first mquery()ing for it, mmapp()ing w/o MAP_FIXED if available, and then munmap()ing if there was a race. Instead, just try it directly with mmap(MAP_FIXED | __MAP_NOREPLACE) tested in snaps for weeks ok deraadt@
* system(3) should ignore SIGINT and SIGQUIT until the shell exits.millert2022-05-211-4/+17
| | | | | | | This got broken when system.c was converted from signal(3) to sigaction(2). Also add SIGINT and SIGQUIT to the set of blocked signals and unblock them in the parent after the signal handlers are installed. Based on a diff from Leon Fischer. OK deraadt@
* Fix typo in last commit.millert2022-04-131-2/+2
|
* inet_net_pton_ipv6: avoid signed vs unsigned comparisonmillert2022-04-131-3/+5
| | | | | | | Use a temporary variable to store the number of bytes to be copied (size_t) and also use it as the memcpy(3) length. Previously we copied "size" bytes instead of just the necessary number. OK claudio@ tb@
* man pages: add missing commas between subordinate and main clausesnaddy2022-03-316-24/+24
| | | | | | | jmc@ dislikes a comma before "then" in a conditional, so leave those untouched. ok jmc@
* man pages: add missing word, The foo() ... -> The foo() function ...naddy2022-03-294-12/+12
| | | | ok jmc@ schwarze@
* Remove unused ivbits argument from chacha_keysetup to match otherdtucker2022-02-282-4/+4
| | | | instances in the tree. ok deraadt@
* Currently malloc caches a number of free'ed regions up to 128kotto2022-02-261-33/+160
| | | | | | | | | | in size. This cache is indexed by size (in # of pages), so it is very quick to check. Some programs allocate and deallocate larger allocations in a frantic way. Accomodate those programs by also keeping a cache of regions between 128k and 2M, in a cache of variable sized regions. Tested by many in snaps; ok deraadt@
* remove please from manual pagesjsg2022-02-061-3/+3
| | | | ok jmc@ sthen@ millert@
* refer to longindex as an argument, not a field;jmc2022-01-061-3/+3
| | | | | | from uwe@netbsd -r1.22 ok millert
* Update to reflect changes over the last six yearsguenther2021-12-251-34/+47
|
* lsearch(3): reimplement using lfind(3)cheloha2021-12-081-32/+13
| | | | | | | | | | | | | | | | | | | | | | | | lsearch(3) is really just lfind(3) with an additional branch to append the key if lfind(3) fails. If we get rid of the underlying linear_base() function and move the search portion into lfind(3) and the key-copying portion into lsearch(3) we get smaller and simpler code. Misc. notes: - We do not need to keep the historical comment about errno. lsearch(3) is pure computation and does not set errno. That's really all you need to know. The specification reserves no errors, either. - We are using lfind(3) internally now, so it switches from PROTO_DEPRECATED to PROTO_NORMAL in hidden/search.h and needs DEF_WEAK in stdlib/lsearch.c. With advice from guenther@ on symbol housekeeping in libc. Thread: https://marc.info/?l=openbsd-tech&m=163885187632449&w=2 ok millert@
* lsearch(3): append key to array with memmove(3) instead of memcpy(3)cheloha2021-12-071-2/+7
| | | | | | | | | | | | | | | If the key overlaps the end of the array, memcpy(3) mutates the key and copies a corrupted value into the end of the array. If we use memmove(3) instead we at least end up with a clean copy of the key at the end of the array. This is closer to the intended behavior. With input from millert@ and deraadt@. Thread: https://marc.info/?l=openbsd-tech&m=163880307403606&w=2 ok millert@
* bsearch(3): support arrays with more than INT_MAX elementscheloha2021-12-021-2/+3
| | | | | | | | | | | | | | | The "lim" variable needs to be a size_t to match nmemb, otherwise we get undefined behavior when nmemb exceeds INT_MAX. Prompted by a blog post by Joshua Bloch: https://ai.googleblog.com/2006/06/extra-extra-read-all-about-it-nearly.html Fixed by Chris Torek a long time ago: https://svnweb.freebsd.org/csrg/lib/libc/stdlib/bsearch.c?revision=51742&view=markup ok millert@
* A few sys/param.h annotations lacked ALIGNBYTESderaadt2021-11-291-2/+2
|
* Niels agreed to remove the advertising clause; switching thesedjm2021-11-292-11/+5
| | | | to 3-term BSD license.
* Describe what RES_USE_DNSSEC does and how it's affected by trust-adjca2021-11-241-2/+15
| | | | ok florian@
* Implement rfc6840 (AD flag processing) if using trusted name serversjca2021-11-221-2/+14
| | | | | | | | | | | | | | | | | | | | | | | | | libc can't do DNSSEC validation but it can ask a "security-aware" resolver to do so. Let's send queries with the AD flag set when appropriate, and let applications look at the AD flag in responses in a safe way, ie clear the AD flag if the resolvers aren't trusted. By default we only trust resolvers if resolv.conf(5) only lists name servers on localhost - the obvious candidates being unwind(8) and unbound(8). For non-localhost resolvers, an admin who trusts *all the name servers* listed in resolv.conf(5) *and the network path leading to them* can annotate this with "options trust-ad". AD flag processing gives ssh -o VerifyHostkeyDNS=Yes a chance to fetch SSHFP records in a secure manner, and tightens the situation for other applications, eg those using RES_USE_DNSSEC for DANE. It should be noted that postfix currently assumes trusted name servers by default and forces RES_TRUSTAD if available. RES_TRUSTAD and "options trust-ad" were first introduced in glibc by Florian Weimer. Florian Obser (florian@) contributed various improvements, fixed a bug and added automatic trust for name servers on localhost. ok florian@ phessler@
* add missing .h file includederaadt2021-10-291-2/+3
| | | | from Emil Engler
* Revert accidental change.jca2021-10-251-1/+2
| | | | Dunno why this ended up here, cvs is always full of surprises.
* Make brk() and sbrk() weak again as intended.jca2021-10-251-2/+1
| | | | | | Apparently spotted by mortimer@ while working on clang 13 and amd64. No actual change on sparc64 as this architecture still uses ld.bfd. ok kettenis@
* For open/openat, if the flags parameter does not contain O_CREAT, thederaadt2021-10-242-6/+6
| | | | | | | | | | | | | 3rd (variadic) mode_t parameter is irrelevant. Many developers in the past have passed mode_t (0, 044, 0644, or such), which might lead future people to copy this broken idiom, and perhaps even believe this parameter has some meaning or implication or application. Delete them all. This comes out of a conversation where tb@ noticed that a strange (but intentional) pledge behaviour is to always knock-out high-bits from mode_t on a number of system calls as a safety factor, and his bewilderment that this appeared to be happening against valid modes (at least visually), but no sorry, they are all irrelevant junk. They could all be 0xdeafbeef. ok millert
* ansijsg2021-10-242-13/+6
| | | | ok mpi@ deraadt@
* Put back sys/types.h and sys/socket.h. The latter was unintentionallytb2021-10-221-1/+3
| | | | removed and the former is still needed, as pointed out by kettenis
* Fix some ghastly whitespace. From Martin Vahlensiecktb2021-10-221-6/+6
|
* Use unsigned char instead of u_char in base64.c. This is a mildtb2021-10-221-9/+6
| | | | | | | | | portability annoyance since not all systems have u_char. Remove the now unused includes sys/types.h and stdio.h. u_char diff from Jonas Termansen ok deraadt
* Provide realpath(1)kn2021-10-131-2/+3
| | | | | | | A tiny realpath(3) wrapper to make a porter's life easier. Feedback kettenis deraadt cheloha sthen OK cheloha martijn deraadt
* does not need arpa/nameser.hderaadt2021-10-111-2/+1
|
* Switch two calls from memset() to explicit_bzero()tb2021-09-191-3/+3
| | | | | | | This matches the documented behavior more obviously and ensures that these aren't optimized away, although this is unlikely. Discussed with deraadt and otto
* * add the missing STANDARDS section as noticed by tb@schwarze2021-09-031-3/+20
| | | | | | * mention that the *optionp input string will be modified * clarify that the array of tokens is expected to be NULL-terminated OK millert@ tb@, and the first half of STANDARDS also OK jmc@
* inet_ntop(3) needs sys/socket.h for AF_INET / AF_INET6 so add the headerclaudio2021-09-012-6/+5
| | | | | to the list. While here remove some of the headers from inet_net_ntop(3) for balance.
* Make MALLOC_STATS compile again; noted by Omar Polo and Joe Nelsonotto2021-07-231-2/+2
|
* An extra internal consistency check and a missing stats adjustment. ok tb@otto2021-04-091-1/+4
|
* Cache implementation has changed, we do not hold on to an exact numberotto2021-04-091-3/+4
| | | | of pages anymore, but also cache larger regions; ok tb@
* Type-cast getpagesize() from int to size_t for the comparison with d.claudio2021-03-181-2/+2
| | | | | | | getpagesize() will only return positive numbers (there is no negative page size system) and it can not fail. Should fix some compiler warnings seen in -portable projects. OK otto@
* Change the implementation of the malloc cache to keep lists ofotto2021-03-091-152/+118
| | | | | regions of a given size. In snaps for a while, committing since no issues were reported and a wider audience is good. ok deraadt@