Home | History | Annotate | Download | only in freebsd
History log of /src/sys/compat/freebsd/freebsd_exec.c
RevisionDateAuthorComments
 1.42  10-Aug-2018  pgoyette Allow syscall_establish() to install new syscalls when the existing
entry-point is either sys_nomodule or sys_nosys. Update the
makesyscalls.sh script to create a const array of bits to allow
syscall_disestablish() to properly restore the original entry-point.
Update all the initializers of struct emul to initialize the pointer
to the bit array struct emul.

XXX Regen of all files created by makesyscalls.sh will come soon,
XXX followed by a kernel version bump (since struct emul is being
XXX modified).

This commit should address PR kern/45781 and also removes the need
for the work-around for that PR in file

sys/arch/usermode/modules/syscallemu/syscallemu.c
 1.41  06-May-2018  kamil branches: 1.41.2;
Remove an element from struct emul: e_tracesig

e_tracesig used to be implemented for Darwin compat. Nowadays the Darwin
compatiblity layer is gone and there are no other users.

This functionality isn't used where it shall be used in the existing
codebase.

If we want to emulate debugging interfaces in compat layers we would need
to implement that from scratch anyway. We would need to be bug compatible
with other OSes too.

Proposed on tech-kern@.

Welcome to NetBSD 8.99.16!

Sponsored by <The NetBSD Foundation>
 1.40  09-Jan-2018  maya branches: 1.40.2;
remove struct emul's e_fault.

It used to be used by COMPAT_IRIX for the purpose of overriding
uvm_fault (only implemented in MIPS), now removed.

Ride 8.99.12 version bump.
 1.39  08-Aug-2017  maxv Move freebsd_machdep.h into sys/compat/freebsd, and don't install it. Now,
the compat_freebsd files are all contained in sys/compat/freebsd.
 1.38  19-Feb-2012  rmind branches: 1.38.2; 1.38.16;
Remove COMPAT_SA / KERN_SA. Welcome to 6.99.3!
Approved by core@.
 1.37  07-Jul-2010  chs branches: 1.37.8; 1.37.12;
many changes for COMPAT_LINUX:
- update the linux syscall table for each platform.
- support new-style (NPTL) linux pthreads on all platforms.
clone() with CLONE_THREAD uses 1 process with many LWPs
instead of separate processes.
- move the contents of sys__lwp_setprivate() into a new
lwp_setprivate() and use that everywhere.
- update linux_release[] and linux32_release[] to "2.6.18".
- adjust placement of emul fork/exec/exit hooks as needed
and adjust other emul code to match.
- convert all struct emul definitions to use named initializers.
- change the pid allocator to allow multiple pids to refer to the same proc.
- remove a few fields from struct proc that are no longer needed.
- disable the non-functional "vdso" code in linux32/amd64,
glibc works fine without it.
- fix a race in the futex code where we could miss a wakeup after
a requeue operation.
- redo futex locking to be a little more efficient.
 1.36  19-Nov-2008  ad branches: 1.36.6; 1.36.8;
Make the emulations, exec formats, coredump, NFS, and the NFS server
into modules. By and large this commit:

- shuffles header files and ifdefs
- splits code out where necessary to be modular
- adds module glue for each of the components
- adds/replaces hooks for things that can be installed at runtime
 1.35  15-Oct-2008  wrstuden branches: 1.35.2;
Merge wrstuden-revivesa into HEAD.
 1.34  19-Feb-2007  cube branches: 1.34.38; 1.34.42; 1.34.44; 1.34.48;
Introduce a new member to struct emul, e_startlwp, to be used by
sys__lwp_create. It allows using the said syscall under COMPAT_NETBSD32.

The libpthread regression tests now pass on amd64 and sparc64.
 1.33  09-Feb-2007  ad branches: 1.33.2;
Merge newlock2 to head.
 1.32  30-Aug-2006  christos branches: 1.32.2;
fix incomplete initializer
 1.31  11-Dec-2005  christos branches: 1.31.4; 1.31.8;
merge ktrace-lwp.
 1.30  13-Sep-2005  christos compat code reorg.
 1.29  10-Jul-2005  christos define syscall again.
 1.28  10-Jul-2005  christos No point in declaring syscall_intern and syscall in a zillion places.
 1.27  26-Mar-2005  fvdl branches: 1.27.2;
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.

* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2

Tested on amd64, compile-tested on sparc64.
 1.26  12-Sep-2004  jdolecek branches: 1.26.4; 1.26.6; 1.26.10;
only include emulation syscallnames with SYSCALL_DEBUG, it's not used otherwise
 1.25  20-Dec-2003  fvdl Put back Emmanuel's sigfilter hooks, as decided by Core.
 1.24  20-Dec-2003  manu Introduce lwp_emuldata and the associated hooks. No hook is provided for the
