summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
* MFC r290909:ngie2015-11-232-0/+239
| | | | | | Add some initial tests for SLIST and STAILQ macros Sponsored by: EMC / Isilon Storage Division
* MFC r290532,r290561,r290843,r290844,r290845:ngie2015-11-2318-1/+2405
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r290532: Integrate tools/regression/lib/libc/locale into the FreeBSD test suite as lib/libc/tests/locale Sponsored by: EMC / Isilon Storage Division r290561: Delete leftover printfs from when these were TAP tests Sponsored by: EMC / Isilon Storage Division r290843: Polish up the tests a bit more after projects/collation was merged to head Provide more meaningful diagnostic messages if LC_CTYPE can't be set properly instead of segfaulting, because setlocale returns NULL and strcmp(NULL, b) will always segfault Split up the testcases so one failing (in this case en_US.ISO8859-15) won't cause the rest of the testcases to be skipped Remove some unused variables Sponsored by: EMC / Isilon Storage Division r290844: Polish up iswctype_test - Split up the testcases into C locale and ja_JP.eucJP testcases. - Avoid a segfault in the event that setlocale fails, similar to r290843 - Replace `sizeof(x) / sizeof(*x)` pattern with `nitems(x)` Sponsored by: EMC / Isilon Storage Division r290845: Remove unused variables; sort by alignment where needed Sponsored by: EMC / Isilon Storage Division
* MFC r290563,r290868,r291038:ngie2015-11-235-9/+427
| | | | | | | | | | | | | | | | | | | | | | | | | | | r290563: Integrate tools/regression/lib/libc/net into the FreeBSD test suite as lib/libc/tests/net Also, fix eui64_aton_test:test_str(..). The test was comparing the result of eui64_aton to a pointer of the expected result. Sponsored by: EMC / Isilon Storage Division r290868: Fix -Wformat issues Reported by: gcc Sponsored by: EMC / Isilon Storage Division r291038: Do not print out errno if the call succeeded unexpectedly; this was a mistake made in r290868 Reported by: jilles Sponsored by: EMC / Isilon Storage Division
* MFC: r290549,r290729ache2015-11-191-22/+7
| | | | | | | | | | | | | | r290549: Reorganize code to elimitate one _sseek() call for append modes. r290729: 1) Remove my overcomplicated error fallback and just return error immediatelly as old code does, now for append modes too. Real use case for such fallback is impossible (unless specially crafted). 2) Remove now unneded include I forgot to remove in prev. commits.
* MFC r290253:ngie2015-11-1610-49/+25
| | | | | | | Remove unnecessary `if (x)` tests before calling `free(x)`; free(3) already employs this check Sponsored by: EMC / Isilon Storage Division
* MFC r290255:ngie2015-11-163-37/+37
| | | | | | | Add _test suffix to multiple tests in lib/libc to conform to the design noted in the FreeBSD Test Suite wiki Sponsored by: EMC / Isilon Storage Division
* MFC r289195:ngie2015-11-152-1/+3
| | | | | | | | | | | | | | | | | | | | | | Integrate the tests from lib/libarchive, usr.bin/cpio, and usr.bin/tar in to the FreeBSD test suite functional_test.sh was ported from bin/sh/tests/functional_test.sh, as a small wrapper around libarchive_test, bsdcpio_test, and bsdtar_test provided by upstream. A handful of testcases in lib/libarchive/tests have been disabled as they were failing when run with kyua test (see BROKEN_TESTS in lib/libarchive/tests/Makefile) As a sidenote: this removes the check/test targets from the Makefiles as they don't match the pattern used in the rest of the FreeBSD test suite. Sponsored by: EMC / Isilon Storage Division Conflicts: lib/libarchive/test usr.bin/cpio/test
* MFC r290571:ngie2015-11-151-6/+3
| | | | | | | | | Fix some TAP -> ATF conversion errors - Remove a leftover printf from when this was a TAP based testcase - Catch mmap failures properly Sponsored by: EMC / Isilon Storage Division
* MFC r290538:ngie2015-11-155-2/+492
| | | | | | | | | | Integrate tools/regression/lib/libc/stdlib into the FreeBSD test suite as lib/libc/tests/stdlib - Make the code a bit more style(9) compliant - Convert a sizeof(x)/sizeof(x[0]) to nitems Sponsored by: EMC / Isilon Storage Division
* MFC r290539:ngie2015-11-155-1/+554
| | | | | | | Integrate tools/regression/lib/libc/string into the FreeBSD test suite as lib/libc/tests/string Sponsored by: EMC / Isilon Storage Division
* MFC r290177:ngie2015-11-091-0/+1
| | | | | | | | | | Integrate contrib/netbsd-tests/lib/libc/rpc into the FreeBSD test suite as lib/libc/rpc This testcase requires rpcbind be up in running; otherwise the testcases will time out and be skipped Sponsored by: EMC / Isilon Storage Division
* MFC r290179:ngie2015-11-091-2/+1
| | | | | | Remove a set but unused variable in __getgroupmembership to fix a gcc 4.9+ warning Sponsored by: EMC / Isilon Storage Division
* MFC: r289863,r289931,r290110,r290230,r290231,r290232ache2015-11-087-23/+37
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r290232: Microoptimize. r290231: Addition to prev. commit. In some edge cases fp->_p can be changed in _sseek(), recalculate. r290230: Don't seek to the end if write buffer is empty (in append modes). PR: 204156 r290110: Add _flags2 per jhb@ suggestion since no room left in _flags. Rewrite O_APPEND flag checking using new __S2OAP flag. r289931: According to POSIX, a write operation shall start at the current size of the stream (if mode had 'a' as the first character). r289863: Since no room left in the _flags, reuse __SALC for O_APPEND. It helps to remove _fcntl() call from _ftello() and optimize seek position calculation in _swrite().
* MFC 289636:jhb2015-11-061-2/+2
| | | | Switch pl_child_pid from int to pid_t.
* MFC r288309: fnmatch(): Remove exponential behaviour as in sh r229201.jilles2015-10-251-28/+49
| | | | | | The old code was exponential in the number of asterisks in the pattern. However, once a match has been found upto the next asterisk, the previous asterisks are no longer relevant.
* MFC r288430: wordexp: Rewrite to make WRDE_NOCMD reliable.jilles2015-10-252-93/+160
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Shell syntax is too complicated to detect command substitution and unquoted operators reliably without implementing much of sh's parser. Therefore, have sh do this detection. While changing sh's support anyway, also read input from a pipe instead of arguments to avoid {ARG_MAX} limits and improve privacy, and output count and length using 16 instead of 8 digits. The basic concept is: execl("/bin/sh", "sh", "-c", "freebsd_wordexp ${1:+\"$1\"} -f "$2", "", flags & WRDE_NOCMD ? "-p" : "", <pipe with words>); The WRDE_BADCHAR error is still implemented in libc. POSIX requires us to fail strings containing unquoted braces with code WRDE_BADCHAR. Since this is normally not a syntax error in sh, there is still a need for checking code in libc, we_check(). The new we_check() is an optimistic check that all the characters <newline> | & ; < > ( ) { } are quoted. To avoid duplicating too much sh logic, such characters are permitted when quoting characters are seen, even if the quoting characters may themselves be quoted. This code reports all WRDE_BADCHAR errors; bad characters that get past it and are a syntax error in sh return WRDE_SYNTAX. Although many implementations of WRDE_NOCMD erroneously allow some command substitutions (and ours even documented this), there appears to be code that relies on its security (codesearch.debian.net shows quite a few uses). Passing untrusted data to wordexp() still exposes a denial of service possibility and a fairly large attack surface. This is also a MFC of r286830 to reduce conflicts. I changed the code somewhat to avoid changes from r286941; in particular, WRDE_BADVAL can still only be returned if WRDE_UNDEF was passed. Relnotes: yes Security: fixes command execution with wordexp(untrusted, WRDE_NOCMD)
* MFC 287386,288949,288993:jhb2015-10-231-1/+24
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Export current system call code and argument count for system call entry and exit events. To preserve the ABI, the new fields are moved to the end of struct thread in these branches (unlike HEAD) and explicitly copied when new threads are created. In addition, the new tests are only added in 10. r287386: Export current system call code and argument count for system call entry and exit events. procfs stop events for system call tracing report these values (argument count for system call entry and code for system call exit), but ptrace() does not provide this information. (Note that while the system call code can be determined in an ABI-specific manner during system call entry, it is not generally available during system call exit.) The values are exported via new fields at the end of struct ptrace_lwpinfo available via PT_LWPINFO. r288949: Fix various edge cases related to system call tracing. - Always set td_dbg_sc_* when P_TRACED is set on system call entry even if the debugger is not tracing system call entries. This ensures the fields are valid when reporting other stops that occur at system call boundaries such as for PT_FOLLOW_FORKS or when only tracing system call exits. - Set TDB_SCX when reporting the stop for a new child process in fork_return(). This causes the event to be reported as a system call exit. - Report a system call exit event in fork_return() for new threads in a traced process. - Copy td_dbg_sc_* to new threads instead of zeroing. This ensures that td_dbg_sc_code in particular will report the system call that created the new thread or process when it reports a system call exit event in fork_return(). - Add new ptrace tests to verify that new child processes and threads report system call exit events with a valid pl_syscall_code via PT_LWPINFO. r288993: Document the recently added pl_syscall_* fields in struct ptrace_lwpinfo.
* MFC 288833:jgh2015-10-141-7/+6
| | | | | | | | | PR: 203440 (based on) Submitted by: ceratv@rpi.edu Approved by: wblock@ (mentor) Differential Revision: https://reviews.freebsd.org/D3813 - address grammar
* MFC r288199,r288246:bdrewery2015-10-031-0/+2
| | | | Add missing CLEANFILES.
* MFC 286177:jhb2015-10-011-3/+3
| | | | Fix a couple of markup typos.
* MFC r288092:bdrewery2015-09-291-2/+0
| | | | | Avoid adding duplicates into OBJS. bsd.lib.mk already handles adding entries to OBJS based on SRCS.
* MFC r285428alc2015-09-271-4/+4
| | | | Correct the description of MADV_DONTNEED.
* Long overdue MFC r284377:jlh2015-09-221-8/+5
| | | | | | | | | | | | | NetBSD commit log: Use a constant array for the MIB. Newer LLVM decided that mib[] warranted stack protections, with the obvious crash after the setup was done. As a positive side effect, code size shrinks a bit. I'm not sure why this hasn't bitten us yes, but it is certainly possible and there are no real drawbacks to this change anyway. Submitted by: pfg Obtained from: NetBSD
* MFC 287349,287404:hrs2015-09-131-7/+15
| | | | | | | | | - Print sdl->sdl_data when sdl->sdl_nlen > 0 && sdl->sdl_alen == 0 as link_ntoa(3) does. - snprintf() returns at most size-1 of the chars printed into the buffer. (n == hostlen) also means the buffer length was too short.
* MFC 287595:hrs2015-09-131-12/+8
| | | | | | | - Fix SIGSEGV when sa == NULL. NULL check in getnameinfo_inet() did not work as expected. - Simplify afdl table lookup.
* MFC r287360:kib2015-09-081-1/+1
| | | | | Fix t_spawnattr test for attributes handling by posix_spawn(3). Connect it to the build.
* MFC r287093:delphij2015-09-081-1/+1
| | | | | | | Instead of doing an no-op (|= 0), actually clear the flags in acl_clear_flags_np. Reported by: Pascal Drecker <pascal freebsd drecker com>
* MFC r287292:kib2015-09-0522-121/+104
| | | | | | | | | | Switch libc from using _sig{procmask,action,suspend} symbols, which are aliases for the syscall stubs and are plt-interposed, to the libc-private aliases of internally interposed sigprocmask() etc. MFC r287300: Use libthr interposed functions instead of syscalls, in posix_spawn()' child.
* MFC: r286490,r286491,r287125bapt2015-09-021-16/+6
| | | | | | | | | Per rfc3629 value greater than 0x10ffff should be rejected (r286490,r286491) Make UTF-8 parsing and generation more strict. (r287125 by ed) - in mbrtowc() we need to disallow codepoints above 0x10ffff. - In wcrtomb() we need to disallow codepoints between 0xd800 and 0xdfff.
* MFC r286910:delphij2015-09-011-10/+5
| | | | | | | | - ANSIfy - Remove the redundant _PATH_RSH definition (paths.h at r96194); - Use pid_t for PIDs - Note that we are at the same level of OpenBSD's counterpart of revision 1.7 (r94757).
* MFC r279084,280713: setmode(): Use sysctl kern.proc.umask instead of umask()jilles2015-08-291-9/+33
| | | | | | | | | if possible. The kern.proc.umask.<pid> sysctl allows querying the umask without temporarily modifying it. r280713 is the actual change, while r279084 is a whitespace change.
* MFC r286975:kib2015-08-271-2/+6
| | | | Remove the wrong asserts.
* MFC r284649: fts_children: preserve errno after running close/fchdirjilles2015-08-091-5/+8
| | | | | PR: 200942 Submitted by: Conrad Meyer
* Implement x86 ptrace(2) requests PT_{GET,SET}{FS,GS}BASE.kib2015-08-051-2/+189
| | | | | | | | | | | | | | | | | | | | | | MFC r284918: Add helper fill_based_sd(9). MFC r284919: Add x86 PT_GETFSBASE, PT_GETGSBASE machine-depended ptrace requests to obtain the thread %fs and %gs bases. Add x86 PT_SETFSBASE and PT_SETGSBASE requests to set the bases from debuggers. The set requests, similarly to the sysarch({I386,AMD64}_SET_FSBASE), override the corresponding segment registers. MFC r284965: Document x86 machine-specific ptrace(2) requests. MFC r285011: Disallow a debugger on 64bit system to set fs/gs bases of the 32bit process beyond the end of the process address space. MFC r285104: Grammar and language fixes.
* MFC r285873:trasz2015-08-022-24/+2
| | | | | | | Update Capsicum and Mandatory Access Control manual pages to no longer claim they are experimental. Sponsored by: The FreeBSD Foundation
* MFC r285251:trasz2015-08-021-3/+3
| | | | | | Fix markup. Sponsored by: The FreeBSD Foundation
* MFC r285188:pkelsey2015-07-151-2/+14
| | | | | | | | Fix sysctl(3) so it returns the intended values for all mib names in the 'user' sysctl tree, which have all been coming back 0 or empty since r240176. Approved by: re
* MFH (r275020): partial fix for getgrouplist() in group_compat casedes2015-07-091-9/+16
| | | | | PR: 190055 Approved by: re (marius)
* MFC r284229: Add support for '_' occurring at the beginning orume2015-06-181-3/+3
| | | | | | | end of a name component. PR: 176093 Submitted by: landonf__at__bikemonkey.org
* MFC r264038 (theraven):delphij2015-06-172-9/+9
| | | | | | | | Fix an issue where the locale and rune locale could become out of sync, causing mb* functions (and similar) to be called with the wrong data (possibly a null pointer, causing a crash). PR: standards/188036
* MFC r284386:tuexen2015-06-171-2/+2
| | | | Fix name of a constant.
* MFC 281887:jhb2015-06-027-7/+7
| | | | | Reassign copyright statements on several files from Advanced Computing Technologies LLC to Hudson River Trading LLC.
* MFC 282417:jhb2015-06-021-7/+19
| | | | | | | | | | | | | | | | Various updates to the ftruncate(2) documentation: - Note that ftruncate(2) can operate on shared memory objects and cross reference shm_open(2). - Note that ftruncate(2) does not change the file position pointer (aka seek pointer) of the file descriptor. - ftruncate(2) will fail with EINVAL for all sorts of other fd types than just sockets, so instead note that it fails for all but regular files and shared memory objects. - Note that ftruncate(2) also appeared in 4.2BSD along with truncate(2). (Or at least the manpage for both appeared in 4.2, I did not check the kernel code itself to see if either predated 4.2.) PR: 199472
* MFC 282416:jhb2015-06-021-4/+4
| | | | | | | | Partially revert r255486, the first argument to socketpair() is a socket domain, not a file descriptor. Use 'domain' instead of the original 'd' for this argument to match socket(2). PR: 199491
* MFC 282552:jhb2015-06-021-7/+1
| | | | | Remove the note about seekdir() removing telldir() cookies. That was removed back in r269204.
* MFC 281170:jhb2015-06-021-2/+2
| | | | | | | vfork() first appeared in 3BSD which pre-dates 2.9BSD. Verified via the copy of 3BSD on disc 1 of "The CSRG Archives". PR: 198612
* MFC r281884:tuexen2015-05-291-3/+3
| | | | | | A complete user message is signalled with the MSG_EOR flag, not the MSG_EOF flag. Thanks to Valentin Nechayev for reporting the issue.
* MFC r280782:tuexen2015-05-291-0/+1
| | | | | | | | Add an SCTP symbol which was missed in https://svnweb.freebsd.org/base?view=revision&revision=169622 This fixes https://bugs.freebsd.org/bugzilla/show_bug.cgi?id=197783 Thanks to Jukka Ukkonen for reporting the bug and providing a fix.
* MFC r279859:tuexen2015-05-291-0/+3
| | | | Add a SCTP socket option to limit the cwnd for each path.
* MFC r275857:tuexen2015-05-291-1/+4
| | | | | | | Initilize the msg_flags field consistently in all code paths. Reported by: Coverity CID: 1018726
OpenPOWER on IntegriCloud