Home | History | Annotate | Download | only in uvm
History log of /src/sys/uvm/uvm_unix.c
RevisionDateAuthorComments
 1.51  10-Jan-2022  christos Use p->p_stackbase instead of USRSTACK because the stackbase can move because
of ASLR.
 1.50  06-Jan-2018  kamil Revert vadvise(2) removal

This system call was used in legacy Lisp code, that was inherited to modern
age and still compiled against supported compat layers (e.g. in clisp,
oaklisp, Franz Lisp).

It used to instruct the kernel about paging policy (G/C aware, flush etc).

Newly compiled code (assuming that it will detect vadvise()) will use the
libc stub for vadvise(). The headers for this interface are gone.

vadvise(2) could be marked as COMPAT_80, but as long as we support ultrix,
sunos or aout68k ABI, don't bother with this.

Requested by <mrg>
 1.49  19-Dec-2017  kamil Drop SYS_vadvise

The (o)vadvise syscall is dummy since the beginning of NetBSD.

It is an obsolete remnant from the old UNIX.

Sponsored by <The NetBSD Foundation>
 1.48  06-May-2017  joerg Extend the mmap(2) interface to allow requesting protections for later
use with mprotect(2), but without enabling them immediately.

Extend the mremap(2) interface to allow duplicating mappings, i.e.
create a second range of virtual addresses references the same physical
pages. Duplicated mappings can have different effective protections.

Adjust PAX mprotect logic to disallow effective protections of W&X, but
allow one mapping W and another X protections. This obsoletes using
temporary files for purposes like JIT.

Adjust PAX logic for mmap(2) and mprotect(2) to fail if W&X is requested
and not silently drop the X protection.

Improve test cases to ensure correct operation of the changed
interfaces.
 1.47  07-Apr-2016  christos branches: 1.47.8;
remove more ifdefs
 1.46  07-Apr-2016  christos Add PAX_MPROTECT_DEBUG
 1.45  05-Sep-2014  matt branches: 1.45.2;
Don't use C++ new keyword as a variable name.
 1.44  02-Feb-2011  chuck branches: 1.44.14;
udpate license clauses on my code to match the new-style BSD licenses.
verified with Mike Hibler it is ok to remove clause 3 on utah copyright,
as per UCB.
based on diff that rmind@ sent me.

no functional change with this commit.
 1.43  15-Dec-2009  matt branches: 1.43.4; 1.43.6; 1.43.8;
Use PRIxVADDR... (change a printf/panic -> panic)
 1.42  27-Nov-2009  njoly Make break(2) reject high adresses that wrap to 0 after page rounding.
 1.41  04-Mar-2009  christos don't uprintf in non-debug kernels.
 1.40  02-Jan-2008  ad branches: 1.40.10; 1.40.12; 1.40.18; 1.40.24; 1.40.28;
Merge vmlocking2 to head.
 1.39  20-Dec-2007  dsl Convert all the system call entry points from:
int foo(struct lwp *l, void *v, register_t *retval)
to:
int foo(struct lwp *l, const struct foo_args *uap, register_t *retval)
Fixup compat code to not write into 'uap' and (in some cases) to actually
pass a correctly formatted 'uap' structure with the right name to the
next routine.
A few 'compat' routines that just call standard ones have been deleted.
All the 'compat' code compiles (along with the kernels required to test
build it).
98% done by automated scripts.
 1.38  09-Feb-2007  ad branches: 1.38.20; 1.38.26; 1.38.28; 1.38.32;
Merge newlock2 to head.
 1.37  18-Dec-2006  skrll Update uvm_grow to support stacks that grow upwards.

Use on hppa and fix a bug in the hppa trap handler.
 1.36  01-Nov-2006  yamt branches: 1.36.2;
remove some __unused from function parameters.
 1.35  12-Oct-2006  yamt remove unnecessary #include of vnode.h.
 1.34  12-Oct-2006  christos - sprinkle __unused on function decls.
- fix a couple of unused bugs
- no more -Wno-unused for i386
 1.33  20-May-2006  elad branches: 1.33.6; 1.33.8;
Better implementation of PaX MPROTECT, after looking some more into the
code and not trying to use temporary solutions.

