Home | History | Annotate | Download | only in amd64
History log of /src/sys/compat/linux/arch/amd64/linux_exec_machdep.c
RevisionDateAuthorComments
 1.25  01-Oct-2024  riastradh sys/compat/linux/arch: Nix trailing whitespace.

No functional change intended.
 1.24  05-Sep-2020  riastradh branches: 1.24.26;
Round of uvm.h cleanup.

The poorly named uvm.h is generally supposed to be for uvm-internal
users only.

- Narrow it to files that actually need it -- mostly files that need
to query whether curlwp is the pagedaemon, which should maybe be
exposed by an external header.

- Use uvm_extern.h where feasible and uvm_*.h for things not exposed
by it. We should split up uvm_extern.h but this will serve for now
to reduce the uvm.h dependencies.

- Use uvm_stat.h and #ifdef UVMHIST uvm.h for files that use
UVMHIST(ubchist), since ubchist is declared in uvm.h but the
reference evaporates if UVMHIST is not defined, so we reduce header
file dependencies.

- Make uvm_device.h and uvm_swap.h independently includable while
here.

ok chs@
 1.23  12-Jan-2020  ad Tidy up the vnode locking around execve() on ELF images to acquire and
release the locks fewer times. Proposed on tech-kern a very long time go.
 1.22  23-Feb-2014  njoly branches: 1.22.30; 1.22.36;
Use cprng_strong32 for LINUX_AT_RANDOM on amd64 too.
 1.21  21-Feb-2014  maxv Increase LINUX32_ELF_AUX_ENTRIES to avoid overrun in linux32/. Also,
add comments and KASSERTs to make sure people don't forget to increase
XX_AUX_ENTRIES's when adding vectors.

Reported by martin@ (CV), with suggestions from chs@.

ok martin@ chs@
 1.20  18-Nov-2013  chs implement AT_RANDOM.
 1.19  03-Feb-2012  matt branches: 1.19.6; 1.19.10;
Add a hook for freeing an ep_emul_arg. Add a wrapper routine
(exec_free_emul_arg) to call the hook and then clear the ep_emul_arg
and ep_emul_arg_free members in the exec_package.
Change users/accessors to use these routines.
Approved by releng.
 1.18  07-Jul-2010  chs branches: 1.18.8; 1.18.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.17  09-Feb-2010  njoly branches: 1.17.2;
Small typo in comment.
 1.16  29-Mar-2009  mrg branches: 1.16.2;
- add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes. this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.

- adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.

- add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)

- patch sh, and csh to notice RLIMIT_AS. (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)

- patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.

- update irix, svr4, svr4_32, linux and osf1 emulations to support
this information. (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)


this addresses PR 7897. it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.

tested on i386 and sparc64, build tested on several other platforms.

thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)
 1.15  15-Mar-2009  cegger ansify function definitions
 1.14  20-Nov-2008  ad branches: 1.14.4;
PR port-amd64/39964 modules/compat_linux: missing symbols on amd64
 1.13  28-Oct-2008  christos branches: 1.13.2;
populate init_thread_area.
 1.12  26-Oct-2008  christos branches: 1.12.2;
fix include order; machdep needs to be first for LINUX_NPTL to be defined.
 1.11  25-Oct-2008  christos Add preliminary tls support for i386. Does not work yet. From FreeBSD.
 1.10  19-Oct-2007  ad branches: 1.10.16; 1.10.20; 1.10.26;
machine/{bus,cpu,intr}.h -> sys/{bus,cpu,intr}.h
 1.9  29-Jan-2007  hubertf branches: 1.9.6; 1.9.18; 1.9.20; 1.9.24;
Remove more duplicate headers.
Patch by Slava Semushin <slava.semushin@gmail.com>

Again, this was tested by comparing obj files from a pristine and a patched
source tree against an i386/ALL kernel, and also for src/sbin/fsck_ffs,
src/sbin/fsdb and src/usr.sbin/makefs. Only changes in assert() line numbers
were detected in 'objdump -d' output.
 1.8  23-Jul-2006  ad branches: 1.8.4;
Use the LWP cached credentials where sane.
 1.7  15-May-2006  yamt include kauth.h for kauth_cred_getgid.
 1.6  14-May-2006  elad integrate kauth.
 1.5  16-Dec-2005  christos branches: 1.5.4; 1.5.6; 1.5.8; 1.5.10; 1.5.12;
PR/32303: Nicolas Joly: Fix -current amd64 kernel compilation failure with
options COMPAT_LINUX
 1.4  14-Dec-2005  christos proc to lwp change
 1.3  11-Dec-2005  christos merge ktrace-lwp.
 1.2  20-May-2005  fvdl branches: 1.2.2; 1.2.8;
Define linux_usertrap function, and set it in struct emul. For all
but amd64, it just returns 0, doing nothing.

For amd64, it implements vsyscalls through cheating: if the faulting
address is in the vsyscall area (which is statically known on Linux/amd64),
and the intruction pointer is too, it must have been a vsyscall. In that
case, retrieve the return address from the user stack, fix up %rip and
%rsp, and just execute the normal system call. It will return as if
the vsyscall has been executed.
 1.1  03-May-2005  manu First work on COMPAT_LINUX/amd64
