summaryrefslogtreecommitdiffstats
path: root/lib/libutil
Commit message (Collapse)AuthorAgeFilesLines
* MFC r317265:pfg2017-05-093-3/+3
| | | | | | | lib: initial use of reallocarray(3). Make some use of reallocarray, attempting to limit it to cases where the parameters are unsigned and there is some theoretical chance of overflow.
* 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 r315039asomers2017-04-021-0/+1
| | | | | | | | | | | Increase WARNS for libutil tests ATF tests have a default WARNS of 0, unlike other usermode programs. Reviewed by: ngie, julian MFC after: 3 weeks Sponsored by: Spectra Logic Corporation Differential Revision: https://reviews.freebsd.org/D9933
* 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 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 r312452-r312512:ngie2017-02-101-1/+1
| | | | | | | | | | r312452-r312512: - Use SRCTOP-relative paths to other directories instead of .CURDIR-relative ones This simplifies pathing in make/displayed output - Use .CURDIR:H instead of .CURDIR to simplify pathing in output, etc
* MFC r311714:ngie2017-01-134-12/+12
| | | | | | | lib/libutil/kinfo_*: style cleanup - Use nitems(mib) instead of hardcoding mib's length - Sort sys/ #includes
* MFH (r309269): use malloc()ed buffers instead of stack buffersdes2016-12-232-26/+48
|
* MFC r308806asomers2016-12-162-2/+2
| | | | | | | | | | Speed up pw operations that edit /etc/group or /etc/passwd r285050 fixed a bug in pw that could lead to /etc/passwd or /etc/group corruption on power loss. However, it fixed it by opening those files with O_SYNC, which is very slow, especially on ZFS. This change replaces O_SYNC with appropriately placed fsync()s instead, which is much faster. Using a ZFS tmpdir, the time to run pw's kyua tests drops from 245s to 35s.
* libutil: minor spelling fixes.pfg2016-05-184-4/+4
|
* Use strlcpy() instead of strncpy() to ensure that qf->fsname is NULtruckman2016-05-131-1/+1
| | | | | | | | | terminated. Don't bother checking for truncation since the subsequent stat() call should detect that and fail. Reported by: Coverity CID: 1018189 MFC after: 1 week
* Merge ^/user/ngie/release-pkg-fix-tests to unbreak how test files are installedngie2016-05-041-4/+0
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | after r298107 Summary of changes: - Replace all instances of FILES/TESTS with ${PACKAGE}FILES. This ensures that namespacing is kept with FILES appropriately, and that this shouldn't need to be repeated if the namespace changes -- only the definition of PACKAGE needs to be changed - Allow PACKAGE to be overridden by callers instead of forcing it to always be `tests`. In the event we get to the point where things can be split up enough in the base system, it would make more sense to group the tests with the blocks they're a part of, e.g. byacc with byacc-tests, etc - Remove PACKAGE definitions where possible, i.e. where FILES wasn't used previously. - Remove unnecessary TESTSPACKAGE definitions; this has been elided into bsd.tests.mk - Remove unnecessary BINDIRs used previously with ${PACKAGE}FILES; ${PACKAGE}FILESDIR is now automatically defined in bsd.test.mk. - Fix installation of files under data/ subdirectories in lib/libc/tests/hash and lib/libc/tests/net/getaddrinfo - Remove unnecessary .include <bsd.own.mk>s (some opportunistic cleanup) Document the proposed changes in share/examples/tests/tests/... via examples so it's clear that ${PACKAGES}FILES is the suggested way forward in terms of replacing FILES. share/mk/bsd.README didn't seem like the appropriate method of communicating that info. MFC after: never probably X-MFC with: r298107 PR: 209114 Relnotes: yes Tested with: buildworld, installworld, checkworld; buildworld, packageworld Sponsored by: EMC / Isilon Storage Division
* Remove useless calls to basename().ed2016-05-011-2/+1
| | | | | | | | | | | | | | There are a couple of places in the source three where we call basename() on constant strings. This is bad, because the prototype standardized by POSIX allows the implementation to use its argument as a storage buffer. This change eliminates some of these unportable calls to basename() in cases where it was only added for cosmetical reasons, namely to trim argv[0]. There's nothing wrong with setting argv[0] to the full path. Reviewed by: jilles Differential Revision: https://reviews.freebsd.org/D6093
* MFHgjb2016-03-143-0/+3
|\ | | | | | | Sponsored by: The FreeBSD Foundation
| * Fix handling of umtxp resource limit in sh(1)/ulimit(1), limits(1), addkib2016-03-123-0/+3
| | | | | | | | | | | | | | | | login.conf(5) support. Reviewed by: jilles Sponsored by: The FreeBSD Foundation Differential revision: https://reviews.freebsd.org/D5610
* | MFHgjb2016-03-101-0/+20
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * DIRDEPS_BUILD: Connect MK_TESTS.bdrewery2016-03-091-0/+20
| | | | | | | | Sponsored by: EMC / Isilon Storage Division
* | First pass through library packaging.gjb2016-02-041-0/+1
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | First pass to fix the 'tests' packages.gjb2016-02-021-0/+4
|/ | | | Sponsored by: The FreeBSD Foundation
* META MODE: Prefer INSTALL=tools/install.sh to lessen the need for xinstall.host.bdrewery2015-11-251-1/+0
| | | | | | | | This both avoids some dependencies on xinstall.host and allows bootstrapping on older releases to work due to lack of at least 'install -l' support. Sponsored by: EMC / Isilon Storage Division
* Correct posix_openpt reference in pty(3)smh2015-11-061-2/+2
| | | | | MFC after: 1 week Sponsored by: Multiplay
* Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) andngie2015-10-121-2/+0
| | | | | | | | | | | | netbsd-tests.test.mk (r289151) - Eliminate explicit OBJTOP/SRCTOP setting - Convert all ad hoc NetBSD test integration over to netbsd-tests.test.mk - Remove unnecessary TESTSDIR setting - Use SRCTOP where possible for clarity MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Divison
* Fix core corruption caused by race in note_procstat_vmmapcem2015-10-061-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | This fix is spiritually similar to r287442 and was discovered thanks to the KASSERT added in that revision. NT_PROCSTAT_VMMAP output length, when packing kinfo structs, is tied to the length of filenames corresponding to vnodes in the process' vm map via vn_fullpath. As vnodes may move during coredump, this is racy. We do not remove the race, only prevent it from causing coredump corruption. - Add a sysctl, kern.coredump_pack_vmmapinfo, to allow users to disable kinfo packing for PROCSTAT_VMMAP notes. This avoids VMMAP corruption and truncation, even if names change, at the cost of up to PATH_MAX bytes per mapped object. The new sysctl is documented in core.5. - Fix note_procstat_vmmap to self-limit in the second pass. This addresses corruption, at the cost of sometimes producing a truncated result. - Fix PROCSTAT_VMMAP consumers libutil (and libprocstat, via copy-paste) to grok the new zero padding. Reported by: pho (https://people.freebsd.org/~pho/stress/log/datamove4-2.txt) Relnotes: yes Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D3824
* Detect badly behaved coredump note helperscem2015-09-031-0/+4
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Coredump notes depend on being able to invoke dump routines twice; once in a dry-run mode to get the size of the note, and another to actually emit the note to the corefile. When a note helper emits a different length section the second time around than the length it requested the first time, the kernel produces a corrupt coredump. NT_PROCSTAT_FILES output length, when packing kinfo structs, is tied to the length of filenames corresponding to vnodes in the process' fd table via vn_fullpath. As vnodes may move around during dump, this is racy. So: - Detect badly behaved notes in putnote() and pad underfilled notes. - Add a fail point, debug.fail_point.fill_kinfo_vnode__random_path to exercise the NT_PROCSTAT_FILES corruption. It simply picks random lengths to expand or truncate paths to in fo_fill_kinfo_vnode(). - Add a sysctl, kern.coredump_pack_fileinfo, to allow users to disable kinfo packing for PROCSTAT_FILES notes. This should avoid both FILES note corruption and truncation, even if filenames change, at the cost of about 1 kiB in padding bloat per open fd. Document the new sysctl in core.5. - Fix note_procstat_files to self-limit in the 2nd pass. Since sometimes this will result in a short write, pad up to our advertised size. This addresses note corruption, at the risk of sometimes truncating the last several fd info entries. - Fix NT_PROCSTAT_FILES consumers libutil and libprocstat to grok the zero padding. With suggestions from: bjk, jhb, kib, wblock Approved by: markj (mentor) Relnotes: yes Sponsored by: EMC / Isilon Storage Division Differential Revision: https://reviews.freebsd.org/D3548
* On arm64 disable three tests that hang or panicemaste2015-08-171-0/+2
| | | | | | | | | | Each issue has a PR open to track. This workaround allows us to run the tests to investigate the failures and avoid any new regressions. PR: 202304, 202305, 202307 Reviewed by: ngie Sponsored by: The FreeBSD Foundation Differential Revision: https://reviews.freebsd.org/D3378
* Bump .Dd due to changes made in r285050 and r285053garga2015-07-021-1/+1
| | | | | Spotted by: loos Approved by: loos
* Improve pw_lock.3 text changed in r285050garga2015-07-021-2/+2
| | | | | Suggested by: wblock Approved by: gnn
* When passwd or group information is changed (by pw, vipw, chpass, ...)garga2015-07-023-4/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | temporary file is created and then a rename() call move it to official file. This operation didn't have any check to make sure data was written to disk and if a power cycle happens system could end up with a 0 length passwd or group database. There is a pfSense bug with more infor about it: https://redmine.pfsense.org/issues/4523 The following changes were made to protect passwd and group operations: * lib/libutil/gr_util.c: - Replace mkstemp() by mkostemp() with O_SYNC flag to create temp file - After rename(), fsync() call on directory for faster result * lib/libutil/pw_util.c - Replace mkstemp() by mkostemp() with O_SYNC flag to create temp file * usr.sbin/pwd_mkdb/pwd_mkdb.c - Added O_SYNC flag on dbopen() calls - After rename(), fsync() call on directory for faster result * lib/libutil/pw_util.3 - pw_lock() returns a file descriptor to master password file on success Differential Revision: https://reviews.freebsd.org/D2978 Approved by: bapt Sponsored by: Netgate
* new dependssjg2015-06-161-0/+1
|
* Revert r284417 it is not necessary anymorebapt2015-06-151-1/+1
|
* Enforce overwritting SHLIBDIRbapt2015-06-151-1/+1
| | | | | | | | | Since METAMODE has been added, sys.mk loads bsd.mkopt.mk which ends load loading bsd.own.mk which then defines SHLIBDIR before all the Makefile.inc everywhere. This makes /lib being populated again. Reported by: many
* Add META_MODE support.sjg2015-06-131-0/+19
|\ | | | | | | | | | | | | | | | | | | | | Off by default, build behaves normally. WITH_META_MODE we get auto objdir creation, the ability to start build from anywhere in the tree. Still need to add real targets under targets/ to build packages. Differential Revision: D2796 Reviewed by: brooks imp
| * dirdeps.mk now sets DEP_RELDIRsjg2015-06-081-2/+0
| |
| * Merge sync of headsjg2015-05-273-19/+13
| |\
| * \ Merge from head@274682sjg2014-11-1910-10/+1423
| |\ \
| * \ \ Merge head from 7/28sjg2014-08-198-14/+18
| |\ \ \
| * | | | Updated dependenciessjg2014-05-161-1/+1
| | | | |
| * | | | Updated dependenciessjg2014-05-101-0/+2
| | | | |
| * | | | Merge from headsjg2014-05-082-2/+2
| |\ \ \ \
| * \ \ \ \ Merge headsjg2014-04-275-6/+17
| |\ \ \ \ \
| * \ \ \ \ \ Merge head@256284sjg2013-10-132-37/+54
| |\ \ \ \ \ \
| * \ \ \ \ \ \ Merge from headsjg2013-09-057-29/+24
| |\ \ \ \ \ \ \
| * \ \ \ \ \ \ \ sync from headsjg2013-04-124-90/+140
| |\ \ \ \ \ \ \ \
| * | | | | | | | | Updated dependenciessjg2013-03-111-0/+1
| | | | | | | | | |
| * | | | | | | | | Updated dependenciessjg2013-02-161-2/+0
| | | | | | | | | |
| * | | | | | | | | Sync with HEAD.obrien2013-02-083-46/+83
| |\ \ \ \ \ \ \ \ \
| * | | | | | | | | | Updated/new Makefile.dependsjg2012-11-081-0/+3
| | | | | | | | | | |
| | | | | | | | | | |
| | \ \ \ \ \ \ \ \ \
| | \ \ \ \ \ \ \ \ \
| | \ \ \ \ \ \ \ \ \
| *---. \ \ \ \ \ \ \ \ \ Sync from headsjg2012-11-0410-137/+327
| |\ \ \ \ \ \ \ \ \ \ \ \
| * | | | | | | | | | | | | Sync FreeBSD's bmake branch with Juniper's internal bmake branch.marcel2012-08-221-0/+17
| | |_|/ / / / / / / / / / | |/| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Requested by: Simon Gerraty <sjg@juniper.net>
* | | | | | | | | | | | | List kinfo_getfile.c only once.brooks2015-06-101-1/+1
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | MFC after: 3 days Sponsored by: DARPA, AFRL
OpenPOWER on IntegriCloud