MFC r345703:Fix initial exec TLS mode for dynamically loaded shared objects.
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
Remove bogus checks against NCARGS.NCARGS isn't a limit on the number of arguments to pass to a function,but the number of bytes that can be consumed by arguments to exec. Assuch, it is not suit
Remove bogus checks against NCARGS.NCARGS isn't a limit on the number of arguments to pass to a function,but the number of bytes that can be consumed by arguments to exec. Assuch, it is not suitable for a limit on the count of arguments passedto makecontext().Sponsored by: DARPA / AFRL
libc: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using mis-identified many licenses so this was mostly a manual - errorp
libc: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using mis-identified many licenses so this was mostly a manual - errorprone - task.The Software Package Data Exchange (SPDX) group provides a specificationto make it easier for automated tools to detect and summarize well knownopensource licenses. We are gradually adopting the specification, notingthat the tags are considered only advisory and do not, in any way,superceed or replace the license texts.
General further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 3-Clause license.The Software Package Data Exchange (SPDX) group provides a specificationto make it easier f
General further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 3-Clause license.The Software Package Data Exchange (SPDX) group provides a specificationto make it easier for automated tools to detect and summarize well knownopensource licenses. We are gradually adopting the specification, notingthat the tags are considered only advisory and do not, in any way,superceed or replace the license texts.Special thanks to Wind River for providing access to "The Duke ofHighlander" tool: an older (2014) run over FreeBSD tree was useful as astarting point.
Correct an misunderstanding of MDSRCS.MDSRCS it intended to allow assembly versions of funtions with Cimplementations listed in MISRCS. The selection of the correctmachdep_ldis?.c for a given arc
Correct an misunderstanding of MDSRCS.MDSRCS it intended to allow assembly versions of funtions with Cimplementations listed in MISRCS. The selection of the correctmachdep_ldis?.c for a given architecture does not follow this patternand the file should be added to SRCS directly.Reviewed by: emaste, imp, jhbMFC after: 1 weekSponsored by: DARPA, AFRLDifferential Revision: https://reviews.freebsd.org/D9841
Fix a typo which broke the build for powerpc.It's spelled LIBC_SRCTOP not LIBC_SRC.Pointy-hat to: jhibbitsReported by: kib
Reduce code duplication between powerpc and powerpcspeThey're nearly identical except for a few files.Reported by: kib
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
libc: make some more use of the nitems() macro.We have an nitems() macro in the <sys/param.h> header that isconvenient to re-use as it makes things easier to read.Given that it is available alrea
libc: make some more use of the nitems() macro.We have an nitems() macro in the <sys/param.h> header that isconvenient to re-use as it makes things easier to read.Given that it is available already without adding additionalheaders and other parts of libc already use it, extend a bitmore its use.
libc: stop exporting cerrori386 stopped exporting .cerror in r240152, and likewise for amd64 inr240178. It is not used by other libraries on any platform, so applythe same change to the remaining
libc: stop exporting cerrori386 stopped exporting .cerror in r240152, and likewise for amd64 inr240178. It is not used by other libraries on any platform, so applythe same change to the remaining architectures.Reviewed by: jhibbits, jillesSponsored by: The FreeBSD FoundationDifferential Revision: https://reviews.freebsd.org/D5774
libc: stop exporting curbrk and minbrk in the private namespaceThey are not used anywhere else in the base system and are an internalimplementation detail that does not need to be exposed.Review
libc: stop exporting curbrk and minbrk in the private namespaceThey are not used anywhere else in the base system and are an internalimplementation detail that does not need to be exposed.Reviewed by: kibSponsored by: The FreeBSD FoundationDifferential Revision: https://reviews.freebsd.org/D5728
Make unions in PowerPC libc endian-safe.
Add include for declaration of _set_tp(). Eliminates -Wmissing-prototypes warnings.
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
Fix powerpc setjmp FPR saving/restoring.X-MFC-With: r279784
libc: Eliminate duplicate copies of __vdso_gettc.cSponsored by: The FreeBSD FoundationDifferential Revision: https://reviews.freebsd.org/D2152
Save and restore non-volatile floating-point registers during longjmp().This should also save and restore non-volatile Altivec registers, but thatneeds to wait on solving two problems:1. Adding th
Save and restore non-volatile floating-point registers during longjmp().This should also save and restore non-volatile Altivec registers, but thatneeds to wait on solving two problems:1. Adding the nonvolatile vector registers means we need 5 more than _JBLEN entries in jmp_buf on 32-bit targets (64-bit is OK).2. Need to figure out how to determine if saving/restoring vector regs is supported on the current CPU from userland.MFC after: 1 month
Remove duplicate copies of trivial getcontextx.cOnly i386 and amd64 provide a non-trivial __getcontextx(). Use a commontrivial implementation in gen/ for other architectures, rather thancopying t
Remove duplicate copies of trivial getcontextx.cOnly i386 and amd64 provide a non-trivial __getcontextx(). Use a commontrivial implementation in gen/ for other architectures, rather thancopying the file to each MD subdirectory.Reviewed by: kibSponsored by: The FreeBSD FoundationDifferential Revision: https://reviews.freebsd.org/D1472
Avoid use of register variables. Clang 3.5 treats this as undefined behavior,and bad things happen.MFC after: 1 week
1234