Lots of comments and help from YAMAMOTO Takashi, also thanks to the PaX
author for being quick to recognize that something fishy's going on. :)

Hook up in mmap/vmcmd rather than (ugh!) uvm_map_protect().

Next time I suggest to commit a temporary solution just revoke my
commit bit.
 1.32  11-Dec-2005  christos branches: 1.32.4; 1.32.6; 1.32.8; 1.32.12; 1.32.14;
merge ktrace-lwp.
 1.31  27-Jun-2005  thorpej branches: 1.31.2;
Use ANSI function decls.
 1.30  28-Aug-2004  jdolecek uvm_grow(): avoid needless arithmetic and make LP64 safe
 1.29  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.28  25-May-2003  simonb branches: 1.28.2;
Consistancy nit- use parentheses around return argument.
 1.27  18-Jan-2003  thorpej Merge the nathanw_sa branch.
 1.26  08-Dec-2001  thorpej Make the coredump routine exec-format/emulation specific. Split
out traditional NetBSD coredump routines into core_netbsd.c and
netbsd32_core.c (for COMPAT_NETBSD32).
 1.25  10-Nov-2001  lukem add RCSIDs, and in some cases, slightly cleanup #include order
 1.24  06-Jun-2001  mrg branches: 1.24.2; 1.24.6;
uvm_coredump32() moved into compat/netbsd32.
 1.23  02-Jun-2001  chs replace vm_map{,_entry}_t with struct vm_map{,_entry} *.
 1.22  25-May-2001  chs remove trailing whitespace.
 1.21  06-May-2001  ross Fix overflow errors in brk(2).
 1.20  19-Mar-2001  simonb In sys_obreak(), the return value of atop() was being used to change
the process dsize for both positive and negative changes. Since atop()
casts its result to a paddr_t (which is unsigned), negative changes in
process data size resulted in unrealistic dsizes being set. Use
"dsize -= atop(-diff)" for a negative diffs. Fixes the "Impossible
process sizes" mentioned on current-users.

Unsigned cast catch and much debugging help from Martin Laubach.
 1.19  15-Mar-2001  chs eliminate the KERN_* error codes in favor of the traditional E* codes.
the mapping is:

KERN_SUCCESS 0
KERN_INVALID_ADDRESS EFAULT
KERN_PROTECTION_FAILURE EACCES
KERN_NO_SPACE ENOMEM
KERN_INVALID_ARGUMENT EINVAL
KERN_FAILURE various, mostly turn into KASSERTs
KERN_RESOURCE_SHORTAGE ENOMEM
KERN_NOT_RECEIVER <unused>
KERN_NO_ACCESS <unused>
KERN_PAGES_LOCKED <unused>
 1.18  13-Sep-2000  thorpej branches: 1.18.2;
Add an align argument to uvm_map() and some callers of that
routine. Works similarly fto pmap_prefer(), but allows callers
to specify a minimum power-of-two alignment of the region.
How we ever got along without this for so long is beyond me.
 1.17  07-Sep-2000  chs fix uvm_coredump32() just like uvm_coredump().
 1.16  24-Aug-2000  chs in uvm_coredump(), avoid dumping parts of the stack multiple times
while skipping parts of the stack that hasn't been used.
pointed out by SAITOH Masanobu <masanobu@iij.ad.jp>.
 1.15  10-Jul-2000  mrg fix a cast for sparc64.
 1.14  02-Jul-2000  thorpej - Avoid an integer overflow when checking if we have exceeded our
rlimit in sbrk. Slightly modified from a patch from Artur Grabowski.
- Rearrange code slightly, partially from Artur Grabowski.
- Only adjust vm_dsize if the grow or shrink actually succeeds.
 1.13  27-Jun-2000  mrg remove include of <vm/vm.h>
 1.12  30-Mar-2000  augustss branches: 1.12.4;
Remove more register declarations.
 1.11  26-Mar-2000  kleink Merge parts of chs-ubc2 into the trunk:
Add a new type voff_t (defined as a synonym for off_t) to describe offsets
into uvm objects, and update the appropriate interfaces to use it, the
most visible effect being the ability to mmap() file offsets beyond
the range of a vaddr_t.