Process startup and dynamiclinking work, but processes hang due to
Linux arch_prctl(2) not being really supported yet.
 1.2.8.2  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.2.8.1  20-May-2005  skrll file linux_exec_machdep.c was added on branch ktrace-lwp on 2005-11-10 14:00:59 +0000
 1.2.2.4  27-Oct-2007  yamt sync with head.
 1.2.2.3  26-Feb-2007  yamt sync with head.
 1.2.2.2  30-Dec-2006  yamt sync with head.
 1.2.2.1  21-Jun-2006  yamt sync with head.
 1.5.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.5.10.1  08-Mar-2006  elad Adapt to kernel authorization KPI.
 1.5.8.2  11-Aug-2006  yamt sync with head
 1.5.8.1  24-May-2006  yamt sync with head.
 1.5.6.1  01-Jun-2006  kardel Sync with head.
 1.5.4.1  09-Sep-2006  rpaulo sync with head
 1.8.4.1  01-Feb-2007  ad Sync with head.
 1.9.24.1  25-Oct-2007  bouyer Sync with HEAD.
 1.9.20.1  06-Nov-2007  matt sync with HEAD
 1.9.18.1  26-Oct-2007  joerg Sync with HEAD.

Follow the merge of pmap.c on i386 and amd64 and move
pmap_init_tmp_pgtbl into arch/x86/x86/pmap.c. Modify the ACPI wakeup
code to restore CR4 before jumping back into kernel space as the large
page option might cover that.
 1.9.6.1  23-Oct-2007  ad Sync with head.
 1.10.26.1  13-Dec-2008  haad Update haad-dm branch to haad-dm-base2.
 1.10.20.3  11-Aug-2010  yamt sync with head.
 1.10.20.2  11-Mar-2010  yamt sync with head
 1.10.20.1  04-May-2009  yamt sync with head.
 1.10.16.1  17-Jan-2009  mjf Sync with HEAD.
 1.12.2.2  28-Apr-2009  skrll Sync with HEAD.
 1.12.2.1  19-Jan-2009  skrll Sync with HEAD.
 1.13.2.1  01-Apr-2009  snj Pull up following revision(s) (requested by mrg in ticket #622):
bin/csh/csh.1: revision 1.46
bin/csh/func.c: revision 1.37
bin/ps/print.c: revision 1.111
bin/ps/ps.c: revision 1.74
bin/sh/miscbltin.c: revision 1.38
bin/sh/sh.1: revision 1.92 via patch
external/bsd/top/dist/machine/m_netbsd.c: revision 1.7
lib/libkvm/kvm_proc.c: revision 1.82
sys/arch/mips/mips/cpu_exec.c: revision 1.55
sys/compat/darwin/darwin_exec.c: revision 1.57
sys/compat/ibcs2/ibcs2_exec.c: revision 1.73
sys/compat/irix/irix_resource.c: revision 1.15
sys/compat/linux/arch/amd64/linux_exec_machdep.c: revision 1.16
sys/compat/linux/arch/i386/linux_exec_machdep.c: revision 1.12
sys/compat/linux/common/linux_limit.h: revision 1.5
sys/compat/osf1/osf1_resource.c: revision 1.14
sys/compat/svr4/svr4_resource.c: revision 1.18
sys/compat/svr4_32/svr4_32_resource.c: revision 1.17
sys/kern/exec_subr.c: revision 1.62
sys/kern/init_sysctl.c: revision 1.160
sys/kern/kern_exec.c: revision 1.288
sys/kern/kern_resource.c: revision 1.151
sys/sys/param.h: patch
sys/sys/resource.h: revision 1.31
sys/sys/sysctl.h: revision 1.184
sys/uvm/uvm_extern.h: revision 1.153
sys/uvm/uvm_glue.c: revision 1.136
sys/uvm/uvm_mmap.c: revision 1.128
usr.bin/systat/ps.c: revision 1.32
- - add new RLIMIT_AS (aka RLIMIT_VMEM) resource that limits the total
address space available to processes. this limit exists in most other
modern unix variants, and like most of them, our defaults are unlimited.
remove the old mmap / rlimit.datasize hack.
- - adds the VMCMD_STACK flag to all the stack-creation vmcmd callers.
it is currently unused, but was added a few years ago.
- - add a pair of new process size values to kinfo_proc2{}. one is the
total size of the process memory map, and the other is the total size
adjusted for unused stack space (since most processes have a lot of
this...)
- - patch sh, and csh to notice RLIMIT_AS. (in some cases, the alias
RLIMIT_VMEM was already present and used if availble.)
- - patch ps, top and systat to notice the new k_vm_vsize member of
kinfo_proc2{}.
- - update irix, svr4, svr4_32, linux and osf1 emulations to support
this information. (freebsd could be done, but that it's best left
as part of the full-update of compat/freebsd.)
this addresses PR 7897. it also gives correct memory usage values,
which have never been entirely correct (since mmap), and have been
very incorrect since jemalloc() was enabled.
tested on i386 and sparc64, build tested on several other platforms.
thanks to many folks for feedback and testing but most espcially
chuq and yamt for critical suggestions that lead to this patch not
having a special ugliness i wasn't happy with anyway :-)
 1.14.4.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.16.2.2  17-Aug-2010  uebayasi Sync with HEAD.
 1.16.2.1  30-Apr-2010  uebayasi Sync with HEAD.
 1.17.2.1  05-Mar-2011  rmind sync with head
 1.18.12.1  18-Feb-2012  mrg merge to -current.
 1.18.8.2  22-May-2014  yamt sync with head.

for a reference, the tree before this commit was tagged
as yamt-pagecache-tag8.

this commit was splitted into small chunks to avoid
a limitation of cvs. ("Protocol error: too many arguments")
 1.18.8.1  17-Apr-2012  yamt sync with head
 1.19.10.1  18-May-2014  rmind sync with head
 1.19.6.1  20-Aug-2014  tls Rebase to HEAD as of a few days ago.
 1.22.36.1  17-Jan-2020  ad Sync with head.
 1.22.30.1  08-Apr-2020  martin Merge changes from current as of 20200406
 1.24.26.1  02-Aug-2025  perseant Sync with HEAD

RSS XML Feed