exec case, as the emulation already has the ability to intercept that
with the e_proc_exec hook. It is the responsability of the emulation to
take appropriaye action about lwp_emuldata in e_proc_exec.

Patch reviewed by Christos.
 1.23  05-Dec-2003  jdolecek back the sigfilter emulation hook change off
 1.22  03-Dec-2003  manu Add a sigfilter emulation hook. It is used at the beginning of kpsignal2()
so that a specific emulation has the oportunity to filter out some signals.

if sigfilter returns 0, then no signal is sent by kpsignal2().

There is another place where signals can be generated: trapsignal. Since this
function is already an emulation hook, no call to the sigfilter hook was
introduced in trapsignal.

This is needed to emulate the softsignal feature in COMPAT_DARWIN (signals
sent as Mach exception messages)
 1.21  06-Sep-2003  christos SA_SIGINFO changes
 1.20  24-Aug-2003  chs add support for non-executable mappings (where the hardware allows this)
and make the stack and heap non-executable by default. the changes
fall into two basic catagories:

- pmap and trap-handler changes. these are all MD:
= alpha: we already track per-page execute permission with the (software)
PG_EXEC bit, so just have the trap handler pay attention to it.
= i386: use a new GDT segment for %cs for processes that have no
executable mappings above a certain threshold (currently the
bottom of the stack). track per-page execute permission with
the last unused PTE bit.
= powerpc/ibm4xx: just use the hardware exec bit.
= powerpc/oea: we already track per-page exec bits, but the hardware only
implements non-exec mappings at the segment level. so track the
number of executable mappings in each segment and turn on the no-exec
segment bit iff the count is 0. adjust the trap handler to deal.
= sparc (sun4m): fix our use of the hardware protection bits.
fix the trap handler to recognize text faults.
= sparc64: split the existing unified TSB into data and instruction TSBs,
and only load TTEs into the appropriate TSB(s) for the permissions.
fix the trap handler to check for execute permission.
= not yet implemented: amd64, hppa, sh5

- changes in all the emulations that put a signal trampoline on the stack.
instead, we now put the trampoline into a uvm_aobj and map that into
the process separately.

originally from openbsd, adapted for netbsd by me.
 1.19  01-Nov-2002  jdolecek branches: 1.19.6;
set struct emul's nsysent to compat SYS_NSYSENT, not SYS_MAXSYSCALL
 1.18  21-Sep-2002  manu - Introduce a e_fault field in struct proc to provide emulation specific
memory fault handler. IRIX uses irix_vm_fault, and all other emulation
use NULL, which means to use uvm_fault.

- While we are there, explicitely set to NULL the uninitialized fields in
struct emul: e_fault and e_sysctl on most ports

- e_fault is used by the trap handler, for now only on mips. In order to avoid
intrusive modifications in UVM, the function pointed by e_fault does not
has exactly the same protoype as uvm_fault:
int uvm_fault __P((struct vm_map *, vaddr_t, vm_fault_t, vm_prot_t));
int e_fault __P((struct proc *, vaddr_t, vm_fault_t, vm_prot_t));

- In IRIX share groups, all the VM space is shared, except one page.
This bounds us to have different VM spaces and synchronize modifications
to the VM space accross share group members. We need an IRIX specific hook
to the page fault handler in order to propagate VM space modifications
caused by page faults.
 1.17  13-Nov-2001  lukem add RCSIDs (including regeneration of files as appropriate)
 1.16  18-Sep-2001  jdolecek Make the setregs hook emulation-specific, rather than executable
format specific.
Struct emul has a e_setregs hook back, which points to emulation-specific
setregs function. es_setregs of struct execsw now only points to
optional executable-specific setup function (this is only used for
ECOFF).
 1.15  18-Jun-2001  christos branches: 1.15.2; 1.15.4;
Add an e_trapsignal member to struct emul, so that emulated processes can
send the appropriate signal depending on the trap type.
 1.14  18-Dec-2000  jdolecek branches: 1.14.2;
separate the freebsd syscall code similarily to other emulations
 1.13  11-Dec-2000  mycroft Introduce 2 new flags in types.h:
* __HAVE_SYSCALL_INTERN. If this is defined, e_syscall is replaced by
e_syscall_intern, which is called at key places in the kernel. This can be
used to set a MD syscall handler pointer. This obsoletes and replaces the
*_HAS_SEPARATED_SYSCALL flags.
* __HAVE_MINIMAL_EMUL. If this is defined, certain (deprecated) elements in
struct emul are omitted.
 1.12  09-Dec-2000  jdolecek always fill in e_syscall in respective emul_*; if the emulation doesn't
have it's own separated *_syscall() function, use syscall()
 1.11  09-Dec-2000  mycroft Get rid of the damn EMUL_GET* flags.
 1.10  01-Dec-2000  jdolecek split aout and elf32 specific code to separate files