Originally by Chuck Silvers; blame me for problems caused by merging this
into non-UBC.
 1.10  30-Dec-1999  eeh I should have made uvm_page_physload() take paddr_t's instead of vaddr_t's.
Also, add uvm_coredump32().
 1.9  04-Dec-1999  fvdl CL* clearout
 1.8  25-Mar-1999  mrg branches: 1.8.2; 1.8.4; 1.8.8; 1.8.14;
remove now >1 year old pre-release message.
 1.7  11-Oct-1998  chuck remove unused share map code from UVM:
- update calls to uvm_unmap_remove/uvm_unmap (mainonly boolean arg
has been removed)
- replace UVM_ET_ISMAP checks with UVM_ET_ISSUBMAP checks
 1.6  13-Aug-1998  eeh Merge paddr_t changes into the main branch.
 1.5  28-Jul-1998  thorpej branches: 1.5.2;
Don't cast the null residual pointer passed to vn_rdwr().
 1.4  09-Mar-1998  mrg KNF.
 1.3  07-Feb-1998  mrg restore rcsids
 1.2  06-Feb-1998  thorpej RCS ID police.
 1.1  05-Feb-1998  mrg branches: 1.1.1;
Initial revision
 1.1.1.1  05-Feb-1998  mrg initial import of the new virtual memory system, UVM, into -current.

UVM was written by chuck cranor <chuck@maria.wustl.edu>, with some
minor portions derived from the old Mach code. i provided some help
getting swap and paging working, and other bug fixes/ideas. chuck
silvers <chuq@chuq.com> also provided some other fixes.

this is the UVM kernel code portion.


this will be KNF'd shortly. :-)
 1.5.2.1  30-Jul-1998  eeh Split vm_offset_t and vm_size_t into paddr_t, psize_t, vaddr_t, and vsize_t.
 1.8.14.1  27-Dec-1999  wrstuden Pull up to last week's -current.
 1.8.8.2  27-Mar-2001  bouyer Sync with HEAD.
 1.8.8.1  20-Nov-2000  bouyer Update thorpej_scsipi to -current as of a month ago
 1.8.4.1  11-Aug-1999  chs add casts for trunc_page() and round_page() args.
 1.8.2.1  09-Sep-2000  he Pull up revision 1.16 (via patch, requested by chs):
In uvm_coredump(), avoid dumping parts of the stack multiple
times while skipping parts of the stack that hasn't been used.
 1.12.4.2  07-Sep-2000  chs pull up revs 1.16 and 1.17, approved by thorpej:
> in uvm_coredump*(), avoid dumping parts of the stack multiple times
> while skipping parts of the stack that haven't been used.
> pointed out by SAITOH Masanobu <masanobu@iij.ad.jp>.
 1.12.4.1  02-Jul-2000  thorpej Pull up rev. 1.14:
- Avoid an integer overflow when checking if we have exceeded our
rlimit in sbrk. Slightly modified from a patch from Artur Grabowski.
- Rearrange code slightly, partially from Artur Grabowski.
- Only adjust vm_dsize if the grow or shrink actually succeeds.
 1.18.2.7  12-Jul-2002  nathanw No longer need to pull in lwp.h; proc.h pulls it in for us.
 1.18.2.6  29-May-2002  nathanw #include <sys/sa.h> before <sys/syscallargs.h>, to provide sa_upcall_t
now that <sys/param.h> doesn't include <sys/sa.h>.

