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
o Let rtld(1) set up psABI user trap handlers prior to executing the objects' init functions instead of doing the setup via a constructor in libc as the init functions may already depend on these
o Let rtld(1) set up psABI user trap handlers prior to executing the objects' init functions instead of doing the setup via a constructor in libc as the init functions may already depend on these handlers to be in place. This gets us rid of: - the undefined order in which libc constructors as __guard_setup() and jemalloc_constructor() are executed WRT __sparc_utrap_setup(), - the requirement to link libc last so __sparc_utrap_setup() gets called prior to constructors in other libraries (see r122883). For static binaries, crt1.o still sets up the user trap handlers.o Move misplaced prototypes for MD functions in to the MD prototype section of rtld.h.o Sprinkle nitems().
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.
Renumber copyright clause 4Renumber cluase 4 to 3, per what everybody else did when BSD grantedthem permission to remove clause 3. My insistance on keeping the samenumbering for legal reasons is
Renumber copyright clause 4Renumber cluase 4 to 3, per what everybody else did when BSD grantedthem permission to remove clause 3. My insistance on keeping the samenumbering for legal reasons is too pedantic, so give up on that point.Submitted by: Jan Schaumann <[email protected]>Pull Request: https://github.com/freebsd/freebsd/pull/96
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
Unbreak sparc64 after r276630 by calling __sparc_sigtramp_setup signaltrampoline as part of the MD __sys_sigaction again.Submitted by: kib (initial versions)MFC after: 3 days
Convert from WITHOUT_SYSCALL_COMPAT to MK_SYSCALL_COMPAT.
Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP}if not already defined. This allows building libc from outside oflib/libc using a reach-over makefile.A typical use-case is to
Replace use of ${.CURDIR} by ${LIBC_SRCTOP} and define ${LIBC_SRCTOP}if not already defined. This allows building libc from outside oflib/libc using a reach-over makefile.A typical use-case is to build a standard ILP32 version and a COMPAT32version in a single iteration by building the COMPAT32 version using areach-over makefile.Obtained from: Juniper Networks, Inc.
In lib/libc/sparc64/sys/__sparc_utrap_setup.c, avoid an error aboutpassing a pointer to a const object to sysarch().
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
Disconnect sun4v architecture from the three.Some files keep the SUN4V tags as a code reference, for the future,if any rewamped sun4v support wants to be added again.Reviewed by: mariusTested b
Disconnect sun4v architecture from the three.Some files keep the SUN4V tags as a code reference, for the future,if any rewamped sun4v support wants to be added again.Reviewed by: mariusTested by: sbrunoApproved by: re
Provide a type for the argument.Approved by: kib (mentor)
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)
Per Regents of the University of Calfornia letter, remove advertisingclause.# If I've done so improperly on a file, please let me know.
- change ABI for user trap handler for sun4v (eventually will sync sparc64 no hardware set up to test at the moment)Approved by: scottl (standing in for mentor rwatson)
Add prototypes for the three syscall stubs that are invoked here,in order to quiet warnings.
We need to discard `const'ness explicitly when invoking sysarch.Reported by: sparc64 tinderbox via bde
12