summaryrefslogtreecommitdiffstats
path: root/lib
Commit message (Collapse)AuthorAgeFilesLines
* 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.
* MFC r317064: Optimize pathologic case of telldir() for Samba.mav2017-05-011-4/+14
| | | | | | | | | | When application reads large directory, calling telldir() for each entry, like Samba does, it creates exponential performance drop as number of entries reach tenths to hundreds of thousands. It is caused by full search through the internal list, that never finds matches in that scenario, but creates O(n^2) delays. This patch optimizes that search, limiting it to entries of the same buffer, turning time closer to O(n) in case of linear directory scan.
* MFC r317214:dim2017-04-292-2/+4
| | | | | | | | | | | | Turn off llvm/clang's ENABLE_BACKTRACES setting, since it never worked properly anyway. (Upstream has reorganized this somewhat in the mean time, but for proper backtraces we would need llvm-symbolizer in base.) MFC r317215: Add function and data sections when building llvm, clang, lld and lldb, and allow the linker to garbage collect them. This shaves off up to a few MB from the final executables.
* MFC r316768:brooks2017-04-241-0/+4
| | | | | | | | | | Fix an out-of-bounds write when a zero-length buffer is passed. Found with ttyname_test and CHERI bounds checking. Reviewed by: emaste Obtained from: CheriBSD Sponsored by: DARPA, AFRL
* MFC r316766:brooks2017-04-241-2/+2
| | | | | | | | | | | | | | | | Correct an out of bounds read with HN_AUTOSCALE and very large numbers. The maximum scale is 6 (K, M, G, T, P, E) (B is 0). Overly large explict scales were checked correctly, but for sufficently large numbers HN_AUTOSCALE would get to 7 resulting in an out of bounds read. Found with humanize_number_test and CHERI bounds checking. Reviewed by: emaste Obtained from: CheriBSD Sponsored by: DARPA, AFRL
* MFC r316739:kib2017-04-191-6/+3
| | | | Fix reporting of _SC_SEM_NSEMS_MAX and _SC_SEM_VALUE_MAX.
* MFC r315636,315876,316095:mm2017-03-313-19/+14
| | | | | | | | | | | | | | | | | | | | | | | | Sync libarchive with vendor Vendor changes/bugfixes (FreeBSD-related): r315636: PR 867 (bsdcpio): show numeric uid/gid when names are not found PR 870 (seekable zip): accept files with valid ZIP64 EOCD headers PR 880 (pax): Fix handling of "size" pax header keyword PR 887 (crypto): Discard 3072 bytes instead of 1024 of first keystream OSS-Fuzz issue 806 (mtree): rework mtree_atol10 integer parser Break ACL read/write code into platform-specific source files r315876: Store extended attributes with extattr_set_link() if no fd is provided Add extended attribute tests to libarchive and bsdtar Fix tar's test_option_acls Support the UF_HIDDEN file flag r316095: Constify variables in several places Unify platform ACL code in a single source file Fix unused variable if compiling on FreeBSD without NFSv4 ACL support
* MFC r316080,r316081,r316115:ngie2017-03-312-89/+82
| | | | | | | | | | | | | | | | | | | | | r316080: Fix some localized style(9) issues and reword CAM_ERRBUF_SIZE description The CAM_ERRBUF_SIZE description rewording fixes a typo by proxy. r316081: Use `sizeof(cam_errbuf)` instead of `CAM_ERRBUF_SIZE` in snprintf calls Reindent snprintf calls' arguments to match style(9) guidelines with respect to indentation. r316115: libcam: use __func__ instead of hardcoding the function name as `func_name` Tested with: `cam_device_copy(NULL, NULL)` // ;)..
* MFC r315734:ngie2017-03-301-5/+5
| | | | style(9): sort #includes
* MFC r313436,r313437,r313438,r314587,r315687:ngie2017-03-281-16/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r313436: Clarify #includes for hexdump(3) vs sbuf_hexdump(9) hexdump(3) only requires libutil.h, whereas sbuf_hexdump(9) requires sys/types.h (for ssize_t) and sys/sbuf.h r313437: Create link from hexdump(3) to sbuf_hexdump(9) as the manpage describes sbuf_hexdump(9)'s behavior r313438: Clean up trailing and leading whitespace for variables to make it consistent with the rest of the file and style.Makefile(9) a bit more r314587: Correct MLINKS for sbuf_hexdump(9) sbuf_hexdump(9) should be linked to sbuf(9), not hexdump(3). Another review will be posted to deduplicate the sbuf_hexdump reference in in hexdump(3) or at the very least make the information less duplicative. r315687: Document sbuf_hexdump(9) in just sbuf(9) - Remove duplicate references to sbuf_hexdump(9) from hexdump(3). sbuf_hexdump(9) already pointed back to hexdump(3) for implementation details. - Refer to sbuf_hexdump(9) instead of sbuf(9) for completeness
* MFC r315686,r315688:ngie2017-03-282-2/+16
| | | | | | | | | | | | | | | | | | | | | | r315686: kvm_geterr: handle `kd` == NULL in a deterministic/graceful manner Return a NUL string instead of just working by accident with kvm_geterr(3) when MALLOC_PRODUCTION is disabled (I didn't confirm the MALLOC_PRODUCTION being enabled path). Document the new explicit return behavior for kvm_geterr(3), as well as the previous implicit behavior, i.e., the buffer attached to returned via kvm_geterr(3) would be empty if a previous error hadn't been stored in `kd`. r315688: kvm_write: fix -Wcast-qual warning in pointer arithmetic argument Cast buf to `const char *` when doing arithmetic operation to match `cp`'s type [1].
* MFC r315647:ngie2017-03-282-2/+25
| | | | | | | | | Handle kd == NULL gracefully with kvm_close(3) Don't segfault in kvm_close(3) if provided a NULL pointer. Instead, return -1 and set errno to EINVAL. Document this new behavior explicitly.
* MFC r315639:ngie2017-03-271-0/+5
| | | | | | libcam: NULL out freed `ccb.cdm.matches` and `ccb.cdm.patterns` pointers This is being done to avoid potential double frees with the values.
* MFC r315595,r315603:ngie2017-03-272-2/+1
| | | | | | | | | | | | | | | | | | | | | | | r315595: Remove a commented out line before kvm_getprocs(3) The commented out return value for kvm_getprocs(3) was misleading -- the uncommented line is correct. No content change r315603: kvm_close(3): return `error` instead of blindly returning `0` `error` is the accumulated error from previous close(2) calls. This bug has been present since the libcall's import from 4.4BSD Lite (r1573). Noticed by: vangyzen (D10022) Relnotes: yes
* Synchronize libcxxrt in stable/10 with stable/11.dim2017-03-252-1/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MFC r284553 (by emaste): Update libcxxrt upgrade instructions The typeinfo file no longer exists upstream. MFC r297299: Compile libcxxrt as C++11, since it is only really used in combination with libc++, which is also C++11. Also change one _Static_assert (which is really C11) back into static_assert, like upstream. This should help when compiling libcxxrt with newer versions of gcc, which refuse to recognize any form of static assertions, if not compiling for C++11 or higher. While here, add -nostdinc++ to CFLAGS, to prevent picking up any C++ headers outside the source tree. MFC r299144: Import libcxxrt master 516a65c109eb0a01e5e95fbef455eb3215135cef. Interesting fixes: 3adaa2e Fix _Unwind_Exception cleanup functions 286776c Check exception cleanup function ptr before calling edda626 Correct exception specifications on new and delete operators MFC r303157 (by emaste): libcxxrt: add padding in __cxa_allocate_* to fix alignment The addition of the referenceCount to __cxa_allocate_exception put the unwindHeader at offset 0x58 in __cxa_exception, but it requires 16-byte alignment. In order to avoid changing the current __cxa_exception ABI (and thus breaking its consumers), add explicit padding in the allocation routines (and account for it when freeing). This is intended as a lower-risk change for FreeBSD 11. A "more correct" fix should be prepared for upstream and -CURRENT. Reviewed by: dim Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D7271 MFC r305396: Add _US_ACTION_MASK to libcxxrt's arm-specific unwind header. This value is used in newer versions of compiler-rt.
* MFH (r313974,r314596): open .netrc early in case we want to drop privsdes2017-03-245-55/+77
| | | | | | | | MFH (r314396,r315143): fix a crash caused by an incorrect format string MFH (r314701): fix handling of 416 errors when requesting a range MFH (r315455): fix parsing of IP literals (square brackets) PR: 212065, 217723
* MFC r315360:ngie2017-03-231-3/+3
| | | | | | | | | Return NULL instead of 0 on failure in _kvm_open, kvm_open{,2,files} This is being done for the following reasons: - kvm_open(3), etc says they will return NULL. - NULL by definition is (void*)0 per POSIX, but can be redefined, depending on the compiler, etc.
* MFC r315363,r315365:ngie2017-03-231-3/+3
| | | | | | | | | | | | | | | | | r315363: Fix manlint errors - Add missing comma after kvm_dpcpu_setcpu .Nm macro use (multiple .Nm entries should be separated by commas) - Add missing section for kvm_dpcpu_setcpu Xr. r315365: Tweak r315363 slightly I noticed after commit that kvm_dpcpu_setcpu was defined in the manpage. Thus, the correct macro for the function reference is .Fn, not .Xr.
* MFC r314709,r314790,r314794:bdrewery2017-03-221-0/+7
| | | | | | | | | | | r314709: Fix bootstrapping mtree after r313404 for older systems. r314790: Added comments for why nmtree/libmd are bootstrapped. r314794: Fix bootstrapping libmd on older systems after r314709. PR: 217673
* MFC r315320:ngie2017-03-223-0/+234
| | | | | | | | | | | | | | | | | | | | Start adding basic tests for cam(3) This change contains several negative and positive tests for: - cam_open_device - cam_close_device - cam_getccb - cam_freeccb This also contains a test for the failure case noted in bug 217649, i.e., O_RDWR must be specified because pass(4) requires it. This test unfortunately cannot assume that cam-capable devices are present, so the user must explicitly provide a device via `test_suites.FreeBSD.cam_test_device`. In the future, a test kernel module might be shipped, or ctl(4) might be used, as a test device when testing out libcam, which will allow the tests to do away with having to specify an explicit test device.
* MFC r315202:ngie2017-03-201-13/+16
| | | | | | | | | | | | lib/libcam/cam_cdbparse.3: fix manpage warnings - Add comma before and after 'e.g.'; remove surrounding parentheses that were unnecessary after this change [1]. - Add .Mt when referencing ken and Peter Dufault's email addresses [2]. - Sprinkle around .An use where proper [2]. Bump .Dd for the change
* MFC r315132,r315133,r315186:ngie2017-03-201-11/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r315132: Use .Dv when referencing NULL This is the correct markup macro, as opposed to .Va (variable names) While here, annotate several bare references to `NULL` with .Dv. r315133: lib/libcam/cam.3: fix manpage warnings - spelling: "mis-named" should be "misnamed". - delete spaces interspersed in literal representation of `struct cam_device` as hard-tabs separate the types and fields. - Add commas after `e.g.`. r315186: lib/libcam/cam.3: note that cam_freeccb(3) with ccb == NULL is a no-op This allows me to accurately test this scenario, and for others to rely on the behavior, instead of relying on knowledge obtained via code inspection. Wording borrowed from free(3). Requested by: ken (D9928)
* MFC r314571:mm2017-03-162-5/+6
| | | | | | | | | | | | | | | | Update libarchive to version 3.3.1 (and sync with latest vendor dist) Notable vendor changes: PR #501: improvements in ACL path handling PR #724: fix hang when reading malformed cpio files PR #864: fix out of bounds read with malformed GNU tar archives Documentation, style, test suite improvements and typo fixes. New options to bsdtar that enable or disable reading and/or writing of: Access Control Lists (--acls, --no-acls) Extended file flags (--fflags, --no-fflags) Extended attributes (--xattrs, --no-xattrs) Mac OS X metadata (Mac OS X only) (--mac-metadata, --no-mac-metadata)
* MFC r315187:pfg2017-03-161-1/+1
| | | | | | libc: mall cleanup. Let calloc(3) do the multiplication.
* MFC r314954:ngie2017-03-161-1/+1
| | | | style(9): sort the #includes
* MFC r315225:delphij2017-03-141-1/+1
| | | | | | | | Discard first 3072 bytes of RC4 keystream, this is a bandaid that allows us to work on switching to a more modern PRNG. Submitted by: Steven Chamberlain <steven pyro eu org> Approved by: so
* MFC r314807:ngie2017-03-131-1/+1
| | | | Move ATF_TC_WITHOUT_HEAD(getgrent) near the testcase it annotates
* MFH (r300602): the NAS identifier is a string, not an integerdes2017-03-121-1/+1
|
* MFH (r314598): load default options before requesting ticketdes2017-03-121-0/+2
| | | | PR: 213909
* MFC r314189,r314190,r314191:ngie2017-03-121-28/+29
| | | | | | | | | | | | | | | | | | | r314189: Fix up NULL/'\0' uses and fix 2 derefs after NULL CID: 1018898, 1018899 r314190: Fix some minor style nits: put parentheses around return values r314191: Fix up r314189 The conditional in do_buff_decode(..) after the while loop was accidentally inverted. Only increment the pointer for fmt if it's not NUL.
* MFC r314055vangyzen2017-03-101-58/+54
| | | | | | Make several improvements and corrections in the kenv(2) man page Sponsored by: Dell EMC
* MFC r314061:dim2017-03-081-1/+22
| | | | | | | | | | | | | | | | | | | Add __int128-related symbols to libcxxrt's version map. Put these into the same CXXABI verions as recent libstdc++. Note that __int128 types are only available on arches where long long is 128 bit wide. Noticed by: harti MFC r314104: Surround any unmangled C++ names in libcxxrt's version map with 'extern "C++"', otherwise ld refuses to make the symbols global in the final library. This causes the __int128-related symbols to go missing when the library is stripped during installation. Helpful hints: emaste
* MFC r313438:ngie2017-03-071-5/+5
| | | | | | Clean up trailing and leading whitespace for variables to make it consistent with the rest of the file and style.Makefile(9) a bit more
* MFC r314450,r313439:ngie2017-03-072-3/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r314450: Add additional __FreeBSD_version guards around the hsearch_r testcases The reasoning for this is the same as r276046: to ease MFCing the tests to ^/stable/10 . This was accidentally missed in r313439 r313439 | ngie | 2017-02-08 01:46:15 -0800 (Wed, 08 Feb 2017) | 25 lines Merge content from ^/projects/netbsd-tests-upstream-01-2017 into ^/head The primary end-goal of this drop is ease future merges with NetBSD and collaborate further with the NetBSD project. The goal was (largely, not completely as some items are still oustanding in the NetBSD GNATS system) achieved by doing the following: - Pushing as many changes required to port contrib/netbsd-tests back to NetBSD as possible, then pull the upstream applied changes back in to FreeBSD. - Diff reduce with upstream where possible by: -- Improving libnetbsd header, etc compat glue. -- Using _SED variables to modify test scripts on the fly for items that could not be upstreamed to NetBSD. As a bonus for this work, this change also introduces testcases for uniq(1). Many thanks to Christos for working with me to get many of the changes back into the NetBSD project. In collaboration with: Christos Zoulas <christos@netbsd.org>
* Note: this change reintroduces r314020 after r314327, r314330, and r314332ngie2017-02-288-3/+199
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MFC r313404: Improve libnetbsd compatibility with NetBSD This change is being made to diff reduce/reduce duplication in contrib/netbsd-tests and to facilitate further porting of software from NetBSD Add the following headers: - sys/event.h: -- sys/types.h is required for kqueue on FreeBSD, but not NetBSD. - sys/types.h: -- NBBY is defined in sys/param.h on FreeBSD, not sys/types.h like on NetBSD. Pull in sys/param.h to have parity with NetBSD. - sys/wait.h: -- Define wrusage as __wrusage for parity with NetBSD typedef. - glob.h -- Define __gl_stat_t as "struct stat" for parity with NetBSD typedef. - pthread.h: -- Pull in pthread_np.h for _np functions defined separately on FreeBSD. Improve compatibility with NetBSD in the following headers: - sha1.h: -- define SHA1_CTX as SHA_CTX -- define SHA1Final as SHA1_Final - sha2.h: -- #include sha384 to pick up all of the SHA 384 bit macros and definitions. - util.h: -- Add sys/types.h to util.h to pollute the header for types used in flags_to_string and string_to_flags (u_long) as NetBSD doesn't require them for the functions.
* MFC r300903: Implement SHA-512 truncated (224 and 256 bits)avg2017-02-274-10/+78
|
OpenPOWER on IntegriCloud