aboutsummaryrefslogtreecommitdiff
path: root/sys/compat/ia32/ia32_sysvec.c
Commit message (Collapse)AuthorAgeFilesLines
* Allow the ia32 resource limits (compat.ia32.max{dsiz,ssiz,vmem} to beJohn Baldwin2007-09-241-0/+3
| | | | | | | | | | set via loader tunables. They are already tunable via sysctl. MFC after: 1 week Approved by: re (kensmith) Notes: svn path=/head/; revision=172316
* Fix a couple of issues with the stack limit for 32-bit processes on 64-bitJohn Baldwin2007-07-121-8/+9
| | | | | | | | | | | | | | | | kernels exposed by the recent fixes to resource limits for 32-bit processes on 64-bit kernels: - Let ABIs expose their maximum stack size via a new pointer in sysentvec and use that in preference to maxssiz during exec() rather than always using maxssiz for all processses. - Apply the ABI's limit fixup to the previous stack size when adjusting RLIMIT_STACK to determine if the existing mapping for the stack needs to be grown or shrunk (as well as how much it should be grown or shrunk). Approved by: re (kensmith) Notes: svn path=/head/; revision=171410
* Allow FreeBSD's native ELF image activators to execute shared libraries theAlexander Kabaev2007-05-221-2/+2
| | | | | | | | | | same way it was enabled for Linux binares in linuxulator. This allows binaries built with -pie. Many ports auto-detect -fPIE support in GCC 4.2 and build binaries FreeBSD was unable to run. Notes: svn path=/head/; revision=169846
* Rework the support for ABIs to override resource limits (used by 32-bitJohn Baldwin2007-05-141-31/+29
| | | | | | | | | | | | | | | | | | | | | | processes under 64-bit kernels). Previously, each 32-bit process overwrote its resource limits at exec() time. The problem with this approach is that the new limits affect all child processes of the 32-bit process, including if the child process forks and execs a 64-bit process. To fix this, don't ovewrite the resource limits during exec(). Instead, sv_fixlimits() is now replaced with a different function sv_fixlimit() which asks the ABI to sanitize a single resource limit. We then use this when querying and setting resource limits. Thus, if a 32-bit process sets a limit, then that new limit will be inherited by future children. However, if the 32-bit process doesn't change a limit, then a future 64-bit child will see the "full" 64-bit limit rather than the 32-bit limit. MFC is tentative since it will break the ABI of old linux.ko modules (no other modules are affected). MFC after: 1 week Notes: svn path=/head/; revision=169565
* Move some declaration of 32-bit signal structures into fileDavid Xu2006-10-051-1/+2
| | | | | | | freebsd32-signal.h, implement sigtimedwait and sigwaitinfo system calls. Notes: svn path=/head/; revision=163018
* Remove kern.elf32.can_exec_dyn sysctl. Instead extend Brandinfo structureMaxim Sobolev2005-12-261-0/+2
| | | | | | | | | | | | | with flags bitfield and set BI_CAN_EXEC_DYN flag for all brands that usually allow executing elf dynamic binaries (aka shared libraries). When it is requested to execute ET_DYN elf image check if this flag is on after we know the elf brand allowing execution if so. PR: kern/87615 Submitted by: Marcin Koziej <creep@desk.pl> Notes: svn path=/head/; revision=153741
* Calling setrlimit from 32bit apps could potentially increase certainPaul Saab2005-11-021-3/+2
| | | | | | | | | | limits beyond what should be capiable in a 32bit process, so we must fixup the limits. Reviewed by: jhb Notes: svn path=/head/; revision=151980
* o Split out kernel part of execve(2) syscall into two parts: one thatMaxim Sobolev2005-01-291-7/+7
| | | | | | | | | | | | | | copies arguments into the kernel space and one that operates completely in the kernel space; o use kernel-only version of execve(2) to kill another stackgap in linuxlator/i386. Obtained from: DragonFlyBSD (partially) MFC after: 2 weeks Notes: svn path=/head/; revision=140992
* Add __elfN(dump_thread). This function is called from __elfN(coredump)Marcel Moolenaar2004-08-111-0/+8
| | | | | | | | | | | | to allow dumping per-thread machine specific notes. On ia64 we use this function to flush the dirty registers onto the backingstore before we write out the PRSTATUS notes. Tested on: alpha, amd64, i386, ia64 & sparc64 Not tested on: arm, powerpc Notes: svn path=/head/; revision=133464
* /usr/libexec/ld-elf.so.1 -> /libexec/ld-elf32.so.1David E. O'Brien2004-07-161-1/+1
| | | | Notes: svn path=/head/; revision=132263
* Change (yet again, sorry!) the path of the 32 bit ld-elf.so.1.Peter Wemm2004-03-211-2/+2
| | | | Notes: svn path=/head/; revision=127251
* Locking for the per-process resource limits structure.John Baldwin2004-02-041-40/+23
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | - struct plimit includes a mutex to protect a reference count. The plimit structure is treated similarly to struct ucred in that is is always copy on write, so having a reference to a structure is sufficient to read from it without needing a further lock. - The proc lock protects the p_limit pointer and must be held while reading limits from a process to keep the limit structure from changing out from under you while reading from it. - Various global limits that are ints are not protected by a lock since int writes are atomic on all the archs we support and thus a lock wouldn't buy us anything. - All accesses to individual resource limits from a process are abstracted behind a simple lim_rlimit(), lim_max(), and lim_cur() API that return either an rlimit, or the current or max individual limit of the specified resource from a process. - dosetrlimit() was renamed to kern_setrlimit() to match existing style of other similar syscall helper functions. - The alpha OSF/1 compat layer no longer calls getrlimit() and setrlimit() (it didn't used the stackgap when it should have) but uses lim_rlimit() and kern_setrlimit() instead. - The svr4 compat no longer uses the stackgap for resource limits calls, but uses lim_rlimit() and kern_setrlimit() instead. - The ibcs2 compat no longer uses the stackgap for resource limits. It also no longer uses the stackgap for accessing sysctl's for the ibcs2_sysconf() syscall but uses kernel_sysctl() instead. As a result, ibcs2_sysconf() no longer needs Giant. - The p_rlimit macro no longer exists. Submitted by: mtm (mostly, I only did a few cleanups and catchups) Tested on: i386 Compiled on: alpha, amd64 Notes: svn path=/head/; revision=125454
* Add an additional field to the elf brandinfo structure to supportPeter Wemm2003-12-231-5/+18
| | | | | | | | quicker exec-time replacement of the elf interpreter on an emulation environment where an entire /compat/* tree isn't really warranted. Notes: svn path=/head/; revision=123742
* Assimilate ia64 back into the fold with the common freebsd32/ia32 code.Peter Wemm2003-12-111-1/+7
| | | | | | | | | | | The split-up code is derived from the ia64 code originally. Note that I have only compile-tested this, not actually run-tested it. The ia64 side of the force is missing some significant chunks of signal delivery code. Notes: svn path=/head/; revision=123423
* Use the correct syscall table limitPeter Wemm2003-12-101-1/+2
| | | | Notes: svn path=/head/; revision=123422
* Move a MD 32 bit binary support routine into the MD areas. exec_setregsPeter Wemm2003-11-081-45/+0
| | | | | | | | | | is highly MD in an emulation environment since it operates on the host environment. Although the setregs functions are really for exec support rather than signals, they deal with the same sorts of context and include files. So I put it there rather than create yet another file. Notes: svn path=/head/; revision=122303
* Remove some duplicated comments that refer to npx. XXX The setregsPeter Wemm2003-11-081-11/+0
| | | | | | | function is actually MD (not MI) though.. Notes: svn path=/head/; revision=122293
* Oops, forgot to save these in the editor. Add CTASSERTS for signal andPeter Wemm2003-10-301-0/+10
| | | | | | | context related things. Notes: svn path=/head/; revision=121720
* Add sysentvec->sv_fixlimits() hook so that we can catch cases on 64 bitPeter Wemm2003-09-251-1/+64
| | | | | | | | | | | | | | | | | | | | | | | | systems where the data/stack/etc limits are too big for a 32 bit process. Move the 5 or so identical instances of ELF_RTLD_ADDR() into imgact_elf.c. Supply an ia32_fixlimits function. Export the clip/default values to sysctl under the compat.ia32 heirarchy. Have mmap(0, ...) respect the current p->p_limits[RLIMIT_DATA].rlim_max value rather than the sysctl tweakable variable. This allows mmap to place mappings at sensible locations when limits have been reduced. Have the imgact_elf.c ld-elf.so.1 placement algorithm use the same method as mmap(0, ...) now does. Note that we cannot remove all references to the sysctl tweakable maxdsiz etc variables because /etc/login.conf specifies a datasize of 'unlimited'. And that causes exec etc to fail since it can no longer find space to mmap things. Notes: svn path=/head/; revision=120422
* Switch to using the emulator in the common compat area.Peter Wemm2003-08-231-8/+9
| | | | | | | Still work-in-progress. Notes: svn path=/head/; revision=119336
* Initial sweep at dividing up the generic 32bit-on-64bit kernel supportPeter Wemm2003-08-221-4/+5
| | | | | | | | | from the ia32 specific stuff. Some of this still needs to move to the MI freebsd32 area, and some needs to move to the MD area. This is still work-in-progress. Notes: svn path=/head/; revision=119334
* Use __FBSDID().David E. O'Brien2003-07-251-2/+3
| | | | | | | Brought to you by: a boring talk at Ottawa Linux Symposium Notes: svn path=/head/; revision=118031
* Deal with the user VM space expanding. 32 bit applications do not likePeter Wemm2003-05-231-4/+4
| | | | | | | | | | | | having their stack at the 512GB mark. Give 4GB of user VM space for 32 bit apps. Note that this is significantly more than on i386 which gives only about 2.9GB of user VM to a process (1GB for kernel, plus page table pages which eat user VM space). Approved by: re (blanket) Notes: svn path=/head/; revision=115252
* Collect the nastiness for preserving the kernel MSR_GSBASE around thePeter Wemm2003-05-151-8/+1
| | | | | | | | | | | | | load_gs() calls into a single place that is less likely to go wrong. Eliminate the per-process context switching of MSR_GSBASE, because it should be constant for a single cpu. Instead, save/restore it during the loading of the new %gs selector for the new process. Approved by: re (amd64/* blanket) Notes: svn path=/head/; revision=115006
* Add BASIC i386 binary support for the amd64 kernel. This is largelyPeter Wemm2003-05-141-152/+73
| | | | | | | | | | | | | | | | | | | | | | | | | stolen from the ia64/ia32 code (indeed there was a repocopy), but I've redone the MD parts and added and fixed a few essential syscalls. It is sufficient to run i386 binaries like /bin/ls, /usr/bin/id (dynamic) and p4. The ia64 code has not implemented signal delivery, so I had to do that. Before you say it, yes, this does need to go in a common place. But we're in a freeze at the moment and I didn't want to risk breaking ia64. I will sort this out after the freeze so that the common code is in a common place. On the AMD64 side, this required adding segment selector context switch support and some other support infrastructure. The %fs/%gs etc code is hairy because loading %gs will clobber the kernel's current MSR_GSBASE setting. The segment selectors are not used by the kernel, so they're only changed at context switch time or when changing modes. This still needs to be optimized. Approved by: re (amd64/* blanket) Notes: svn path=/head/; revision=114987
* Added fields for VM_MIN_ADDRESS, PS_STRINGS and stack protections toJake Burkholder2002-09-011-4/+7
| | | | | | | | | sysentvec. Initialized all fields of all sysentvecs, which will allow them to be used instead of constants in more places. Provided stack fixup routines for emulations that previously used the default. Notes: svn path=/head/; revision=102808
* Infrastructure tweaks to allow having both an Elf32 and an Elf64 executablePeter Wemm2002-07-201-0/+365
handler in the kernel at the same time. Also, allow for the exec_new_vmspace() code to build a different sized vmspace depending on the executable environment. This is a big help for execing i386 binaries on ia64. The ELF exec code grows the ability to map partial pages when there is a page size difference, eg: emulating 4K pages on 8K or 16K hardware pages. Flesh out the i386 emulation support for ia64. At this point, the only binary that I know of that fails is cvsup, because the cvsup runtime tries to execute code in pages not marked executable. Obtained from: dfr (mostly, many tweaks from me). Notes: svn path=/head/; revision=100384