summaryrefslogtreecommitdiffstats
path: root/sys/sys/exec_elf.h (follow)
Commit message (Collapse)AuthorAgeFilesLines
* spellingjsg2021-03-101-2/+2
| | | | ok gnezdo@ semarie@ mpi@
* Add support for timeconting in userland.pirofti2020-07-061-2/+3
| | | | | | | | | | | | | | | | | | | | | | | | | | This diff exposes parts of clock_gettime(2) and gettimeofday(2) to userland via libc eliberating processes from the need for a context switch everytime they want to count the passage of time. If a timecounter clock can be exposed to userland than it needs to set its tc_user member to a non-zero value. Tested with one or multiple counters per architecture. The timing data is shared through a pointer found in the new ELF auxiliary vector AUX_openbsd_timekeep containing timehands information that is frequently updated by the kernel. Timing differences between the last kernel update and the current time are adjusted in userland by the tc_get_timecount() function inside the MD usertc.c file. This permits a much more responsive environment, quite visible in browsers, office programs and gaming (apparently one is are able to fly in Minecraft now). Tested by robert@, sthen@, naddy@, kmos@, phessler@, and many others! OK from at least kettenis@, cheloha@, naddy@, sthen@
* Change Elf64 types and structs to match the System V ABI specification.jsg2019-12-011-34/+31
| | | | | | | | | | | | | | | | | | | | | | | Change Elf64_Half from a uint32_t type to a uint16_t type. The size of structs do not change as the previous uses of Elf64_Half become Elf64_Word (uint32_t). Remove Elf64_Quarter as 16 bit values now use Elf64_Half. Replace Elf_Byte use with unsigned char. Change some uses of Elf64_Xword to Elf64_Addr (both uint64_t). Corrects behaviour with libelf where the file size of a symtab section came back as 26 not 24 as libelf determines this by the size of a the involved types not the size of the struct in exec_elf.h. As a result libelf's elf_getdata() returned ELF_E_SECTION due to the size of the section not being a multiple of the file size of the section type. This occurred with the new runtime linker for radeon shaders in Mesa 19.2. Sync description of Elf32 and Elf64 types in elf(5) with FreeBSD and adjust types in structs mentioned. ok guenther@ deraadt@
* revert exec_elf.h rev 1.85jsg2019-12-011-17/+17
| | | | committed by mistake as part of an unrelated change
* Repurpose the "syscalls must be on a writeable page" mechanism toderaadt2019-11-291-17/+17
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | enforce a new policy: system calls must be in pre-registered regions. We have discussed more strict checks than this, but none satisfy the cost/benefit based upon our understanding of attack methods, anyways let's see what the next iteration looks like. This is intended to harden (translation: attackers must put extra effort into attacking) against a mixture of W^X failures and JIT bugs which allow syscall misinterpretation, especially in environments with polymorphic-instruction/variable-sized instructions. It fits in a bit with libc/libcrypto/ld.so random relink on boot and no-restart-at-crash behaviour, particularily for remote problems. Less effective once on-host since someone the libraries can be read. For static-executables the kernel registers the main program's PIE-mapped exec section valid, as well as the randomly-placed sigtramp page. For dynamic executables ELF ld.so's exec segment is also labelled valid; ld.so then has enough information to register libc's exec section as valid via call-once msyscall(2) For dynamic binaries, we continue to to permit the main program exec segment because "go" (and potentially a few other applications) have embedded system calls in the main program. Hopefully at least go gets fixed soon. We declare the concept of embedded syscalls a bad idea for numerous reasons, as we notice the ecosystem has many of static-syscall-in-base-binary which are dynamically linked against libraries which in turn use libc, which contains another set of syscall stubs. We've been concerned about adding even one additional syscall entry point... but go's approach tends to double the entry-point attack surface. This was started at a nano-hackathon in Bob Beck's basement 2 weeks ago during a long discussion with mortimer trying to hide from the SSL scream-conversations, and finished in more comfortable circumstances next to a wood-stove at Elk Lakes cabin with UVM scream-conversations. ok guenther kettenis mortimer, lots of feedback from others conversations about go with jsing tb sthen
* The conversion of rdsetroot to -lelf failed on alpha: -lelf thought ELF SHDRderaadt2019-04-201-6/+1
| | | | | | | | | was 80 bytes in size, rather than 64 as listed in the ELF header. In Sep 2001 when ELF was being integrated into the tree, two of the ELF object types (and two more via #define) were given different (incorrect) sizes, and hid behind an #ifdef __alpha__ all this time. -lelf constructs the SHDR object by accumulating sizes of types, so this was finally exposed. A review of the tree shows no other consequences, so we can fix this now.
* add some definitions used by elftoolchain's libelfjsg2019-01-221-1/+15
| | | | ok guenther@
* Core files with >65535 sections have to use PN_XNUM and a section headerguenther2018-12-061-1/+4
| | | | | | | | to pass the real count, with a minimal .shstrtab segment for consistency. Also, add support for PN_XNUM to readelf. problem reported and testing by claudio@ ok kettenis@
* Add GNU_HASH #defines; improve readelf output for SHT_GNU_HASHguenther2018-11-131-1/+6
| | | | ok naddy@ jca@
* Add SHT_SYMTAB_SHNDXmpi2018-01-221-14/+15
| | | | Required by Karel Gardas to unbreak GHC head.
* Unlike other archs, mips64 needs ld.so to know about symbol visibility andguenther2018-01-181-1/+11
| | | | | | | skip symbol lookup on protected symbols. Add visibility #defines to <sys/exec_elf.h> to support that. ok kettenis@ visa@
* Add a #define for the name of the .openbsd.randomdata section.deraadt2017-12-091-1/+2
| | | | ok guenther
* Add missing SHN_XINDEX needed by devel/ctftools.mpi2017-10-181-1/+2
| | | | Reported by and ok naddy@
* Add Section Attirbute flag defines, some default values for n_typempi2017-10-121-6/+21
| | | | | | | and a couple of missing EM_* required to build devel/libdwarf and devel/valgrind. ok deraadt@, jasper@
* Remove unused 32bit version of elf_hash().mpi2017-09-051-4/+1
| | | | | | Riding previous libc bump. ok kettenis@
* Kill db_sym_t.mpi2017-05-301-1/+3
| | | | ok deraadt@, kettenis@, jasper@
* Add Elf{32,64}_Nhdr structs with the same member names used by libelfjsg2017-02-181-1/+16
| | | | | | | | | | and glibc. As noted by guenther@ this is the same layout as our Elf{32,64}_Note structs and the handful of uses we have in the tree may switch From _Note to _Nhdr in future. Prompted by the development version of Mesa using the Nhdr type. ok guenther@
* Include sys/types.h rather than machine/_types.h. With this changejsg2017-02-181-2/+2
| | | | | | | link.h can be included without first including sys/types.h matching the behaviour on other systems. Suggested by and ok guenther@
* In exec_elf.c: expand ELFNAME(), ELFNAME2(), and ELFNAMEEND() exceptguenther2017-02-081-20/+2
| | | | | | | | | | | | | | | | | | | | | | leaving out the size, so that ELFNAME2(exec,makecmds) becomes exec_elf_makecmds instead of exec_elf{32,64}_makecmds and then delete the ELFNAME2() and ELFNAMEEND() macros. Move the prototypes for functions local to exec_elf.c to there from exec_elf.h. Simplify the SMALL_KERNEL conditionals around the ELF coredump code. Change exec_conf.c to use the size-generic names and macros Remove exec_elf{32,64}.c and just build exec_elf.c; delete the _KERN_DO_ELF and _KERN_DO_ELF64 #defines. ok jca@, encouragement from deraadt@ and tom@
* Move ELF_AUX_ENTRIES from exec_elf.h to exec_elf.c; it's totally internalguenther2017-02-081-3/+1
| | | | | | and not something we guarantee to userspace ok jca@
* elf{32,64}_check_brand() isn't used; delete itguenther2017-02-081-3/+1
| | | | ok jca@
* Provide size-generic ELF_NO_ADDR in <sys/exec_elf.h> and use that insteadguenther2017-02-081-1/+3
| | | | | | of ELFDEFNNAME(NO_ADDR) ok jca@
* Fix ELF64_R_TYPE(reloc->r_info) to have the same type on mips64leguenther2017-01-301-2/+2
| | | | | | | | | as on other LP64 archs, __uint64_t, so that printf-like functions don't require extra casting...then eliminate the extra cast in ld.so/mips64/rtld_machine.c discussed with miod ok visa@
* p_comm is the process's command and isn't per thread, so move it fromguenther2017-01-211-2/+2
| | | | | | struct proc to struct process. ok deraadt@ kettenis@
* Add the ELF machine type for AArch64 as specified in the ELF spec forpatrick2016-11-281-1/+2
| | | | | | the ARM 64-bit Architecture. ok phessler@
* move the .SUNW_ctf section name definition to exec_elf.h and document it in elf(5)jasper2016-09-171-1/+2
| | | | | feedback from guenther@ ok guenther@ kettenis@
* - point to binutils 2.17 version of elf/mips.hjasper2016-09-071-6/+6
| | | | - fix trailing whitespace
* Add PT_GNU_EH_FRAME.kettenis2016-09-041-1/+2
| | | | ok guenther@
* Move DT_NUM from <sys/exec_elf.h> to resolv.h in ld.so where it belongs.kettenis2016-08-301-4/+1
| | | | ok guenther@
* Implement support for DT_INIT_ARRAY, DT_FINI_ARRAY and DT_PREINIT_ARRAY.kettenis2016-08-231-2/+2
| | | | | | | Don't skip DT_INIT and DT_FINI for the main executable. This matches what Linux and Solaris do. ok guenther@
* Add PT_GNU_RELRO, for ld.so workguenther2016-07-141-1/+3
| | | | ok millert@ kettenis@
* define PT_OPENBSD_WXNEEDEDderaadt2016-05-291-1/+2
|
* fix commentguenther2016-03-241-2/+2
|
* Add some newer DT_* and DF_* constantsguenther2015-10-131-1/+17
| | | | ok kettenis@ miod@
* Typos; ok kettenis@jca2015-08-241-3/+3
|
* Add a new ELF segment .openbsd.bootdata to the sparc64 kernel.stsp2014-11-261-2/+2
| | | | | | | | | | This can be used to pass boot parameters to the kernel which can't be passed safely via the Open Firmware interface, such as softraid volume IDs and keys. The kernel already reads the arguments if available but ofwboot won't provide them until further changes are committed there. With support from deraadt, kettenis and matthew. ok deraadt@
* Fix spelling in commentsguenther2014-01-031-3/+3
|
* Implement symbol caching and RELACOUNT/RELCOUNT optimizations.guenther2013-05-081-2/+5
| | | | | | Much assistance and testing by miod ok miod@
* Remove the 'OLF method' used for the transition from a.out to ELF andderaadt2012-09-111-2/+1
| | | | | | | for all the compat layers which are now gone. Linux compat still works because it always used another method in any case, and nothing looks at p_os anymore. ok jsing
* Add support for .openbsd.randomdata sections and PT_OPENBSD_RANDOMIZEmatthew2012-08-201-1/+6
| | | | | | | | segments to the kernel, ld (2.15), and ld.so. Tested on alpha, amd64, i386, macppc, and sparc64 (thanks naddy, mpi, and okan!). Idea discussed for some time; committing now for further testing. ok deraadt
* Add new machine entry for Itanium.pirofti2011-09-201-3/+7
| | | | | | While at it clean-up and fix machine types to reflect reality. Okay deraadt@.
* update url in comment; Nikolai Fetissovsthen2010-06-071-2/+2
|
* Add defines for thread-local-storage sections/symbols/segments and forguenther2010-05-021-4/+25
| | | | | | | the DT_1_FLAGS .dynamic entry and its known flag values. Remove the unused and useless STT_NUM and PT_NUM defines. ok miod@
* fix ELF64_R_INFO for mips64el to cast to 64 bits before shift; ok miod@otto2010-01-311-2/+2
|
* Provide proper ELF64_R_{SYM,TYPE,INFO} on little endian mips64, since thesemiod2010-01-251-1/+15
| | | | | do not follow the regular layout. Makes ld.so much happier on loongson. ok drahn@
* Make ELF platforms generate ELF core dumps. Somewhat based on code fromkettenis2009-03-051-1/+59
| | | | | | NetBSD. ok kurt@, drahn@, miod@
* uint32_t is not spelled u_long. makes the 32-bit NO_ADDR potentially useful ontedu2007-05-141-2/+2
| | | | 64-bit machines, even though it's not used. ok art deraadt millert tom
* Early bits for a 32-bit SuperH toolchain, currently for little-endianmiod2006-10-061-1/+2
| | | | systems only; more work is necessary in ld land.
* Adapt things to use __type_t instead of _BSD_TYPE_T_millert2006-01-061-21/+21
| | | | | Add new sys/_types.h header Include machine/_types.h or sys/_types.h where applicable
* Add PT_LOOS, PT_HIOS and Elf_Half.kettenis2004-10-101-1/+5
| | | | ok drahn@