emul_freebsd: add emul flags
EMUL_HAS_SYS___syscall|EMUL_GETPID_PASS_PPID|EMUL_GETID_PASS_EID
 1.9  01-Dec-2000  jdolecek add e_path (emulation path) to struct emul, which replaces emulation-specific
*_emul_path variables

change macros CHECK_ALT_{CREAT|EXIST} to use that, 'root' doesn't need
to be passed explicitly any more and *_CHECK_ALT_{CREAT|EXIST} are removed
change explicit emul_find() calls in probe functions to get the emulation
path from the checked exec switch entry's emulation

remove no longer needed header files

add e_flags and e_syscall to struct emul; these are unsed and empty for now
 1.8  21-Nov-2000  jdolecek restructure struct emul and execsw, in preparation to make emulations LKMable:
* move all exec-type specific information from struct emul to execsw[] and
provide single struct emul per emulation
* elf:
- kern/exec_elf32.c:probe_funcs[] is gone, execsw[] how has one entry
per emulation and contains pointer to respective probe function
- interp is allocated via MALLOC() rather than on stack
- elf_args structure is allocated via MALLOC() rather than malloc()
* ecoff: the per-emulation hooks moved from alpha and mips specific code
to OSF1 and Ultrix compat code as appropriate, execsw[] has one entry per
emulation supporting ecoff with appropriate probe function
* the makecmds/probe functions don't set emulation, pointer to emulation is
part of appropriate execsw[] entry
* constify couple of structures
 1.7  13-Nov-2000  jdolecek change the type of *syscallnames[] array to 'const char * const foo[]'
 1.6  28-Jun-2000  mrg remove include of <vm/vm.h>. <vm/vm.h> -> <uvm/uvm_extern.h>
 1.5  25-Oct-1999  kleink branches: 1.5.6;
Update to match new SVR4-style definition names in <sys/exec_elf.h>.
 1.4  09-Feb-1999  christos branches: 1.4.8; 1.4.10; 1.4.12;
PR/6962: Paul Shupak: ELF Freebsd support
 1.3  24-Jan-1998  mycroft Use freebsd_setregs().
 1.2  18-May-1996  christos branches: 1.2.16;
- rename cpu_exec_aout_prep_oldzmagic to exec_aout_prep_oldzmagic
 1.1  10-Oct-1995  mycroft FreeBSD binary compatibility module, from Noriyuki Soda.
 1.2.16.1  29-Jan-1998  mellon Pull up 1.3 (mycroft)
 1.4.12.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.4.10.1  15-Nov-1999  fvdl Sync with -current
 1.4.8.5  05-Jan-2001  bouyer Sync with HEAD
 1.4.8.4  13-Dec-2000  bouyer Sync with HEAD (for UBC fixes).
 1.4.8.3  08-Dec-2000  bouyer Sync with HEAD.
 1.4.8.2  22-Nov-2000  bouyer Sync with HEAD.
 1.4.8.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.5.6.1  07-Mar-2002  he Apply patch (requested by jonathan):
Recognize FreeBSD ELFOSABI marked executables.
Patch is revisions 1.3-1.5 of freebsd_exec_elf32.c (new after branch)
 1.14.2.5  11-Nov-2002  nathanw Catch up to -current
 1.14.2.4  18-Oct-2002  nathanw Catch up to -current.
 1.14.2.3  14-Nov-2001  nathanw Catch up to -current.
 1.14.2.2  21-Sep-2001  nathanw Catch up to -current.
 1.14.2.1  21-Jun-2001  nathanw Catch up to -current.
 1.15.4.1  01-Oct-2001  fvdl Catch up with -current.
 1.15.2.2  10-Oct-2002  jdolecek sync kqueue with -current; this includes merge of gehenna-devsw branch,
