Get rid of sa->narg. It serves no purpose; use sa->callp->sy_narg instead.Reviewed by: kibSponsored by: DARPADifferential Revision: https://reviews.freebsd.org/D26458
Use uintptr_t instead of register_t * for the stack base.- Use ustringp for the location of the argv and environment strings and allow destp to travel further down the stack for the stackgap an
Use uintptr_t instead of register_t * for the stack base.- Use ustringp for the location of the argv and environment strings and allow destp to travel further down the stack for the stackgap and auxv regions.- Update the Linux copyout_strings variants to move destp down the stack as was done for the native ABIs in r263349.- Stop allocating a space for a stack gap in the Linux ABIs. This used to hold translated system call arguments, but hasn't been used since r159992.Reviewed by: kibTested on: md64 (amd64, i386, linux64), i386 (i386, linux)Sponsored by: DARPADifferential Revision: https://reviews.freebsd.org/D22501
show more ...
Remove sv_pagesize, originally introduced with r100384.In all of the architectures we have today, we always use PAGE_SIZE.While in theory one could define different things, none of thecurrent arc
Remove sv_pagesize, originally introduced with r100384.In all of the architectures we have today, we always use PAGE_SIZE.While in theory one could define different things, none of thecurrent architectures do, even the ones that have transitioned from32-bit to 64-bit like i386 and arm. Some ancient mips binaries onother systems used 8k instead of 4k, but we don't support runningthose and likely never will due to their age and obscurity.Reviewed by: imp (who also contributed the commit message)Sponsored by: DARPA, AFRLDifferential Revision: https://reviews.freebsd.org/D19280
Correct some more places where TO_PTR() should be used.These were missed in r326228.MFC after: 2 weeks
Use TO_PTR() to convert integers to pointers.For FreeBSD/arm64's cloudabi32 support, I'm going to need a TO_PTR() inthis place. Also use it for all of the other source files, so that thedifferenc
Use TO_PTR() to convert integers to pointers.For FreeBSD/arm64's cloudabi32 support, I'm going to need a TO_PTR() inthis place. Also use it for all of the other source files, so that thedifference remains as minimal as possible.MFC after: 2 weeks
Don't let cpu_set_syscall_retval() clobber exec_setregs().Upon successful completion, the execve() system call invokesexec_setregs() to initialize the registers of the initial thread of thenewly
Don't let cpu_set_syscall_retval() clobber exec_setregs().Upon successful completion, the execve() system call invokesexec_setregs() to initialize the registers of the initial thread of thenewly executed process. What is weird is that when execve() returns, itstill goes through the normal system call return path, clobbering theregisters with the system call's return value (td->td_retval).Though this doesn't seem to be problematic for x86 most of the times (asthe value of eax/rax doesn't matter upon startup), this can be prettyfrustrating for architectures where function argument and returnregisters overlap (e.g., ARM). On these systems, exec_setregs() alsoneeds to initialize td_retval.Even worse are architectures where cpu_set_syscall_retval() setsregisters to values not derived from td_retval. On these architectures,there is no way cpu_set_syscall_retval() can set registers to the way itwants them to be upon the start of execution.To get rid of this madness, let sys_execve() return EJUSTRETURN. Thiswill cause cpu_set_syscall_retval() to leave registers intact. Thismakes process execution easier to understand. It also eliminates thedifference between execution of the initial process and successive ones.The initial call to sys_execve() is not performed through a system callcontext.Reviewed by: kib, jhibbitsDifferential Revision: https://reviews.freebsd.org/D13180
Move struct syscall_args syscall arguments parameters container intostruct thread.For all architectures, the syscall trap handlers have to allocate thestructure on the stack. The structure takes
Move struct syscall_args syscall arguments parameters container intostruct thread.For all architectures, the syscall trap handlers have to allocate thestructure on the stack. The structure takes 88 bytes on 64bit archeswhich is not negligible. Also, it cannot be easily found by othercode, which e.g. caused duplication of some members of the structureto struct thread already. The change removes td_dbg_sc_code andtd_dbg_sc_nargs which were directly copied from syscall_args.The structure is put into the copied on fork part of the struct threadto make the syscall arguments information correct in the child afterfork.This move will also allow several more uses shortly.Reviewed by: jhb (previous version)Sponsored by: The FreeBSD FoundationMFC after: 3 weeksX-Differential revision: https://reviews.freebsd.org/D11080
Stop providing the compat_3_brand.As of r315860, the ELF image activator works fine for CloudABI without it.Reviewed by: kibMFC after: 2 weeks
Update r315753 with the proper flag name.Sponsored by: The FreeBSD FoundationMFC after: 1 week
Add a flag BI_BRAND_ONLY_STATIC to specify that the brand onlymatches static binaries.Interpretation of the 'static' there is that the binary must notspecify an interpreter. In particular, share
Add a flag BI_BRAND_ONLY_STATIC to specify that the brand onlymatches static binaries.Interpretation of the 'static' there is that the binary must notspecify an interpreter. In particular, shared objects are matched bythe brand if BI_CAN_EXEC_DYN is also set.This improves precision of the brand matching, which should eliminatesurprises due to brand ordering.Revert r315701.Discussed with and tested by: ed (previous version)Sponsored by: The FreeBSD FoundationMFC after: 1 week
Set the interpreter path to /nonexistent.CloudABI executables are statically linked and don't have aninterpreter. Setting the interpreter path to NULL used to workpreviously, but r314851 introduc
Set the interpreter path to /nonexistent.CloudABI executables are statically linked and don't have aninterpreter. Setting the interpreter path to NULL used to workpreviously, but r314851 introduced code that checks the stringunconditionally. Running CloudABI executables now causes a null pointerdereference.Looking at the rest of imgact_elf.c, it seems various other codepathsalready leaned on the fact that the interpreter path is set. Let's justgo ahead and pick an obviously incorrect interpreter path to appeaseimgact_elf.c.MFC after: 1 week
Catch up with changes to structure member names.Pointer/length pairs are now always named ${name} and ${name}_len.
Add very preliminary support for CloudABI for ARMv6.In order to make CloudABI work on ARMv6, start off by copying over thesysvec for ARM64 and adjust it to use 32-bit registers. Also add codefor
Add very preliminary support for CloudABI for ARMv6.In order to make CloudABI work on ARMv6, start off by copying over thesysvec for ARM64 and adjust it to use 32-bit registers. Also add codefor fetching arguments from the stack if needed, as there are fewerregister than on ARM64.Also import the vDSO that is needed to invoke system calls. This vDSOuses the intra procedure call register (ip) to store the system callnumber. This is a bit simpler than what native FreeBSD does, as FreeBSDuses r7, while preserving the original r7 into ip.This sysvec seems to be complete enough to start CloudABI processes.These processes are capable of linking in the vDSO and are thereforecapable of executing (most?) system calls successfully. Unfortunately,the biggest show stopper is still that TLS is completely broken:- The linker used by CloudABI, LLD, still has troubles with some of the relocations needed for TLS. See LLVM bug 30218 for more details.- Whereas FreeBSD uses the tpidruro register for TLS, for CloudABI I want to make use of tpidrurw, so that userspace can modify the base address directly. This is needed for efficient emulation. Unfortunately, this register doesn't seem to be preserved across context switches yet.Obtained from: https://github.com/NuxiNL/cloudabi (the vDSO)