(Behold the Power of Ed)
 1.18.2.5  08-Jan-2002  nathanw Catch up to -current.
 1.18.2.4  14-Nov-2001  nathanw Catch up to -current.
 1.18.2.3  21-Jun-2001  nathanw Catch up to -current.
 1.18.2.2  09-Apr-2001  nathanw Catch up with -current.
 1.18.2.1  05-Mar-2001  nathanw Initial commit of scheduler activations and lightweight process support.
 1.24.6.1  12-Nov-2001  thorpej Sync the thorpej-mips-cache branch with -current.
 1.24.2.1  10-Jan-2002  thorpej Sync kqueue branch with -current.
 1.28.2.5  10-Nov-2005  skrll Sync with HEAD. Here we go again...
 1.28.2.4  21-Sep-2004  skrll Fix the sync with head I botched.
 1.28.2.3  18-Sep-2004  skrll Sync with HEAD.
 1.28.2.2  03-Sep-2004  skrll Sync with HEAD
 1.28.2.1  03-Aug-2004  skrll Sync with HEAD
 1.31.2.4  21-Jan-2008  yamt sync with head
 1.31.2.3  26-Feb-2007  yamt sync with head.
 1.31.2.2  30-Dec-2006  yamt sync with head.
 1.31.2.1  21-Jun-2006  yamt sync with head.
 1.32.14.1  19-Jun-2006  chap Sync with head.
 1.32.12.1  24-May-2006  tron Merge 2006-05-24 NetBSD-current into the "peter-altq" branch.
 1.32.8.1  24-May-2006  yamt sync with head.
 1.32.6.1  01-Jun-2006  kardel Sync with head.
 1.32.4.1  09-Sep-2006  rpaulo sync with head
 1.33.8.3  18-Dec-2006  yamt sync with head.
 1.33.8.2  10-Dec-2006  yamt sync with head.
 1.33.8.1  22-Oct-2006  yamt sync with head
 1.33.6.3  30-Jan-2007  ad Remove support for SA. Ok core@.
 1.33.6.2  12-Jan-2007  ad Sync with head.
 1.33.6.1  18-Nov-2006  ad Sync with head.
 1.36.2.1  04-Jan-2007  bouyer Pull up following revision(s) (requested by skrll in ticket #323):
sys/uvm/uvm_unix.c: revision 1.37
sys/arch/hppa/hppa/trap.c: revision 1.39
Update uvm_grow to support stacks that grow upwards.
Use on hppa and fix a bug in the hppa trap handler.
 1.38.32.1  02-Jan-2008  bouyer Sync with HEAD
 1.38.28.2  26-Dec-2007  ad - Push kernel_lock back into exit, wait and sysctl system calls, mainly
for visibility.
- Serialize calls to brk() from within the same process.
- Mark more syscalls MPSAFE.
 1.38.28.1  26-Dec-2007  ad Sync with head.
 1.38.26.1  18-Feb-2008  mjf Sync with HEAD.
 1.38.20.1  09-Jan-2008  matt sync with HEAD
 1.40.28.2  29-Apr-2011  matt Fix PRIdVSIZE macro
 1.40.28.1  23-Aug-2009  matt PRIxVADDR, PRIdVSIZE, PRIxVSIZE, or PRIxPADDR as appropriate.
Use __intXX_t or __uintXX_t as appropriate in <mips/types.h>
 1.40.24.1  13-May-2009  jym Sync with HEAD.

Commit is split, to avoid a "too many arguments" protocol error.
 1.40.18.1  28-Apr-2009  skrll Sync with HEAD.
 1.40.12.2  14-May-2008  wrstuden Per discussion with ad, remove most of the #include <sys/sa.h> lines
as they were including sa.h just for the type(s) needed for syscallargs.h.

Instead, create a new file, sys/satypes.h, which contains just the
types needed for syscallargs.h. Yes, there's only one now, but that
may change and it's probably more likely to change if it'd be difficult
to handle. :-)

Per discussion with matt at n dot o, add an include of satypes.h to
sigtypes.h. Upcall handlers are kinda signal handlers, and signalling
is the header file that's already included for syscallargs.h that
closest matches SA.

This shaves about 3000 lines off of the diff of the branch relative
to the base. That also represents about 18% of the total before this
checkin.

I think this reduction is very good thing.
 1.40.12.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.40.10.2  11-Mar-2010  yamt sync with head
 1.40.10.1  04-May-2009  yamt sync with head.
 1.43.8.1  08-Feb-2011  bouyer Sync with HEAD
 1.43.6.1  06-Jun-2011  jruoho Sync with HEAD.
 1.43.4.1  05-Mar-2011  rmind sync with head
 1.44.14.1  03-Dec-2017  jdolecek update from HEAD
 1.45.2.2  28-Aug-2017  skrll Sync with HEAD
 1.45.2.1  22-Apr-2016  skrll Sync with HEAD
 1.47.8.1  11-May-2017  pgoyette Sync with HEAD

RSS XML Feed