merge of i386 MP branch, and part of autoconf rototil work
 1.15.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.19.6.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.19.6.4  01-Apr-2005  skrll Sync with HEAD.
 1.19.6.3  21-Sep-2004  skrll Fix the sync with head I botched.
 1.19.6.2  18-Sep-2004  skrll Sync with HEAD.
 1.19.6.1  03-Aug-2004  skrll Sync with HEAD
 1.26.10.1  18-Sep-2005  tron Pull up following revision(s) (requested by fvdl in ticket #798):
sys/compat/sunos/sunos_exec.c: revision 1.47
sys/compat/pecoff/pecoff_emul.c: revision 1.11
sys/arch/sparc64/sparc64/netbsd32_machdep.c: revision 1.45
sys/arch/amd64/amd64/netbsd32_machdep.c: revision 1.12
sys/sys/proc.h: revision 1.198
sys/compat/mach/mach_exec.c: revision 1.56
sys/compat/freebsd/freebsd_exec.c: revision 1.27
sys/arch/sparc64/include/vmparam.h: revision 1.27
sys/kern/kern_resource.c: revision 1.91
sys/compat/netbsd32/netbsd32_netbsd.c: revision 1.88
sys/compat/osf1/osf1_exec.c: revision 1.39
sys/compat/svr4_32/svr4_32_resource.c: revision 1.5
sys/compat/ultrix/ultrix_misc.c: revision 1.99
sys/compat/svr4_32/svr4_32_exec.h: revision 1.9
sys/kern/exec_elf32.c: revision 1.103
sys/compat/aoutm68k/aoutm68k_exec.c: revision 1.19
sys/compat/sunos32/sunos32_exec.c: revision 1.20
sys/compat/hpux/hpux_exec.c: revision 1.46
sys/compat/darwin/darwin_exec.c: revision 1.40
sys/kern/sysv_shm.c: revision 1.83
sys/uvm/uvm_extern.h: revision 1.99
sys/uvm/uvm_mmap.c: revision 1.89
sys/kern/kern_exec.c: revision 1.195
sys/compat/netbsd32/netbsd32.h: revision 1.31
sys/arch/sparc64/sparc64/svr4_32_machdep.c: revision 1.20
sys/compat/svr4/svr4_exec.c: revision 1.56
sys/compat/irix/irix_exec.c: revision 1.41
sys/compat/ibcs2/ibcs2_exec.c: revision 1.63
sys/compat/svr4_32/svr4_32_exec.c: revision 1.16
sys/arch/amd64/include/vmparam.h: revision 1.8
sys/compat/linux/common/linux_exec.c: revision 1.73
Fix some things regarding COMPAT_NETBSD32 and limits/VM addresses.
* For sparc64 and amd64, define *SIZ32 VM constants.
* Add a new function pointer to struct emul, pointing at a function
that will return the default VM map address. The default function
is uvm_map_defaultaddr, which just uses the VM_DEFAULT_ADDRESS
macro. This gives emulations control over the default map address,
and allows things to be mapped at the right address (in 32bit range)
for COMPAT_NETBSD32.
* Add code to adjust the data and stack limits when a COMPAT_NETBSD32
or COMPAT_SVR4_32 binary is executed.
* Don't use USRSTACK in kern_resource.c, use p_vmspace->vm_minsaddr
instead (emulations might have set it differently)
* Since this changes struct emul, bump kernel version to 3.99.2
Tested on amd64, compile-tested on sparc64.
 1.26.6.1  26-Mar-2005  yamt sync with head.
 1.26.4.1  29-Apr-2005  kent sync with -current
 1.27.2.3  26-Feb-2007  yamt sync with head.
 1.27.2.2  30-Dec-2006  yamt sync with head.
 1.27.2.1  21-Jun-2006  yamt sync with head.
 1.31.8.1  03-Sep-2006  yamt sync with head.
 1.31.4.1  09-Sep-2006  rpaulo sync with head
 1.32.2.1  30-Jan-2007  ad Remove support for SA. Ok core@.
 1.33.2.1  27-Feb-2007  yamt - sync with head.
- move sched_changepri back to kern_synch.c as it doesn't know PPQ anymore.
 1.34.48.2  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.34.48.1  19-Oct-2008  haad Sync with HEAD.
 1.34.44.1  10-May-2008  wrstuden Initial checkin of re-adding SA. Everything except kern_sa.c
compiles in GENERIC for i386. This is still a work-in-progress, but
this checkin covers most of the mechanical work (changing signalling
to be able to accomidate SA's process-wide signalling and re-adding
includes of sys/sa.h and savar.h). Subsequent changes will be much
more interesting.

Also, kern_sa.c has received partial cleanup. There's still more
to do, though.
 1.34.42.2  11-Aug-2010  yamt sync with head.
 1.34.42.1  04-May-2009  yamt sync with head.
 1.34.38.1  17-Jan-2009  mjf Sync with HEAD.
 1.35.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.36.8.1  05-Mar-2011  rmind sync with head
 1.36.6.1  17-Aug-2010  uebayasi Sync with HEAD.
 1.37.12.1  24-Feb-2012  mrg sync to -current.
 1.37.8.1  17-Apr-2012  yamt sync with head
 1.38.16.1  28-Aug-2017  skrll Sync with HEAD
 1.38.2.1  03-Dec-2017  jdolecek update from HEAD
 1.40.2.2  06-Sep-2018  pgoyette Sync with HEAD

Resolve a couple of conflicts (result of the uimin/uimax changes)
 1.40.2.1  21-May-2018  pgoyette Sync with HEAD
 1.41.2.1  10-Jun-2019  christos Sync with HEAD

RSS XML Feed