MFC r350484, r350607, r350608:Make randomized stack gap between strings and pointers to argv/envs.
MFC r344705: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 t
MFC r344705: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.Differently from the original commit, the merge leaves the structmember in place to preserve the ABI.Sponsored by: DARPA, AFRL
show more ...
MFC r343964, r344121, r344128, r344593, r344594:ASLR.
Move most of the contents of opt_compat.h to opt_global.h.opt_compat.h is mentioned in nearly 180 files. In-progress networkdriver compabibility improvements may add over 100 more so this isclose
Move most of the contents of opt_compat.h to opt_global.h.opt_compat.h is mentioned in nearly 180 files. In-progress networkdriver compabibility improvements may add over 100 more so this iscloser to "just about everywhere" than "only some files" per theguidance in sys/conf/options.Keep COMPAT_LINUX32 in opt_compat.h as it is confined to a subset ofsys/compat/linux/*.c. A fake _COMPAT_LINUX option ensure opt_compat.his created on all architectures.Move COMPAT_LINUXKPI to opt_dontuse.h as it is only used to control theset of compiled files.Reviewed by: kib, cem, jhb, jtlSponsored by: DARPA, AFRLDifferential Revision: https://reviews.freebsd.org/D14941
sys/compat: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified many licenses so this was mostly a manual - er
sys/compat: further adoption of SPDX licensing ID tags.Mainly focus on files that use BSD 2-Clause license, however the tool Iwas using misidentified 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.
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
With the removal of IA64, the only arch which uses ia32 compat is amd64.Sponsored by: The FreeBSD FoundationMFC after: 2 weeks
Tidy up ia32_sysvec sv_flags settingUse the same approach as sys/arm/arm/elf_machdep.c to avoid an odd-looking , on a separate line.
Add missing header dependency.This header depends on sigaltstack32 being declared.
Implement vsyscall hack. Prior to 2.13 glibc uses vsyscallinstead of vdso. An upcoming linux_base-c6 needs it.Differential Revision: https://reviews.freebsd.org/D1090Reviewed by: kib, traszMFC
Implement vsyscall hack. Prior to 2.13 glibc uses vsyscallinstead of vdso. An upcoming linux_base-c6 needs it.Differential Revision: https://reviews.freebsd.org/D1090Reviewed by: kib, traszMFC after: 1 week
Remove sv_prepsyscall, sv_sigsize and sv_sigtbl members of the structsysent.sv_prepsyscall is unused.sv_sigsize and sv_sigtbl translate signal number from the FreeBSDnamespace into the ABI doma
Remove sv_prepsyscall, sv_sigsize and sv_sigtbl members of the structsysent.sv_prepsyscall is unused.sv_sigsize and sv_sigtbl translate signal number from the FreeBSDnamespace into the ABI domain. It is only utilized on i386 for iBCS2binaries. The issue with this approach is that signals for iBCS2 weredelivered with the FreeBSD signal frame layout, which does not followiBCS2. The same note is true for any other potential user ifsv_sigtbl. In other words, if ABI needs signal number translation, itreally needs custom sv_sendsig method instead.Sponsored by: The FreeBSD Foundation
Split kerne timekeep ABI structure vdso_sv_tk out of the structsysentvec. This allows the timekeep data to be shared between similarABIs which cannot share sysentvec.Make the timekeep_push_vdso(
Split kerne timekeep ABI structure vdso_sv_tk out of the structsysentvec. This allows the timekeep data to be shared between similarABIs which cannot share sysentvec.Make the timekeep_push_vdso() tick callback to the timekeep structuresinstead of sysentvecs. If several sysentvec share the vdso_sv_tkstructure, we would update the userspace data several times on eachtick, without the change.Only allocate vdso_sv_tk in the exec_sysvec_init() sysinit whensysentvec is marked with the new SV_TIMEKEEP flag. This savesallocation and update of unneeded vdso_sv_tk for ABIs which do notprovide userspace gettimeofday yet, which are PowerPCs arches rightnow.Make vdso_sv_tk allocator public, namely split out and exportalloc_sv_tk() and alloc_sv_tk_compat32(). ABIs which share timekeepdata now can allocate it manually and share as appropriate.Requested by: nwhitehornTested by: nwhitehorn, phoSponsored by: The FreeBSD FoundationMFC after: 2 weeks
In preparation for switching linuxulator to the use the native 1:1threads add a hook for cleaning thread resources before the thread die.Differential Revision: https://reviews.freebsd.org/D1038
Improve support for XSAVE with debuggers.- Dump an NT_X86_XSTATE note if XSAVE is in use. This note is designed to match what Linux does in that 1) it dumps the entire XSAVE area including the f
Improve support for XSAVE with debuggers.- Dump an NT_X86_XSTATE note if XSAVE is in use. This note is designed to match what Linux does in that 1) it dumps the entire XSAVE area including the fxsave state, and 2) it stashes a copy of the current xsave mask in the unused padding between the fxsave state and the xstate header at the same location used by Linux.- Teach readelf() to recognize NT_X86_XSTATE notes.- Change PT_GET/SETXSTATE to take the entire XSAVE state instead of only the extra portion. This avoids having to always make two ptrace() calls to get or set the full XSAVE state.- Add a PT_GET_XSTATE_INFO which returns the length of the current XSTATE save area (so the size of the buffer needed for PT_GETXSTATE) and the current XSAVE mask (%xcr0).Differential Revision: https://reviews.freebsd.org/D1193Reviewed by: kibMFC after: 2 weeks
Remove ia64.This includes:o All directories named *ia64*o All files named *ia64*o All ia64-specific code guarded by __ia64__o All ia64-specific makefile logico Mention of ia64 in com
Remove ia64.This includes:o All directories named *ia64*o All files named *ia64*o All ia64-specific code guarded by __ia64__o All ia64-specific makefile logico Mention of ia64 in comments and documentationThis excludes:o Everything under contrib/o Everything under crypto/o sys/xen/interfaceo sys/sys/elf_common.hDiscussed at: BSDcan
Pull in r267961 and r267973 again. Fix for issues reported will follow.
Revert r267961, r267973:These changes prevent sysctl(8) from returning proper output,such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1
Revert r267961, r267973:These changes prevent sysctl(8) from returning proper output,such as: 1) no output from sysctl(8) 2) erroneously returning ENOMEM with tools like truss(1) or uname(1) truss: can not get etype: Cannot allocate memory
Extend the meaning of the CTLFLAG_TUN flag to automatically check ifthere is an environment variable which shall initialize the SYSCTLduring early boot. This works for all SYSCTL types both statica
Extend the meaning of the CTLFLAG_TUN flag to automatically check ifthere is an environment variable which shall initialize the SYSCTLduring early boot. This works for all SYSCTL types both statically anddynamically created ones, except for the SYSCTL NODE type and SYSCTLswhich belong to VNETs. A new flag, CTLFLAG_NOFETCH, has been added tobe used in the case a tunable sysctl has a custom initialisationfunction allowing the sysctl to still be marked as a tunable. Thekernel SYSCTL API is mostly the same, with a few exceptions for somespecial operations like iterating childrens of a static/extern SYSCTLnode. This operation should probably be made into a factored outcommon macro, hence some device drivers use this. The reason forchanging the SYSCTL API was the need for a SYSCTL parent OID pointerand not only the SYSCTL parent OID list pointer in order to quicklygenerate the sysctl path. The motivation behind this patch is to avoidparameter loading cludges inside the OFED driver subsystem. Instead ofadding special code to the OFED driver subsystem to post-load tunablesinto dynamically created sysctls, we generalize this in the kernel.Other changes:- Corrected a possibly incorrect sysctl name from "hw.cbb.intr_mask"to "hw.pcic.intr_mask".- Removed redundant TUNABLE statements throughout the kernel.- Some minor code rewrites in connection to removing not neededTUNABLE statements.- Added a missing SYSCTL_DECL().- Wrapped two very long lines.- Avoid malloc()/free() inside sysctl string handling, in case it iscalled to initialize a sysctl from a tunable, hence malloc()/free() isnot ready when sysctls from the sysctl dataset are registered.- Bumped FreeBSD version to indicate SYSCTL API change.MFC after: 2 weeksSponsored by: Mellanox Technologies
Cosmetics: define FREEBSD32_MINUSER and AOUT32_MINUSER for structsysentvec .sv_minuser. Also improve style.Submitted by: Oliver Pinter <[email protected]>MFC after: 1 week
Remove some unnecessary includes.
Eliminate ia32_reg.h by moving its contents to x86 and ia64 reg.h.Reviewed by: kib
Copy i386 reg.h to x86 and merge with amd64 reg.h. Replace i386/amd64/pc98reg.h with stubs.The tREGISTER macros are only made visible on i386. These macros aredeprecated and should not be availab
Copy i386 reg.h to x86 and merge with amd64 reg.h. Replace i386/amd64/pc98reg.h with stubs.The tREGISTER macros are only made visible on i386. These macros aredeprecated and should not be available on amd64.The i386 and amd64 versions of struct reg have been renamed to struct__reg32 and struct __reg64. During compilation either __reg32 or __reg64is defined as reg depending on the machine architecture. On amd64 the i386struct is also available as struct reg32 which is used in COMPAT_FREEBSD32code.Most of compat/ia32/ia32_reg.h is now IA64 only.Reviewed by: kib (previous version)
Move userland bits of i386 npx.h and amd64 fpu.h to x86 fpu.h.Remove FPU types from compat/ia32/ia32_reg.h that are no longer needed.Create machine/npx.h on amd64 to allow compiling i386 code that
Move userland bits of i386 npx.h and amd64 fpu.h to x86 fpu.h.Remove FPU types from compat/ia32/ia32_reg.h that are no longer needed.Create machine/npx.h on amd64 to allow compiling i386 code that usesthis header.The original npx.h and fpu.h define struct envxmm differently. Bothdefinitions have been included in the new x86 header as struct __envxmm32and struct __envxmm64. During compilation either __envxmm32 or __envxmm64is defined as envxmm depending on machine architecture. On amd64 the i386struct is also available as struct envxmm32.Reviewed by: kib
Add support for the extended FPU states on amd64, both for native64bit and 32bit ABIs. As a side-effect, it enables AVX on capableCPUs.In particular:- Query the CPU support for XSAVE, list of
Add support for the extended FPU states on amd64, both for native64bit and 32bit ABIs. As a side-effect, it enables AVX on capableCPUs.In particular:- Query the CPU support for XSAVE, list of the supported extensions and the required size of FPU save area. The hw.use_xsave tunable is provided for disabling XSAVE, and hw.xsave_mask may be used to select the enabled extensions.- Remove the FPU save area from PCB and dynamically allocate the (run-time sized) user save area on the top of the kernel stack, right above the PCB. Reorganize the thread0 PCB initialization to postpone it after BSP is queried for save area size.- The dumppcb, stoppcbs and susppcbs now do not carry the FPU state as well. FPU state is only useful for suspend, where it is saved in dynamically allocated suspfpusave area.- Use XSAVE and XRSTOR to save/restore FPU state, if supported and enabled.- Define new mcontext_t flag _MC_HASFPXSTATE, indicating that mcontext_t has a valid pointer to out-of-struct extended FPU state. Signal handlers are supplied with stack-allocated fpu state. The sigreturn(2) and setcontext(2) syscall honour the flag, allowing the signal handlers to inspect and manipilate extended state in the interrupted context.- The getcontext(2) never returns extended state, since there is no place in the fixed-sized mcontext_t to place variable-sized save area. And, since mcontext_t is embedded into ucontext_t, makes it impossible to fix in a reasonable way. Instead of extending getcontext(2) syscall, provide a sysarch(2) facility to query extended FPU state.- Add ptrace(2) support for getting and setting extended state; while there, implement missed PT_I386_{GET,SET}XMMREGS for 32bit binaries.- Change fpu_kern KPI to not expose struct fpu_kern_ctx layout to consumers, making it opaque. Internally, struct fpu_kern_ctx now contains a space for the extended state. Convert in-kernel consumers of fpu_kern KPI both on i386 and amd64.First version of the support for AVX was submitted by Tim Bird<tim.bird am sony com> on behalf of Sony. This version was writtenfrom scratch.Tested by: pho (previous version), Yamagi Burmeister <lists yamagi org>MFC after: 1 month
Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.The SYSCTL_NODE macro defines a list that stores all child-elements ofthat node. If there's no SYSCTL_DECL macro anywhere else,
Mark all SYSCTL_NODEs static that have no corresponding SYSCTL_DECLs.The SYSCTL_NODE macro defines a list that stores all child-elements ofthat node. If there's no SYSCTL_DECL macro anywhere else, there's noreason why it shouldn't be static.
1234