summaryrefslogtreecommitdiffstats
path: root/lib/libc
Commit message (Collapse)AuthorAgeFilesLines
...
| * rpc: fix failure to clear string by passing the wrong size to memset.pfg2016-02-261-1/+1
| | | | | | | | | | | | | | Noted by NetBSD's PR/21014 Obtained from: NetBSD (CVS Rev. 1.24, 1.25) MFC after: 1 month
| * Convert casperd(8) daemon to the libcasper.oshogbo2016-02-251-2/+2
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | After calling the cap_init(3) function Casper will fork from it's original process, using pdfork(2). Forking from a process has a lot of advantages: 1. We have the same cwd as the original process. 2. The same uid, gid and groups. 3. The same MAC labels. 4. The same descriptor table. 5. The same routing table. 6. The same umask. 7. The same cpuset(1). From now services are also in form of libraries. We also removed libcapsicum at all and converts existing program using Casper to new architecture. Discussed with: pjd, jonathan, ed, drysdale@google.com, emaste Partially reviewed by: drysdale@google.com, bdrewery Approved by: pjd (mentor) Differential Revision: https://reviews.freebsd.org/D4277
| * DIRDEPS_BUILD: Regenerate without local dependencies.bdrewery2016-02-241-153/+0
| | | | | | | | | | | | | | | | These are no longer needed after the recent 'beforebuild: depend' changes and hooking DIRDEPS_BUILD into a subset of FAST_DEPEND which supports skipping 'make depend'. Sponsored by: EMC / Isilon Storage Division
| * db(3): Fix aliasing warnings from modern GCC.pfg2016-02-241-3/+2
| | | | | | | | | | | | While here also drop a malloc cast. Obtained from: NetBSD (CVS Rev. 1.18 - 1.20)
| * db(3): Fix aliasing warnings from modern GCC.pfg2016-02-241-6/+12
| | | | | | | | Obtained from: NetBSD (CVS Rev. 1.20)
* | MFHgjb2016-02-231-1/+5
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * If we close or sync a hash-based db file, make sure to call fsync todwmalone2016-02-231-1/+5
| | | | | | | | | | | | | | | | | | make sure the changes are on disk. The people at pfSense noticed that it didn't always make it to the disk soon enough with soft updates. Differential Revision: https://reviews.freebsd.org/D5186 Reviewed by: garga, vangyzen, bapt, se MFC after: 1 week
* | MFHgjb2016-02-224-9/+16
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * Remove sys/types.hkevlo2016-02-191-2/+1
| |
| * Bump .Dd for r295764bjk2016-02-181-3/+3
| | | | | | | | Also fix a spelling and grammar nit while here.
| * Right now, the "virtual hole" API feature of lseek(2) is very vaguelysobomax2016-02-181-4/+12
| | | | | | | | | | | | | | | | | | | | | | documented and easy to miss. At the same time, it's pretty important for anyone who is trying to use SEEK_HOLE/SEEK_DATA in real app. Try to bridge that gap by making that description more pronounced and also document how it affects failure codes. Reviewed by: kib Differential Revision: https://reviews.freebsd.org/D5162
| * Remove dd xfer stats emitted during buildworldemaste2016-02-182-2/+2
| | | | | | | | They result in gratuitous differences when comparing build log output.
* | MFHgjb2016-02-181-0/+2
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * Fix build race after r295643.bdrewery2016-02-171-0/+2
| | | | | | | | Sponsored by: EMC / Isilon Storage Division
* | MFHgjb2016-02-154-3/+15
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * fputs: Return the number of bytes written.pfg2016-02-151-1/+1
| | | | | | | | | | | | | | Fix r295631: wrong value. Pointy hat: pfg (me) Pointed out by: bde
| * getln: We cannot expand the buffer beyond INT_MAX.pfg2016-02-152-2/+12
| | | | | | | | | | | | | | | | | | In such cases return ENOMEM. This is a limitation of our implementation, alternatively you may consider getline(3). Differential Revision: https://reviews.freebsd.org/D442 (Partial) Obtained from: Apple Inc. (Libc 997.90.3) Relnotes: yes
| * fputs: Return the number of bytes written.pfg2016-02-151-0/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | POSIX.1-2008 requires that successful completion simply return a non-negative integer. We have regularly returned a constant value. Another, equally valid, implementation convention implies returning the number of bytes written. Adopt this last convention to be in line with what Apple's libc does. POSIX also explicitly notes: Note that this implementation convention cannot be adhered to for strings longer than {INT_MAX} bytes as the value would not be representable in the return type of the function. For backwards-compatibility, implementations can return the number of bytes for strings of up to {INT_MAX} bytes, and return {INT_MAX} for all longer strings. Developers shouldn't depend specifically on either convention but the change may help port software from Apple. Differential Revision: https://reviews.freebsd.org/D442 (Partial) Obtained from: Apple Inc. (Libc 997.90.3 with changes) Relnotes: yes
| * Remove man page references to rndassociates.com, which has been taken overjamie2016-02-101-1/+0
| | | | | | | | by a domain squatter.
| * Fix the gcc build after r295407.markj2016-02-081-1/+1
| | | | | | | | X-MFC-With: r295407
| * If libthr.so is dlopened without RTLD_GLOBAL flag, the libthr symbolskib2016-02-083-2/+12
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | do not participate in the global symbols namespace, but rtld locks are still replaced and functions are interposed. In particular, __pthread_map_stacks_exec is resolved to the libc version. If a library is loaded later, which requires adjustment of the stack protection mode, rtld calls into libc __pthread_map_stacks_exec due to the symbols scope. The libc version might recurse into binder and recursively acquire rtld bind lock, causing the hang. Make libc __pthread_map_stacks_exec() interposed, which synchronizes rtld locks and version of the stack exec hook when libthr loaded, regardless of the symbol scope control or symbol resolution order. The __pthread_map_stacks_exec() symbol is removed from the private version in libthr since libc symbol now operates correctly in presence of libthr. Reported and tested by: markj Sponsored by: The FreeBSD Foundation MFC after: 2 weeks
* | MFHgjb2016-02-093-2/+12
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | MFHgjb2016-02-082-2/+21
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * semget(2): Add missing [EINVAL] conditions.jilles2016-02-071-1/+12
| | | | | | | | PR: 206927
| * - connect(2) Clarify namelenjgh2016-02-041-1/+9
| | | | | | | | | | | | | | | | PR: 206838 Submitted by: t@tobik.me Approved by: bcr (mentor) MFH: after 1 week Differential Revision: https://reviews.freebsd.org/D5194
| * Move logic to destroy a struct catentry to its own function.bdrewery2016-02-021-9/+17
| | | | | | | | | | | | | | This will be used later for memory leak handling. Obtained from: OneFS Sponsored by: EMC / Isilon Storage Division
* | Remove libc, librtld_db, libthr packages, and further increasegjb2016-02-051-1/+1
| | | | | | | | | | | | | | | | | | | | | | the constraints on what needs to be installed in a specific to maintain consistency during upgrades. Create a new clibs package containing libraries that are needed as a bare minimum for consistency. With much help and input from: kib Sponsored by: The FreeBSD Foundation
* | First pass through library packaging.gjb2016-02-041-0/+1
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | Final pass through to fix 'tests' packaging.gjb2016-02-031-0/+4
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | More 'tests' packaging fixes.gjb2016-02-031-1/+3
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | MFHgjb2016-02-031-9/+17
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | Fix another 'tests' packaging error.gjb2016-02-031-0/+4
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | More 'tests' package fixes.gjb2016-02-031-0/+4
| | | | | | | | Sponsored by: The FreeBSD Foundation
* | MFHgjb2016-02-022-0/+98
|\ \ | |/ | | | | Sponsored by: The FreeBSD Foundation
| * This seems like a very trivial bug that should have been squashed a longsobomax2016-01-302-0/+98
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | time ago, but for some reason it was not. Basically, without this change dlopen(3)'ing an empty .so file would just cause application to dump core with SIGSEGV. Make sure the file has enough data for at least the ELF header before mmap'ing it. Add a test case to check that dlopen an empty file return an error. There were a separate discussion as to whether it should be SIGBUS instead when you try to access region mapped from an empty file, but it's definitely SIGSEGV now, so if anyone want to check that please be my guest. Reviewed by: mjg, cem MFC after: 1 week Differential Revision: https://reviews.freebsd.org/D5112
* | First pass to fix the 'tests' packages.gjb2016-02-0223-0/+92
|/ | | | Sponsored by: The FreeBSD Foundation
* Add implementations of sendmmsg(3) and recvmmsg(3) functions whichkib2016-01-298-20/+303
| | | | | | | | | | | | | | | | | | wraps sendmsg(2) and recvmsg(2) into batch send and receive operation. The goal of this implementation is only to provide API compatibility with Linux. The cancellation behaviour of the functions is not quite right, but due to relative rare use of cancellation it is considered acceptable comparing with the complexity of the correct implementation. If functions are reimplemented as syscalls, the fix would come almost trivial. The direct use of the syscall trampolines instead of libc wrappers for sendmsg(2) and recvmsg(2) is to avoid data loss on cancellation. Submitted by: Boris Astardzhiev <boris.astardzhiev@gmail.com> Discussed with: jilles (cancellation behaviour) MFC after: 1 month
* Use intptr_t note ptrdiff_t when storing flags in the bottom bits ofbrooks2016-01-292-6/+6
| | | | | | | pointers. Obtained from: CheriBSD (e3a69027cc5a384431156d61c90d4304387a9b9d) Sponsored by: DARPA, AFRL
* Replace nslexer.l->nslexer.c custom rule with a -D CFLAG.bdrewery2016-01-271-8/+3
| | | | | | | | | | | This avoids reproducing the lex logic which had dependencies set wrong and used an intermediate file for modifying the YY_BUF_SIZE. This has only been possible since flex 2.5.37 was imported in r250873, which uses #ifndef YY_BUF_SIZE. MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division
* nslexer.c does not depend on nsparser.h.bdrewery2016-01-271-1/+1
| | | | | | | | | | nslexer.o depends on nsparser.h, which is already added by bsd.lib.mk and .depend. This reverts r237402. MFC after: 2 weeks Sponsored by: EMC / Isilon Storage Division
* Remove excess whitespacebdrewery2016-01-271-1/+1
|
* Restore flushing of output for revoke(2) again. Document revoke()'skib2016-01-261-2/+6
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | intended behaviour in its man page. Simplify tty_drain() to match. Don't call ttydevsw methods in tty_flush() if the device is gone since we now sometimes call it then. The flushing was supposed to be implemented by passing the FNONBLOCK flag to VOP_CLOSE() for revoke(). The tty driver is one of the few that can block in close and was one of the fewer that knew about this. This almost worked in FreeBSD-1 and similarly in Net/2. These versions only almost worked because there was and is considerable confusion between IO_NDELAY and FNONBLOCK (aka O_NONBLOCK). IO_NDELAY is only valid for VOP_READ() and VOP_WRITE(). For other VOPs it has the same value as O_SHLOCK. But since vfs_subr.c and tty.c consistently used the wrong flag and the O_SHLOCK flag is rarely set, this mostly worked. It also gave the feature than applications could get the non-blocking close by abusing O_SHLOCK. This was first broken then fixed in 1995. I changed only the tty driver to use FNONBLOCK, as a hack to get non-blocking via the normal flag FNONBLOCK for last closes. I didn't know about revoke()'s use of IO_NDELAY or change it to be consistent, so revoke() was broken. Then I changed revoke() to match. This was next broken in 1997 then fixed in 1998. Importing Lite2 made the flags inconsistent again by undoing the fix only in vfs_subr.c. This was next broken in 2008 by replacing everything in tty.c and not checking any flags in last close. Other bugs in draining limited the resulting unbounded waits to drain in some cases. It is now possible to fix this better using the new FREVOKE flag. Just restore flushing for revoke() for now. Don't restore or undo any hacks for ordinary last closes yet. But remove dead code in the 1-second relative timeout (r272789). This did extra work to extend the buggy draining for revoke() for as long as possible. The 1-second timeout made this not very long by usually flushing after 1 second. Submitted by: bde MFC after: 2 weeks
* Replace .CURDIR with SRCTOP to respect LIBC_SRCTOP feature.bdrewery2016-01-251-5/+5
|
* sctp_sendx() needs to provide the assoc_id back.tuexen2016-01-241-2/+7
| | | | MFC after: 3 days
* Fix bug in the readpassphrase(3) function, which can be exposedsobomax2016-01-241-8/+16
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | by application closing its stdin (i.e. STDIN_FILENO) prior to calling readpassphrase WITHOUT setting RPP_STDIN. What happens then is that the readpassphrase would open /dev/tty, and since file descriptors are reused, the call would return first unused fd, which is 0 which is also STDIN_FILENO. Then due to the usage of "input != STDIN_FILENO" in the code to do its logic, that would result in noecho flags not set on that file descriptor, which was original issue I've been trying to fix. In addition to that, the readpassphrase() would leak file descriptor on its way out, so fix that one as well. This problem can be tested with: $ ssh-add - < /tmp/myprivate.key The password will not be hidden as it should and ktrace will show: 53326 ssh-add CALL open(0x80142443c,0x100002<O_RDWR|O_CLOEXEC>,<unused>0x165f030) 53326 ssh-add NAMI "/dev/tty" 53326 ssh-add RET open 0 53326 ssh-add CALL sigprocmask(SIG_SETMASK,0x802eb1324,0x7fffffffd5e0) 53326 ssh-add RET sigprocmask 0 53326 ssh-add CALL sigaction(SIGALRM,0x7fffffffd630,0x7fffffffd610) Instead of: 57690 ssh-add CALL open(0x80142443c,0x100002<O_RDWR|O_CLOEXEC>,<unused>0x165f030) 57690 ssh-add NAMI "/dev/tty" 57690 ssh-add RET open 4 57690 ssh-add CALL ioctl(0x4,TIOCGETA,0x7fffffffd860) 57690 ssh-add RET ioctl 0 57690 ssh-add CALL ioctl(0x4,TIOCSETAF,0x7fffffffd680) 57690 ssh-add RET ioctl 0 57690 ssh-add CALL sigprocmask(SIG_SETMASK,0x802eb1324,0x7fffffffd620) 57690 ssh-add RET sigprocmask 0 57690 ssh-add CALL sigaction(SIGALRM,0x7fffffffd670,0x7fffffffd650) For the case when the key is read from the file. Technically this can also be workaround'ed at the application side by not closing the STDIN_FILENO in the first place, but readpassphrase(3) doesn't need to make any assumptions about that. Plus the file descriptor leak confirms that this is an oversight, rather than a deliberate behaviour. MFC after: 1 week
* sctp_sendv() needs to fill in the association id on return.tuexen2016-01-241-0/+7
| | | | MFC after: 3 days
* Add a standards compliance note for strtok_r as suggested by cpercival.wblock2016-01-221-1/+6
| | | | | Reviewed by: cpercival MFC after: 1 week
* sem: Don't free nameinfo that is still in list when open() fails.jilles2016-01-221-1/+3
| | | | | | | | | | This bug could be reproduced easily by calling sem_open() with O_CREAT | O_EXCL on a semaphore that is already open in the process. The struct sem_nameinfo would be freed while still in sem_list and later calls to sem_open() or sem_close() could access freed memory. PR: 206396 MFC after: 5 days
* Replace the last non-optional use of sbrk() in the tree with mmap().brooks2016-01-211-11/+4
| | | | | | | | | | All gmon want's is a region of memory without the overhead of malloc(). Just mapping some pages with mmap is an easy way to accomplish this. Approved by: jhb, cem, emaste Obtained from: CheriBSD (bf33e1e70b368ababde74aa3ac70d108c8a52c69) Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D5005
* Fix the implementations of PSEUDO_NOERROR and PSEUDO.brooks2016-01-211-7/+21
| | | | | | | | | | | | The PSEUDO* macros should not declare <syscall>, only _<syscall> and __sys_<syscall>. This was causing the interposing C wrappers to be ignored due to link order. Reviewed by: kib Obtained from: CheriBSD (4e8e13c90fc6a80e1520de44a6864cfd78b3b56d) MFC after: 1 week Sponsored by: DARPA, AFRL Differential Revision: https://reviews.freebsd.org/D4097
OpenPOWER on IntegriCloud