summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* MFC r323597:kib2017-09-212-6/+16
| | | | Handle freeaddrinfo(NULL).
* MFC r322925:pfg2017-09-133-51/+47
| | | | | | | | | | libc: minor indent(1) cleanups. Illumos and Schillix are adopting some of the locale code and our style(9) sometimes matches the Solaris cstyle, so the changes are also useful as a way to reduce diffs. No functional change.
* MFC 322763:kib2017-09-137-1/+157
| | | | | Optimize libc to get and set TLS using the RDFSBASE and RDGSBASE instructions, if supported both by CPU and kernel.
* MFC r320255asomers2017-08-281-26/+11
| | | | | | | | | | (note that part of 320255 was erroneously MFCed by 322889) Clarify usage of aio(4) with kqueue(2) Reviewed by: jhb MFC after: 3 weeks Differential Revision: https://reviews.freebsd.org/D11299
* MFC r320737, r320914asomers2017-08-251-0/+1
| | | | | | | | | | | | | | | | | | | | | | | | r320737: Fix cleanup in lib/libc/gen/setdomainname_test ATF cleanup routines run in separate processes from the tests themselves, so they can't share global variables. Also, setdomainname_test needs to be is_exclusive because the test cases access a global resource. PR: 219967 Reviewed by: ngie Sponsored by: Spectra Logic Corp Differential Revision: https://reviews.freebsd.org/D11188 r320914: Remove an extraneous strlen from t_setdomainname.c Reported by: Coverity CID: 1377568 X-MFC-With: 320737 Sponsored by: Spectra Logic Corp
* MFC r322427:kib2017-08-193-8/+22
| | | | Improve standard compliance for memset_s() and abort_handler_s().
* MFC r322456:kib2017-08-151-2/+2
| | | | | On i386 with CPUID but without SSE2, set lfence_works to LMB_NONE instead of looping.
* MFC r322426:kib2017-08-151-1/+1
| | | | Fix indent.
* MFC r322368, r322371:pfg2017-08-152-2/+3
| | | | | | | | | | | | | | fnmatch(3): improve POSIX conformance. In a recent interpretation[1], "\\" shall return a non-zero value (indicating either no match or an error). The fix involves a change over r254091 and now the behavior matches the Sun/IBM/HP closed source implementations and also likely musl libc. Submitted by: Joerg Schilling <joerg at schily.net> [1] http://austingroupbugs.net/view.php?id=806
* MFC r321608:kib2017-08-101-38/+89
| | | | Use MFENCE to serialize RDTSC on non-Intel CPUs.
* MFC r321652:kib2017-08-041-12/+11
| | | | Simplify flow control.
* MFC r314319 (by oshogbo):kib2017-07-281-10/+25
| | | | | | | | | | | | Don't try to open devices in the gettc() function which will always fail in the Capability mode. Instead silently fallback to the syscall method, which is done for example in the gettimeofday(2) function. MFC r314320 (by oshogbo): Remove unneeded variable initialization from r314319. MFC r321461: Fix indent.
* MFC r319875:kib2017-07-211-1/+21
| | | | | Add ptrace(PT_GET_SC_ARGS) command to return debuggee' current syscall arguments.
* MFC note: content changes of r317315 were reversed. .Dd is being updatedngie2017-07-191-1/+1
| | | | | | | | | | | | | | for diff reduction purposes. MFC r317315,r317437: r317315: Note that getpagesize(3) can return -1 on failure r317437 (by kib): getpagesize(3) cannot fail.
* MFC r320895:markj2017-07-181-6/+3
| | | | Don't dlclose NSS modules from nss_atexit().
* MFC r318706:ngie2017-07-181-1/+2
| | | | localeconv(3): start sentences on new lines
* MFC r318712:ngie2017-07-181-1/+1
| | | | | | xdr(3): add missing comma after xdr_sizeof(3) in SYNOPSIS This unbreaks the .Nm declaration
* MFC r318703:ngie2017-07-181-1/+1
| | | | __iconv_get_list: separate .Nm entries with commas
* MFC r318707:ngie2017-07-181-2/+2
| | | | sctp_send(3): start sentences on new lines
* MFC r318704,r318708,r318709:ngie2017-07-183-4/+5
| | | | | | | | | | | | | | r318704: posix1e(3): reference using the section (3) when referencing libbsm with .Xr r318708: acl_create_entry(3): separate .Nm entries with commas in SYNOPSIS r318709: acl_to_text(3): start sentences on new lines
* MFC r318710:ngie2017-07-181-3/+3
| | | | quick_exit(3): delete trailing whitespace in licensing tort
* MFC r318715,r318717,r318718,r318719,r318720,r318721:ngie2017-07-186-44/+45
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r318715: _umtx_op(2): fix minor manlint issues - Sort .Xr entries in SEE ALSO section. - Sort SEE ALSO and STANDARDS sections properly, in terms of the entire document. r318717: cap_enter(2): fix manlint issues - Sort SEE ALSO section appropriately. - Correct section for sysctl(9). r318718: rctl_add_rule(2): fix manlint warnings - Fix commas (either missing or misused) after .Nm entries in SYNOPSIS r318719: open(2): fix manlint warnings - Sort SEE ALSO .Xr entries. - Sort sections (HISTORY comes after STANDARDS). r318720: ptrace(2): clean up trailing whitespace r318721: kill(2): add missing section for sysctl(9)
* MFC r319048,r319049,r319051,r319054:ngie2017-07-183-35/+44
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r319048: Push `snapshot_file` copying down into run_tests function, and mark snapshot_file const char *. This fixes a bogus set of errors from gcc about strdup not being allowed a NULL argument. r319049: Bump WARNS from 1 to 3 after recent commits to fix warnings in the directory. Tested with: clang 4.0, gcc 4.2.1, gcc 6.3.0 r319051: hostent_test_getnameinfo_eq(..): initialize found_a_host to false CID: 1368943 r319054: hostent_test_getaddrinfo_eq(..): call freeaddrinfo on `ai` when done This plugs a leak of memory allocated via getaddrinfo. CID: 1346866
* MFC r318701,r319842:ngie2017-07-182-3/+3
| | | | | | | | | | | | | | | r318701: tcsendbreak(3): delete spurious blank line at the end of the man page r319842: getbsize(3): clarify that underflow/overflow warnings in regard to $BLOCKSIZE gets output via warnx(3) This helps set expectations for how one might deal with those messages, i.e., mute output from /dev/stderr today, since that's where vwarn(3) outputs messages to today.
* MFC r318695:ngie2017-07-181-4/+4
| | | | | | err(3): use `NULL`, aka `(void*)0` per POSIX instead of `(FILE *)0` This is being done to aid humans and static analysis checkers.
* MFC r318705,r318711:ngie2017-07-182-9/+14
| | | | | | | | | | | | | | | | r318705: fopen(3): make manlint fixes - Break on new lines. - Use .Dv with NULL. - Rewrap lines as necessary/when possible. r318711: fopencookie(3): declare function pointers in SYNOPSIS correctly Add obligatory `*` in declarations.
* MFC r320868:kib2017-07-171-32/+44
| | | | Fix warnings, adjust style.
* MFC r320472,r320508,r320509:kib2017-07-1339-139/+191
| | | | Make stdio deferred cancel-safe.
* MFC r320801:kib2017-07-111-3/+5
| | | | Simplify language.
* MFC r320570:kib2017-07-091-4/+5
| | | | Correct signatures of several pthreads stubs.
* Add MAP_GUARD and use it for stack grow area protection.kib2017-07-052-2/+42
| | | | | | | | | | | | | | | | | | | | | | | | | | Bump __FreeBSD_version. MFC r320317: Implement address space guards. MFC r320338: Remove stale part of the comment. MFC r320339: Correctly handle small MAP_STACK requests. MFC r320344: For now, allow mprotect(2) over the guards to succeed regardless of the requested protection. MFC r320430: Treat the addr argument for mmap(2) request without MAP_FIXED flag as a hint. MFC r320560 (by alc): Modify vm_map_growstack() to protect itself from the possibility of the gap entry in the vm map being smaller than the sysctl-derived stack guard size.
* MFC r320494: Fix double free by reverting r300385 and r300624 which wasdelphij2017-07-031-3/+1
| | | | | | false positive reported by cppcheck. releng/11.1 candidate.
* MFC r320314:kib2017-06-271-4/+1
| | | | | | Remove the description of MAP_HASSEMAPHORE. Approved by: re (marius)
* MFC r320313:kib2017-06-271-1/+1
| | | | | | Fix typo. Approved by: re (marius)
* MFC r320216: Fix use-after-free introduced in r300388.delphij2017-06-251-1/+2
| | | | | | | | | | | | In r300388, endnetconfig() was called on nc_handle which would release the associated netconfig structure, which means tmpnconf->nc_netid would be a use-after-free. Solve this by doing endnetconfig() in return paths instead. Reported by: jemalloc via kevlo Reviewed by: cem, ngie (earlier version) Approved by: re (kib)
* MFC r320052:kib2017-06-241-21/+25
| | | | | | Do not leak syslog_mutex on cancellation. Approved by: re (marius)
* MFC 319490: Remove stale cap_rights_get(2) manpage.jhb2017-06-201-1/+0
| | | | | | | | The documentation moved to section 3 several years ago, but 'man cap_rights_get' pulls up cap_rights_limit(2) (which is MLINKed to cap_rights_get.2) instead of cap_rights_get(3). Approved by: re (gjb)
* MFC r320035:kib2017-06-191-4/+5
| | | | | | | Move the description of kern.kq_calloutmax sysctl into a new paragraph for better presentation. Approved by: re (delphij)
* MFC r320034:kib2017-06-191-1/+2
| | | | | | Start a new sentence on the new line. Approved by: re (delphij)
* MFC r318765:allanjude2017-06-111-1/+7
| | | | | | Allow cpuset_{get,set}affinity in capabilities mode Approved by: re (marius)
* MFC r318816:trasz2017-06-063-3/+3
| | | | | | Don't end up manpage titles with a full stop. Approved by: re (marius)
* MFC r319369:delphij2017-06-064-17/+47
| | | | | | | | | | | | | | | * limit size of buffers to RPC_MAXDATASIZE * don't leak memory * be more picky about bad parameters From: https://raw.githubusercontent.com/guidovranken/rpcbomb/master/libtirpc_patch.txt https://github.com/guidovranken/rpcbomb/blob/master/rpcbind_patch.txt via NetBSD. Approved by: re (kib)
* MFC r318582vangyzen2017-06-013-12/+4
| | | | | | | | | | | Remove old spinlock_debug code from libc This no longer seems useful. Remove it. This was prompted by a "cast discards volatile qualifier" warning in libthr when WARNS=6. Sponsored by: Dell EMC
* MFC r318539 r318580 r318581 r318584 r318749 r318952 r318953 r318955vangyzen2017-06-011-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | libthr: fix warnings at WARNS=6 Fix warnings about the following when WARNS=6 (which I will commit soon): - casting away const - no previous 'extern' declaration for non-static variable - others as explained by #pragmas and comments - unused parameters libthr: disable thread-safety warnings These warnings don't make sense for code that implements the locking primitives. libthr: change CHECK_AND_INIT_RWLOCK to an inline function This was prompted by a compiler warning about 'ret' shadowing a local variable in the callers of the macro. libthr: Use CLI flags instead of pragmas to disable warnings People tweaking the build system or compilers tend to look into the Makefile and not into the source. Having some warning controls in the Makefile and some in the source code is surprising. Pragmas have the advantage that they leave the warnings enabled for more code, but that advantage isn't very relevant in these cases. libthr: fix warnings from GCC when WARNS=6 Fix warnings about: - redundant declarations - a local variable shadowing a global function (dlinfo) - an old-style function definition (with an empty parameter list) - a variable that is possibly used uninitialized libthr: prevent setcontext() from masking SIGTHR __thr_setcontext() mistakenly tested for the presence of SIGCANCEL in its local ucontext_t instead of the parameter. Therefore, if a thread calls setcontext() with a context whose signal mask contains SIGTHR (a.k.a. SIGCANCEL), that signal will be blocked, preventing the thread from being cancelled or suspended. Sponsored by: Dell EMC
* MFC r318450:kib2017-06-012-0/+103
| | | | | | Add tests for some cases in r318298. PR: 219154
* MFC r319086:kib2017-05-311-2/+5
| | | | Mention that the basep argument to getdirentries(2) can be NULL.
* MFC ↵ngie2017-05-319-98/+95
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r319027,r319028,r319029,r319030,r319031,r319033,r319034,r319035,r319036,r319037,r319038,r319039,r319040,r319041,r319042,r319043,r319044,r319045,r319046: r319027: lib/libc/tests/nss: use calloc appropriately The pattern used prior to this commit was `calloc(1, n * sizeof(type))`; the pattern that should be used however is `calloc(n, sizeof(type))`. r319028: Sort make variables to suit style.Makefile(5) This is being done prior to functional changes. r319029: Staticize functions and remove unused variables to aid with bumping WARNS r319030: Fix -Wsign-compare warnings r319031: getusershell_test: staticize run_tests(..) to fix warnings r319033: getserv_test: fix -Wsign-compare and -Wmissing-prototypes warnings r319034: getaddrinfo_test: fix -Wsign-compare warnings r319035: getrpc_test: fix -Wmissing-prototypes and -Wsign-compare warnings r319036: getproto_test: fix -Wmissing-prototypes and -Wsign-compare warnings r319037: getaddrinfo_test: mark unused function parameters __unused to fix -Wunused warnings r319038: getusershell_test: mark mdata parameter in compare_usershell __unused r319039: getserv_test: mark unused parameters __unused to fix corresponding warnings r319040: getrpc_test: fix -Wunused warnings - Mark unused function parameters unused. - Remove an unused function prototype. r319041: getproto_test: fix -Wunused warnings Mark unused parameters __unused in functions. r319042: gethostby_test: fix multiple warning types - Fix -Wmissing-declaration warning by staticizing run_tests. - Fix -Wsign-compare warnings by casting size_t types to int for comparisons. Reindent some of the code in sdump_hostent(..) to accomodate the overall changes. r319043: getpw_test: fix -Wunused warnings - Mark unused parameters __unused. - Put dump_passwd under DEBUG as it's only used in that case. r319044: getgr_test: fix -Wunused warnings r319045: Fix -Wunused and -Wshadow warnings r319046: Fix a -Wunused-but-set-variable warning reported by gcc 6.3.0
* MFC r304106:delphij2017-05-317-5/+196
| | | | | | | Add timingsafe_bcmp and timingsafe_memcmp. Obtained from: OpenBSD Reviewed by: trasz
* MFC r318514-r318515, r318517, r318917delphij2017-05-311-18/+41
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r318514: Use size_t. Inspired by: OpenBSD src/lib/libc/stdlib/qsort.c,v 1.11 r318515: The current qsort(3) implementation ignores the sizes of partitions, and always perform recursion on the left partition, then use a tail call to handle the right partition. In the worst case this could require O(N) levels of recursions. Reduce the possible recursion level to log2(N) by always recursing on the smaller partition instead. Obtained from: PostgreSQL 9d6077abf9d6efd992a59f05ef5aba981ea32096 r318517: Sync qsort.c with userland r318515. (Note that MIN macro is removed in favor of sys/param.h's version). PR: 213922 r318917: Disconnect heimdal version of qsort.c from build because we are already using libc's version of qsort. PR: bin/213922
* MFC r315272, r315370delphij2017-05-311-1/+13
| | | | | | | | | | | | | | | | | | | | | | | r315272: Implement INHERIT_ZERO for minherit(2). INHERIT_ZERO is an OpenBSD feature. When a page is marked as such, it would be zeroed upon fork(). This would be used in new arc4random(3) functions. PR: 182610 Reviewed by: kib (earlier version) Differential Revision: https://reviews.freebsd.org/D427 r315370: The adj_free and max_free values of new_entry will be calculated and assigned by subsequent vm_map_entry_link(), therefore, remove the pointless copying. Submitted by: alc
OpenPOWER on IntegriCloud