summaryrefslogtreecommitdiff
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
...
* MFC r318303:Konstantin Belousov2017-05-291-9/+7
| | | | | | | Style. Notes: svn path=/stable/10/; revision=319131
* MFC r318299:Konstantin Belousov2017-05-291-44/+31
| | | | | | | Simplify cleanup on failure in realpath(3). Notes: svn path=/stable/10/; revision=319130
* MFC r318298:Konstantin Belousov2017-05-291-19/+27
| | | | | | | | | Fix several buffer overflows in realpath(3), and other minor issues. PR: 219154 Notes: svn path=/stable/10/; revision=319129
* MFC r317660, r317710Brooks Davis2017-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 Notes: svn path=/stable/10/; revision=318327
* MFC r317845-r317846Brooks Davis2017-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 Notes: svn path=/stable/10/; revision=318323
* MFC r306771:Bryan Drewery2017-05-091-1/+1
| | | | | | | Improve grammar. Notes: svn path=/stable/10/; revision=318071
* MFC r317707:Brooks Davis2017-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 Notes: svn path=/stable/10/; revision=318030
* MFC r317611:Konstantin Belousov2017-05-071-5/+1
| | | | | | | Make semaphore names list mutex non-recursive. Notes: svn path=/stable/10/; revision=317900
* MFC r317610:Konstantin Belousov2017-05-071-12/+10
| | | | | | | Restructure normal (non-error) control flow in sem_close(). Notes: svn path=/stable/10/; revision=317899
* MFC r317606:Konstantin Belousov2017-05-071-22/+24
| | | | | | | Style. Notes: svn path=/stable/10/; revision=317898
* MFC r317436:Konstantin Belousov2017-05-031-1/+1
| | | | | | | getpagesize(3) cannot fail. Notes: svn path=/stable/10/; revision=317735
* MFC r317064: Optimize pathologic case of telldir() for Samba.Alexander Motin2017-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. Notes: svn path=/stable/10/; revision=317634
* MFC r316768:Brooks Davis2017-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 Notes: svn path=/stable/10/; revision=317392
* MFC r316739:Konstantin Belousov2017-04-191-6/+3
| | | | | | | Fix reporting of _SC_SEM_NSEMS_MAX and _SC_SEM_VALUE_MAX. Notes: svn path=/stable/10/; revision=317131
* MFC r315734:Enji Cooper2017-03-301-5/+5
| | | | | | | style(9): sort #includes Notes: svn path=/stable/10/; revision=316216
* MFC r315187:Pedro F. Giffuni2017-03-161-1/+1
| | | | | | | | | libc: mall cleanup. Let calloc(3) do the multiplication. Notes: svn path=/stable/10/; revision=315415
* MFC r314954:Enji Cooper2017-03-161-1/+1
| | | | | | | style(9): sort the #includes Notes: svn path=/stable/10/; revision=315358
* MFC r315225:Xin LI2017-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 Notes: svn path=/stable/10/; revision=315227
* MFC r314807:Enji Cooper2017-03-131-1/+1
| | | | | | | Move ATF_TC_WITHOUT_HEAD(getgrent) near the testcase it annotates Notes: svn path=/stable/10/; revision=315185
* MFC r314055Eric van Gyzen2017-03-101-58/+54
| | | | | | | | | Make several improvements and corrections in the kenv(2) man page Sponsored by: Dell EMC Notes: svn path=/stable/10/; revision=315024
* MFC r314450,r313439:Enji Cooper2017-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> Notes: svn path=/stable/10/; revision=314817
* MFC r313378,r313379:Enji Cooper2017-02-141-10/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | r313378: Wrap strcmp/wcscmp calls with ATF_CHECK_MSG and drop atf_tc_fail use The reasoning here was the same as what was done in r313376: - Gather as many results as possible instead of failing early and not testing the rest of the cases. - Simplify logic when checking test inputs vs outputs and printing test result. r313379: Expect :int_within_limits to fail when ptrdiff_t/*intmax_t differ in base type The %t{d,u} (ptrdiff_t) tests fail for the following reasons: - ptrdiff_t is by definition int32_t on !LP64 architectures and int64_t on LP64 architectures. - intmax_t is by definition fixed to int64_t on all architectures. - Some of the code in lib/libc/stdio/... is promoting ptrdiff_t to *intmax_t when parsing/representing the value. PR: 191674 Notes: svn path=/stable/10/; revision=313723
* MFC r313376:Enji Cooper2017-02-141-11/+8
| | | | | | | | | | | | | | | | | | | Fix :hexadecimal_floating_point on i386 Don't exclude i386 from LDBL_MANT_DIG == 64; it works properly in that case. While here, replace strcmp + atf_tc_fail with ATF_CHECK_MSG for 2 reasons: - Gather as many results as possible instead of failing early and not testing the rest of the cases. - Simplify logic when checking test inputs vs outputs and printing test result. Tested on: amd64, i386 Notes: svn path=/stable/10/; revision=313720
* MFC r313174: Clean up documentation of AF_UNIX control messages.Jilles Tjoelker2017-02-121-51/+4
| | | | | | | | | | | | | Document AF_UNIX control messages in unix(4) only, not split between unix(4) and recv(2). Also, warn about LOCAL_CREDS effective uid/gid fields, since the write could be from a setuid or setgid program (with the explicit SCM_CREDS and LOCAL_PEERCRED, the credentials are read at such a time that it can be assumed that the process intends for them to be used in this context). Notes: svn path=/stable/10/; revision=313685
* MFC r311925,r311968,r311969,r312008:Enji Cooper2017-02-104-2/+26
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | r311925: Import testcase updates with code contributed back to NetBSD This also (inadvertently) contains an update to contrib/netbsd-tests/lib/libc/sys/t_wait.c (new testcases). In collaboration with: christos@NetBSD.org r311968: Fix lib/libc/sys/access_test after r311925 sys/param.h needs to be #included in order for __FreeBSD_version to be checked r311969: Remove __HAVE_LONG_DOUBLE #define from t_strtod.c and place it in Makefile This is to enable support in other testcases Inspired by lib/msun/tests/Makefile . r312008: Upgrade NetBSD tests to 01.11.2017_23.20 snapshot This contains some new testcases in /usr/tests/...: - .../lib/libc - .../lib/libthr - .../lib/msun - .../sys/kern Tested on: amd64, i386 Notes: svn path=/stable/10/; revision=313535
* MFC r306349:Enji Cooper2017-02-101-4/+9
| | | | | | | | | | | | | | r306349 (by pfg): hash(3): protect in-memory page when using cross-endianness. When writing out pages in the "other endian" format, make a copy instead of trashing the in-memory one. Obtained from: NetBSD (CVS rev. 1.29) Notes: svn path=/stable/10/; revision=313532
* MFC r309373:Enji Cooper2017-02-102-0/+117
| | | | | | | | | | | | | r309373 (by bdrewery): Fix setrlimit_test:setrlimit_memlock when the system has exceeded vm.max_wired. This uses the same fix as r294894 did for the mlock test. The code from that commit is moved into a common object file which PROGS supports building first. Notes: svn path=/stable/10/; revision=313517
* MFC r305358,r305449,r305451,r306367,r306397,r309474:Enji Cooper2017-02-107-3/+13
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | This also contains a merge of ^/projects/netbsd-tests-update-12@r304035 . This change never hit ^/head because bin/cat's behavior was changed (on ^/head) to match NetBSD. PR: 210607 r305358: Update contrib/netbsd-tests with new content from NetBSD This updates the snapshot from 09/30/2014 to 08/11/2016 This brings in a number of new testcases from upstream, most notably: - bin/cat - lib/libc - lib/msun - lib/libthr - usr.bin/sort lib/libc/tests/stdio/open_memstream_test.c was moved to lib/libc/tests/stdio/open_memstream2_test.c to accomodate the new open_memstream test from NetBSD. Tested on: amd64 (VMware fusion VM; various bare metal platforms); i386 (VMware fusion VM); make tinderbox r305449: Install h_db to unbreak some of the lib/libc/db testcases after r305358 r305451: Fix lib/libc/rpc test assumptions added in r305358 - Require root in the tcp/udp subtests (it's needed on FreeBSD when registering services). - Skip the tests if service registration fails. r306367 (by br): Allow up to 6 arguments only on MIPS. r306397 (by br): Use right piece of code for FreeBSD. r309474: Don't build :strvis_locale if VIS_NOLOCALE is undefined The copy of contrib/libc-vis on ^/stable/10 doesn't contain all of the features in the ^/stable/11 // ^/head version, including VIS_NOLOCALE. The risk is lower in conditionally running the test instead of backporting the newer version of libc-vis Notes: svn path=/stable/10/; revision=313498
* MFC r296586:Enji Cooper2017-02-091-0/+1
| | | | | | | | | r296586 (by bdrewery): Fix and connect setjmp test. Notes: svn path=/stable/10/; revision=313489
* MFC r289172,r290254:Enji Cooper2017-02-0925-60/+7
| | | | | | | | | | | | | | | | | | | r289172: Refactor the test/ Makefiles after recent changes to bsd.test.mk (r289158) and 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 r290254: Remove unused variable (SRCDIR) Notes: svn path=/stable/10/; revision=313488
* MFC r276527:Enji Cooper2017-02-091-0/+4
| | | | | | | | | | | | | | Don't install h_raw if dealing with clang 3.5.0+ to unbreak the tests2 Jenkins job The h_raw application doesn't do proper bounds checking without the option being supplied via the build, which means that it doesn't throw signals and fail as expected PR: 196430 Notes: svn path=/stable/10/; revision=313482
* MFC r277648:Enji Cooper2017-02-091-1/+2
| | | | | | | | | | | r277648 (by jilles): Enable utimensat tests from NetBSD. As with other tests from c063, a required #include <sys/stat.h> was missing. Notes: svn path=/stable/10/; revision=313481
* MFC r283584:Enji Cooper2017-02-092-11/+17
| | | | | | | | | | | | | | | | | Relnotes: yes r283584 (by emaste): memmem(3): empty little string matches the beginning of the big string This function originated in glibc, and this matches their behaviour (and NetBSD, OpenBSD, and musl). An empty big string (arg "l") is handled by the existing l_len < s_len test. Notes: svn path=/stable/10/; revision=313480
* MFC r279154,r279397:Enji Cooper2017-02-092-9/+43
| | | | | | | | | | | | | | | | | | | | | | | | | r279154 (by jilles): nice(): Correct return value and [EPERM] error. PR: 189821 Obtained from: NetBSD Relnotes: yes r279397 (by jilles): nice(): Put back old return value, keeping [EPERM] error. Commit r279154 changed the API and ABI significantly, and {NZERO} is still wrong. Also, preserve errno on success instead of setting it to 0. PR: 189821 Relnotes: yes Notes: svn path=/stable/10/; revision=313479
* MFC r312332:Enji Cooper2017-02-041-1/+1
| | | | | | | | Use SRCTOP where possible and use :H to manipulate .CURDIR to get rid of unnecessarily long relative path .PATH values with make Notes: svn path=/stable/10/; revision=313221
* MFC r311651:Konstantin Belousov2017-01-215-106/+164
| | | | | | | Export __cxa_thread_atexit_impl as an alias for __cxa_thread_atexit. Notes: svn path=/stable/10/; revision=312590
* MFC r310984,r311102:Enji Cooper2017-01-091-8/+4
| | | | | | | | | | | | | r310984: Use calloc instead of malloc + memset(.., 0, ..) r311102 (by pfg): Cleanup inelegant calloc(3) introduced in r310984. Notes: svn path=/stable/10/; revision=311718
* MFC r309650:Ed Schouten2016-12-202-2/+9
| | | | | | | | | | | | Properly sign extend the result of jrand48() and mrand48(). These functions are supposed to return a value between [-2^31, 2^31). This doesn't seem to work on 64-bit systems, where we return a value between [0, 3^32). Patch up the function to use proper casts to int32_t. While there, fix some other style bugs. Notes: svn path=/stable/10/; revision=310320
* Merge rr309688: address regressions in SA-16:37.libc.Gleb Smirnoff2016-12-071-6/+5
| | | | | | | | PR: 215105 Submitted by: <jtd2004a sbcglobal.net> Notes: svn path=/stable/10/; revision=309690
* Merge r309639 from head:Gleb Smirnoff2016-12-061-17/+34
| | | | | | | | | | | | | | Fix possible buffer overflow(s) in link_ntoa(3). A specially crafted sockaddr_dl argument can trigger a static buffer overflow in the libc library, with possibility to rewrite with arbitrary data following static buffers that belong to other library functions. Reviewed by: kib Security: FreeBSD-SA-16:37.libc Notes: svn path=/stable/10/; revision=309645
* MFstable/11 r309600:Enji Cooper2016-12-061-2/+2
| | | | | | | | | | MFC r307220: r307220 (by br): Fix typos: use correct string format and value to compare. Notes: svn path=/stable/10/; revision=309601
* MFC r309026: open(2): Clarify non-POSIX error when opening a symlink withJilles Tjoelker2016-12-041-1/+17
| | | | | | | | | | | | | O_NOFOLLOW. We return [EMLINK] instead of [ELOOP] when trying to open a symlink with O_NOFOLLOW, so that the original case of [ELOOP] can be distinguished. Code like cmp -h and xz takes advantage of this. PR: 214633 Notes: svn path=/stable/10/; revision=309536
* MFC r264196:Enji Cooper2016-12-032-2/+5
| | | | | | | | | | r264196 (by theraven): Move definitions out of rpc_com so that the linker doesn't complain about multiple definitions. Notes: svn path=/stable/10/; revision=309507
* MFC r296133:Enji Cooper2016-12-032-3/+3
| | | | | | | | | | | | | | r296133 (by pfg): RPC: update the getrpcbyname() definition to include a const qualifier. Add const qualifier making getrpcbyname() and getrpcbyname_r() prototypes match those used in latest Sun RPC code (TI-RPC 2.3). Obtained from: NetBSD Notes: svn path=/stable/10/; revision=309502
* MFC r301734:Enji Cooper2016-12-031-1/+1
| | | | | | | | | r301734 (by kevlo): Fix the rpcb_getaddr() definition to match its declaration. Notes: svn path=/stable/10/; revision=309501
* MFC r296404:Enji Cooper2016-12-031-8/+8
| | | | | | | | | | | r296404 (by pfg): Stray tabs and spaces. No functional change. Notes: svn path=/stable/10/; revision=309500
* MFC r287353:Enji Cooper2016-12-031-1/+1
| | | | | | | | | | | r287353 (by rodrigc): Use unsigned variable. Eliminates gcc 4.9 compiler warning. Notes: svn path=/stable/10/; revision=309499
* MFC r296386:Enji Cooper2016-12-031-16/+20
| | | | | | | | | | | | | | r296386 (by pfg): Work around aliasing issues detected in modern GCC. Avoid casting gymnastics that lead to pointer aliasing by introducing an inline function as done in NetBSD (but without #if0'd WIP code). Obtained from: NetBSD (CVS Rev. 1.24, 1.25) Notes: svn path=/stable/10/; revision=309498
* MFC r278039:Enji Cooper2016-12-031-0/+1
| | | | | | | | | | | r278039 (by pfg): Resource leak CID: 1016703 Notes: svn path=/stable/10/; revision=309497
* MFC r288017:Enji Cooper2016-12-031-69/+31
| | | | | | | | | | | r288017 (by rodrigc): Use ANSI C prototypes. Eliminates gcc 4.9 warnings. Notes: svn path=/stable/10/; revision=309496