summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* MFC r318705:ngie2017-07-181-5/+10
| | | | | | | | fopen(3): make manlint fixes - Break on new lines. - Use .Dv with NULL. - Rewrap lines as necessary/when possible.
* MFC r316558:ngie2017-07-184-8/+12
| | | | | | | Use __FBSDID instead of the license agreement to embed the $FreeBSD$ RCS keyword Reminded by a comment made by markj w.r.t. using __FBSDID in .c files ala a past Phabricator review.
* MFC r316557:ngie2017-07-186-0/+716
| | | | | | | | | | | | | | sbuf(3): add some basic functional tests for the library Areas not covered still [positive functionality wise] are: - sbuf_{clear,get,set}_flags - sbuf_new (in particular, with fixed buffers, etc). Some basic negative testing has been added, but more will be added in the future. This work was in part to validate work done by cem in r288223, and ian before that.
* MFC r307873,r314397,r314399,r314419,r314420,r314533,r316553:ngie2017-07-182-0/+11
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r307873 (by marcel): Include <stdarg.h> instead of <machine/stdarg.h> when compiled as part of libsbuf. The former is the standard header, and allows us to compile libsbuf on macOS/linux. r314397 (by scottl): Implement sbuf_prf(), which takes an sbuf and outputs it to stdout in the non-kernel case and to the console+log in the kernel case. For the kernel case it hooks the putbuf() machinery underneath printf(9) so that the buffer is written completely atomically and without a copy into another temporary buffer. This is useful for fixing compound console/log messages that become broken and interleaved when multiple threads are competing for the console. r314399 (by scottl): Add prototype for sbuf_putbuf() r314419 (by jkim): Include stdio.h to fix libsbuf build. r314420 (by scottl): Provide a comment on why stdio.h needs to be included. r314533 (by scottl): Expose the sbuf_putbuf() symbol to libsbuf. There are a few other symbols that are present but not exposed, like get/set/clear flags, not sure if they need to be exposed at this point. r316553: sbuf(3): expose sbuf_{clear,get,set}_flags(3) via libsbuf These functions were added to sbuf(9) in r279992, but never exposed to userspace. Expose them now so they can be used/tested.
* MFC r320472,r320508,r320509:kib2017-07-1739-139/+191
| | | | | | Make stdio deferred cancel-safe. Requested by: eugen
* MFC r320468:delphij2017-07-173-5/+0
| | | | | | Don't bother to set target for SEEK_END. While there also collapase SEEK_END into default case in lseek.
* MFC r320570:kib2017-07-091-4/+5
| | | | Correct signatures of several pthreads stubs.
* MFC r320494: Fix double free by reverting r300385 and r300624 which wasdelphij2017-07-031-3/+1
| | | | false positive reported by cppcheck.
* 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)
* MFC r320052:kib2017-06-241-21/+25
| | | | Do not leak syslog_mutex on cancellation.
* 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 r279833: Use the correct event table for Haswell Xeon eventsavg2017-06-201-1/+1
|
* MFC r291494: Add support for Intel Skylake and Intel Broadwell PMC's.avg2017-06-191-1/+117
|
* MFC r279835: Fix Ivy Bridge+ MEM_UOPS_RETIRED countersavg2017-06-194-98/+72
|
* MFC r279832: Fix Sandy Bridge+ hwpmc branch countersavg2017-06-196-329/+230
|
* MFC r279829: Add manpage for Haswell Xeon pmc implementationavg2017-06-192-0/+976
|
* Work around a gcc 4.2 bug on powerpc architectures, where usingdim2017-06-061-2/+7
| | | | | | | | | | | | -fdata-sections can cause bogus "section type conflict" errors. See https://gcc.gnu.org/bugzilla/show_bug.cgi?id=33168 for more information. Since the upstream fixes are under GPLv3 and non-trivial, just disable using function and data sections, at the cost of a slightly larger executable. Direct commit to stable/10, since the version of clang in head and stable/11 cannot be built by gcc 4.2 at all.
* 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.
* MFC r318450:kib2017-06-012-0/+103
| | | | | | Add tests for some cases in r318298. PR: 219154
* MFC r319157:ngie2017-06-011-1/+2
| | | | | | | | fma_test: mute a warning about unreachable code on amd64 by restructuring the #ifdef block to only handle the rest of the logic in the loop in the #else case. CID: 1346844
* MFC r319158:ngie2017-06-011-1/+1
| | | | | | | | logarithm_test: assert that feclearexcept succeeds This helps ensure that test preconditons are fulfilled. CID: 1346572
* MFC r319156,r319159:ngie2017-06-012-1/+2
| | | | | | | | | | | | | | | | | | r319156: :nvlist_unpack__duplicate_key : check the result of nvlist_pack(3) This fixes a potential NULL pointer dereference. CID: 1362051 r319159: :dnvlist_get_string__default_value: fix a bogus string comparison test Check actual_value vs "5", not "5" vs itself. CID: 1362021
* MFC r319086:kib2017-05-311-2/+5
| | | | Mention that the basep argument to getdirentries(2) can be NULL.
* MFC r317311,r317312,r319019:ngie2017-05-311-2/+2
| | | | | | | | | | | | | | | | | | | | | | | r317311: Check for failures from getpagesize(3) Return errno on failure, similar to the open(2) call above it. CID: 1193753 r317312: Fix type for `pagesize` to match the return type for getpagesize(3) to fix the build Pointyhat to: ngie r319019: Remove getpagesize(3) error checking added in r317312 getpagesize(3) no longer fails as of r317436.
* MFC ↵ngie2017-05-319-97/+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 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
* Partial MFC r288030 (rodrigc):delphij2017-05-311-3/+1
| | | | Use ANSI C prototypes. Eliminates -Wold-style-definition warnings.
* MFC r279663,r279666 (pfg):delphij2017-05-311-22/+31
| | | | | | | | | | | | | | | | | | | | r279663: qsort(3): enhance to handle 32-bit aligned data on 64-bit systems Implement a small enhancement to the original qsort implementation: If the data is 32 bit aligned we can side-step the long type version and use int instead. The change brings a modest but significant improvement in 32 bit workloads. r279666: qsort(3): small style(9) cleanups. Basically spaces vs. tabs. No functional change.
* MFC r316649:delphij2017-05-311-1/+1
| | | | Add missing double quote to fix r316635 commit.
* MFC r316635:delphij2017-05-311-13/+3
| | | | | | Enable 16-bit longest_match for x86. This gives a ~2% improvement in compression tests.
* 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
* MFC r315032-r315036, r315039, r315041asomers2017-05-306-0/+7
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r315032: Increase WARNS for iconv tests ATF tests have a default WARNS of 0, unlike other usermode programs. Reviewed by: ngie Sponsored by: Spectra Logic Corporation Differential Revision: https://reviews.freebsd.org/D9933 r315033: Increase WARNS for nss tests ATF tests have a default WARNS of 0, unlike other usermode programs. Reviewed by: ngie Sponsored by: Spectra Logic Corporation Differential Revision: https://reviews.freebsd.org/D9933 r315034: Document that the msun tests require WARNS=0 ATF tests have a default WARNS of 0, unlike other usermode programs. This change is technically a noop, but it documents that the msun tests don't work with any warnings enabled, at least not on all architectures. Reviewed by: ngie Sponsored by: Spectra Logic Corporation Differential Revision: https://reviews.freebsd.org/D9933 r315035: Increase WARNS for libcrypt tests ATF tests have a default WARNS of 0, unlike other usermode programs. Reviewed by: ngie, julian Sponsored by: Spectra Logic Corporation Differential Revision: https://reviews.freebsd.org/D9933 r315036: Increase WARNS for libmp tests ATF tests have a default WARNS of 0, unlike other usermode programs. Reviewed by: ngie, julian Sponsored by: Spectra Logic Corporation Differential Revision: https://reviews.freebsd.org/D9933 r315039: Increase WARNS for libutil tests ATF tests have a default WARNS of 0, unlike other usermode programs. Reviewed by: ngie, julian Sponsored by: Spectra Logic Corporation Differential Revision: https://reviews.freebsd.org/D9933 r315041: Increase WARNS for pw tests ATF tests have a default WARNS of 0, unlike other usermode programs. Reviewed by: ngie, julian Sponsored by: Spectra Logic Corporation Differential Revision: https://reviews.freebsd.org/D9933
* MFC r318303:kib2017-05-291-9/+7
| | | | Style.
* MFC r318299:kib2017-05-291-44/+31
| | | | Simplify cleanup on failure in realpath(3).
* MFC r318298:kib2017-05-291-19/+27
| | | | | | Fix several buffer overflows in realpath(3), and other minor issues. PR: 219154
* MFC r316131:ngie2017-05-281-27/+27
| | | | | | | | | | | | | | | | | | | Fix up r316081 by using nitems(cam_errbuf) instead of sizeof(cam_errbuf) Part of my original reasoning as far as converting the snprintf calls was to permit switching over from char[] to wchar_t[] in the future, as well as futureproof in case cam_errbuf's size was ever changed. Unfortunately, my approach was bugged because it conflated the number of items with the size of the buffer, instead of the number of elements being a fixed size != 1 byte. Use nitems(..) instead which counts the quantity of items of a specific type, as opposed to an unqualified sizeof(..) (which assumes that the number of characters is equal to the buffer size). Noted by: cem
* MFC r317310,r317316:ngie2017-05-282-18/+15
| | | | | | | | | | | | | | | | | | r317310: Minor style(9) fixups Delete trailing whitespace and sort headers. Leave libgeom.h's placement alone, per reasoning in r317289. r317316: Minor style(9) fixups Delete trailing whitespace and sort headers. Leave libgeom.h's placement alone, per reasoning in r317289.
* MFC r316099:ngie2017-05-278-0/+540
| | | | | | | | | | | | | | | | | | | | | | | | | lib/libkvm: start adding basic tests for kvm(3) - kvm_close: add a testcase to verify support for errno = EINVAL / -1 (see D10065) when kd == NULL is provided to the libcall. - kvm_geterr: -- Add a negative testcase for kd == NULL returning "" (see D10022). -- Add two positive testcases: --- test the error case using kvm_write on a O_RDONLY descriptor. --- test the "no error" case using kvm_read(3) and kvm_nlist(3) as helper routines and by injecting a bogus error message via _kvm_err (an internal API) _kvm_err was used as there isn't a formalized way to clear the error output, and because kvm_nlist always returns ENOENT with the NULL terminator today. - kvm_open, kvm_open2: -- Add some basic negative tests for kvm_open(3) and kvm_open2(3). Testing positive cases with a specific `corefile`/`execfile`/`resolver` requires more work and would require user intervention today in order to reliably test this out. MFC note: lib/libkvm/kvm_open2_test is not compiled/tested because ^/stable/10 lacks the kvm_open2(3) libcall.
* MFC r317288,r317289:ngie2017-05-271-11/+14
| | | | | | | | | | | | | | | | | | | | | | | | | | r317288: libgeom(3): apply minor polish - Use .Dv when mentioning NULL per mdoc(7). - Reword `g_device_path`, `g_open_by_ident`, and `g_providername`'s descriptions so they're less wordy. - Fix a typo in `g_device_path` (can not -> cannot). Tested with: igor, make manlint r317289: libgeom(3): note that stdio.h is required when referencing gctl_dump(3) gctl_dump(3) is only exposed when stdio.h is #include'd first, per its addition in r112510. The reasoning noted for the conditional "exposure" of the function was to "limit #include pollution". This addresses an issue I found with the documentation when looking at bug 218809, which in turn addresses a -Wimplicit-function-declaration compiler warning in `tools/regression/geom_gpt/test.c` (it uses gctl_dump(3)).
* MFC r317782,318181:mm2017-05-181-0/+2
| | | | | | | | | | | | | | | | | | | | | MFC r317782 (mm): Sync libarchive with vendor Vendor changes (FreeBSD-related): PR 897: add test for ZIP archives with invalid EOCD headers PR 901: fix invalid renaming of sparse files OSS-Fuzz issue 497: remove fallback tree in LZX decoder OSS-Fuzz issue 527: rewrite expressions in lz4 filter OSS-Fuzz issue 577: fix integer overflow in cpio reader OSS-Fuzz issue 862: fix numerc parsing in mtree reader OSS-Fuzz issue 1097: fix undefined shift in rar reader cpio: various optimizations and memory leak fixes MFC r318181 (ngie) (2): cpio/tests/test_option_lz4: fix a use after free in the failure case Reported by: Coverity (2) Sponsored by: Dell EMC Isilon (2)
* MFC r318259:dim2017-05-162-2/+2
| | | | | | | | | Silence a -Wunused warning about the junk variable being used to raise an inexact floating point exception. The variable cannot be eliminated, unfortunately, otherwise the desired addition triggering the exception will be emitted neither by clang, nor by gcc. Reviewed by: Steve Kargl, bde
* MFC r317660, r317710brooks2017-05-151-4/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | r317660: Support clnt_raw's use of FD_SETSIZE as a fake file descriptor. Accomplish this by allocating space for it in __svc_xports and allowing it to be registered. The failure to allocate space was causing an out-of-bounds read in svc_getreq_common(). The failure to register caused PR 211804. The bug was found with CHERI bounds checking. PR: 211804 Obtained from: CheriBSD Sponsored by: DARPA, AFRL Reviewed by: ngie Differential Revision: https://reviews.freebsd.org/D10528 r317710: Remove expected failure now that it was fixed in r317660. PR: 211804 Reviewed by: ngie Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D10576
* MFC r317845-r317846brooks2017-05-151-2/+16
| | | | | | | | | | | | | | | | | | | | | | r317845: Provide a freebsd32 implementation of sigqueue() The previous misuse of sys_sigqueue() was sending random register or stack garbage to 64-bit targets. The freebsd32 implementation preserves the sival_int member of value when signaling a 64-bit process. Document the mixed ABI implementation of union sigval and the incompability of sival_ptr with pointer integrity schemes. Reviewed by: kib, wblock Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D10605 r317846: Regen post r317845. MFC with: r317845 Sponsored by: DARPA, AFRL
* MFC r318185:ken2017-05-151-0/+1
| | | | | | | | | | | | | Add LTO-8 density codes. lib/libmt/mtlib.c: Add the LTO-8 density code to the density table in libmt. usr.bin/mt/mt.1: Add the LTO-8 density code, tracks, bpmm, and bpi to the density table in the mt(1) man page. Sponsored by: Spectra Logic
* MFC r306771:bdrewery2017-05-091-1/+1
| | | | Improve grammar.
* MFC r317707:brooks2017-05-091-0/+4
| | | | | | | | | | | | | | | | | | | Correct an out-of-bounds read in regcomp when the RE is bad. When passed the invalid regular expression "a**", the error is eventually detected and seterr() is called. It sets p->error appropriatly and p->next and p->end to nuls which is a never used char nuls[10] which is zeros due to .bss initialization. Unfortunatly, p_ere_exp() and p_simp_re() both have fall through cases where they set the error, decrement p->next and access it which means a read from whatever .bss variable comes before nuls. Found with regex_test:repet_multi and CHERI bounds checking. Reviewed by: ngie, pfg, emaste Obtained from: CheriBSD Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D10541
* MFC r317611:kib2017-05-071-5/+1
| | | | Make semaphore names list mutex non-recursive.
* MFC r317610:kib2017-05-071-12/+10
| | | | Restructure normal (non-error) control flow in sem_close().
* MFC r317606:kib2017-05-071-22/+24
| | | | Style.
* MFC r317436:kib2017-05-031-1/+1
| | | | getpagesize(3) cannot fail.
OpenPOWER on IntegriCloud