Reimplement brk() and sbrk() to avoid the use of _end.Previously, libc.so would initialize its notion of the break addressusing _end, a special symbol emitted by the static linker followingthe bs
Reimplement brk() and sbrk() to avoid the use of _end.Previously, libc.so would initialize its notion of the break addressusing _end, a special symbol emitted by the static linker followingthe bss section. Compatibility issues between lld and ld.bfd couldcause the wrong definition of _end (libc.so's definition rather thanthat of the executable) to be used, breaking the brk()/sbrk()interface.Avoid this problem and future interoperability issues by simply notrelying on _end. Instead, modify the break() system call to returnthe kernel's view of the current break address, and have libcinitialize its state using an extra syscall upon the first use of theinterface. As a side effect, this appears to fix brk()/sbrk() usagein executables run with rtld direct exec, since the kernel and libc.sono longer maintain separate views of the process' break address.PR: 228574Reviewed by: kib (previous version)MFC after: 2 monthsDifferential Revision: https://reviews.freebsd.org/D15663
show more ...
Replace MD assembly exect() with a portable version.Originally, on the VAX exect() enable tracing once the new executableimage was loaded. This was possible because tracing was controllablethrou
Replace MD assembly exect() with a portable version.Originally, on the VAX exect() enable tracing once the new executableimage was loaded. This was possible because tracing was controllablethrough user space code by setting the PSL_T flag. The followinginstruction is a system call that activated tracing (as allinstructions do) by copying PSL_T to PSL_TP (trace pending). Thefirst instruction of the new executable image would trigger a tracefault.This is not portable to all platforms and the behavior was replaced withptrace(PT_TRACE_ME, ...) since FreeBSD forked off of the CSRG repository.Platforms either incorrectly call execve(), trigger trace faults insidethe original executable, or do contain an implementation of thisfunction.The exect() interfaces is deprecated or removed on NetBSD and OpenBSD.Submitted by: Ali Mashtizadeh <[email protected]>Reviewed by: kibDifferential Revision: https://reviews.freebsd.org/D14989
Remove caching from getlogin(2).This caching has existed since the CSRG import, but serves no obviouspurpose. Sure, setlogin() is called rarely, but calls to getlogin()should also be infrequent.
Remove caching from getlogin(2).This caching has existed since the CSRG import, but serves no obviouspurpose. Sure, setlogin() is called rarely, but calls to getlogin()should also be infrequent. The required invalidation was notimplemented on aarch64, arm, mips, amd riscv so updates would neveroccur if getlogin() was called before setlogin().Reported by: Ali Mashtizadeh <[email protected]>Reviewed by: kibSponsored by: DARPA, AFRLDifferential Revision: https://reviews.freebsd.org/D14965
Reduce duplicate NOASM and PSEUDO definitionsThe initial value of NOASM is nearly the same in all cases and theinitial value of PSEUDO is the same in all cases so reduce duplication(and hopefully
Reduce duplicate NOASM and PSEUDO definitionsThe initial value of NOASM is nearly the same in all cases and theinitial value of PSEUDO is the same in all cases so reduce duplication(and hopefully, future merge conflicts) by machine independent defaults.Also document the PSEUDO variable.Reviewed by: jhb, kibObtained from: CheriBSDSponsored by: DARPA, AFRLDifferential Revision: https://reviews.freebsd.org/D7820
Rewrite ptrace(2) wrappers in C.Besides removing hand-translation to assembler, this also adds missingwrappers for arm64 and risc-v.Reviewed by: emaste, jhbSponsored by: The FreeBSD FoundationM
Rewrite ptrace(2) wrappers in C.Besides removing hand-translation to assembler, this also adds missingwrappers for arm64 and risc-v.Reviewed by: emaste, jhbSponsored by: The FreeBSD FoundationMFC after: 1 weekDifferential revision: https://reviews.freebsd.org/D7694
Remove unusedd and obsolete openbsd_poll system call. (Phase 1)Reported by: brooksReviewed by: brooks,jhbDifferential Revision: https://reviews.freebsd.org/D7548
Replace use of the pipe(2) system call with pipe2(2) with a zero flagsvalue.This eliminates the need for machine dependant assembly wrappers forpipe(2).It also make passing an invalid address t
Replace use of the pipe(2) system call with pipe2(2) with a zero flagsvalue.This eliminates the need for machine dependant assembly wrappers forpipe(2).It also make passing an invalid address to pipe(2) return EFAULT ratherthan triggering a segfault. Document this behavior (which was alreadytrue for pipe2(2), but undocumented).Reviewed by: andrewApproved by: re (gjb)Sponsored by: DARPA, AFRLDifferential Revision: https://reviews.freebsd.org/D6815
The lseek(2), mmap(2), truncate(2), ftruncate(2), pread(2), andpwrite(2) syscalls are wrapped to provide compatibility with pre-7.xkernels which required padding before the off_t parameter. Thefc
The lseek(2), mmap(2), truncate(2), ftruncate(2), pread(2), andpwrite(2) syscalls are wrapped to provide compatibility with pre-7.xkernels which required padding before the off_t parameter. Thefcntl(2) contains compatibility code to handle kernels before thestruct flock was changed during the 8.x CURRENT development. Theshims were reasonable to allow easier revert to the older kernel atthat time.Now, two or three major releases later, shims do not serve anypurpose. Such old kernels cannot handle current libc, so revert thecompatibility code.Make padded syscalls support conditional under the COMPAT6 configoption. For COMPAT32, the syscalls were under COMPAT6 already.Remove WITHOUT_SYSCALL_COMPAT build option, which only purpose was to(partially) disable the removed shims.Reviewed by: jhb, imp (previous versions)Discussed with: peterSponsored by: The FreeBSD FoundationMFC after: 1 week
libc: Eliminate duplicate copies of __vdso_gettc.cSponsored by: The FreeBSD FoundationDifferential Revision: https://reviews.freebsd.org/D2152
Ensure that every ENTRY(foo) has a matching END(foo).It allows to build with newer binutilsDifferential Revision: https://reviews.freebsd.org/D877Reviewed by: jhibbits
Convert from WITHOUT_SYSCALL_COMPAT to MK_SYSCALL_COMPAT.
Rework the __vdso_* symbols attributes to only make the symbols weak,but use normal references instead of weak. This makes the staticallylinked binaries to use fast gettimeofday(2) by forcing the
Rework the __vdso_* symbols attributes to only make the symbols weak,but use normal references instead of weak. This makes the staticallylinked binaries to use fast gettimeofday(2) by forcing the linker toresolve references and providing the neccessary functions.Reported by: bdeTested by: marius (sparc64)MFC after: 2 weeks
Mark assembler sources from libc as working with non-executable stack.Reviewed and tested by: nwhitehorn
Mark uname(), getdomainname() and setdomainname() with COMPAT_FREEBSD4.Looking at our source code history, it seems the uname(),getdomainname() and setdomainname() system calls got deprecatedsome
Mark uname(), getdomainname() and setdomainname() with COMPAT_FREEBSD4.Looking at our source code history, it seems the uname(),getdomainname() and setdomainname() system calls got deprecatedsomewhere after FreeBSD 1.1, but they have never been phased outproperly. Because we don't have a COMPAT_FREEBSD1, just useCOMPAT_FREEBSD4.Also fix the Linuxolator to build without the setdomainname() routine byjust making it call userland_sysctl on kern.domainname. Also replace thesetdomainname()'s implementation to use this approach, because we'reduplicating code with sysctl_domainname().I wasn't able to keep these three routines working in ourCOMPAT_FREEBSD32, because that would require yet another keyword forsyscalls.master (COMPAT4+NOPROTO). Because this routine is probablyunused already, this won't be a problem in practice. If it turns out tobe a problem, we'll just restore this functionality.Reviewed by: rdivacky, kib
Classify mmap, lseek, pread, pwrite, truncate, ftruncate as pseudosyscalls, unless WITHOUT_SYSCALL_COMPAT is defined. The default casewill have the .c wrappers still. If you define WITHOUT_SYSCAL
Classify mmap, lseek, pread, pwrite, truncate, ftruncate as pseudosyscalls, unless WITHOUT_SYSCALL_COMPAT is defined. The default casewill have the .c wrappers still. If you define WITHOUT_SYSCALL_COMPAT,the .c wrappers will go away and libc will make direct syscalls.After 7-stable starts, the direct syscall method will be default.Approved by: re (kensmith)
Add the mlockall() and munlockall() system calls. - All those diffs to syscalls.master for each architecture *are* necessary. This needed clarification; the stub code generation for mlockall()
Add the mlockall() and munlockall() system calls. - All those diffs to syscalls.master for each architecture *are* necessary. This needed clarification; the stub code generation for mlockall() was disabled, which would prevent applications from linking to this API (suggested by mux) - Giant has been quoshed. It is no longer held by the code, as the required locking has been pushed down within vm_map.c. - Callers must specify VM_MAP_WIRE_HOLESOK or VM_MAP_WIRE_NOHOLES to express their intention explicitly. - Inspected at the vmstat, top and vm pager sysctl stats level. Paging-in activity is occurring correctly, using a test harness. - The RES size for a process may appear to be greater than its SIZE. This is believed to be due to mappings of the same shared library page being wired twice. Further exploration is needed. - Believed to back out of allocations and locks correctly (tested with WITNESS, MUTEX_PROFILING, INVARIANTS and DIAGNOSTIC).PR: kern/43426, standards/54223Reviewed by: jake, alcApproved by: jake (mentor)MFC after: 2 weeks
Minimal libc for PowerPC.Reviewed by: bennoApproved by: re (blanket)