summaryrefslogtreecommitdiff
path: root/sys/uvm/uvm_mmap.c
AgeCommit message (Collapse)Author
2015-05-07Pass a thread pointer instead of its file descriptor table to getvnode(9).Martin Pieuchot
Input and ok millert@
2015-03-30Extend uvm_map_hint() to get an address range as extra arguments, and makeMiod Vallat
sure it will return an address within that range. Use this in uaddr_rnd_select() to make sure we will not attempt to pick an address beyond what we are allowed to map. In my trees for 9 months, blackmailed s2k15 attendees into agreeing now would be a good time to commit.
2015-02-13Include sys/stdint.h for SIZE_MAX instead of relying on the misplacedTodd C. Miller
define in sys/limits.h. OK guenther@
2015-02-07recombine some of the split uvm_mmap functions. the precondition checksTed Unangst
are not necessary because the caller already ensures these. the tail section for handing mlock can be shared as well. ok beck guenther
2015-02-06-Split out uvm_mmap and uvm_map into a version for anon's and a versionBob Beck
for everything else. -Adapt the anon version to be callable without the biglock held. Done by tedu@, kettenis@ and me.. pounded on a bunch. This does not yet make mmap a NOLOCK call, but permits it to be so. ok tedu@, kettenis@, guenther@ jsing@
2014-12-17Prefer MADV_* over POSIX_MADV_* in kernel for consistency: the latterPhilip Guenther
doesn't have all the values and therefore can't be used everywhere. ok deraadt@ kettenis@
2014-12-16primary change: move uvm_vnode out of vnode, keeping only a pointer.Ted Unangst
objective: vnode.h doesn't include uvm_extern.h anymore. followup changes: include uvm_extern.h or lock.h where necessary. ok and help from deraadt
2014-12-15Use MAP_INHERIT_* for the 'inh' argument to the UMV_MAPFLAG() macro,Philip Guenther
eliminating the must-be-kept-in-sync UVM_INH_* macros ok deraadt@ tedu@
2014-12-09Sprinkle in a little more mallocarray().Doug Hogan
ok deraadt@ tedu@
2014-11-16Replace a plethora of historical protection options with justTheo de Raadt
PROT_NONE, PROT_READ, PROT_WRITE, and PROT_EXEC from mman.h. PROT_MASK is introduced as the one true way of extracting those bits. Remove UVM_ADV_* wrapper, using the standard names. ok doug guenther kettenis
2014-10-03Introduce __MAP_NOFAULT, a mmap(2) flag that makes sure a mapping will notMark Kettenis
cause a SIGSEGV or SIGBUS when a mapped file gets truncated. Access to pages that are not backed by a file on such a mapping will be replaced by zero-filled anonymous pages. Makes passing file descriptors of mapped files usable without having to play tricks with signal handlers. "steal your mmap flag" deraadt@
2014-07-12add a size argument to free. will be used soon, but for now default to 0.Ted Unangst
after discussions with beck deraadt kettenis.
2014-07-08bye bye UBC; ok beck dlgTheo de Raadt
2014-07-02Use real parameter types for u{dv,vn}_attach() instead of void *Matthew Dempsky
ok guenther
2014-06-27Cleanup support for legacy mmap flagsMatthew Dempsky
Move all legacy MAP_FOO values behind #ifndef _KERNEL and redefine them to either be aliases for existing flags (e.g., MAP_COPY -> MAP_PRIVATE) or 0. Also, add MAP_OLDFOO defines (behind #ifndef _KERNEL) so the kernel and kdump can remain compatible with current OpenBSD binaries. ok deraadt
2014-04-13compress code by turning four line comments into one line comments.Ted Unangst
emphatic ok usual suspects, grudging ok miod
2013-05-30remove lots of comments about locking per beck's requestTed Unangst
2013-05-30remove simple_locks from uvm code. ok beck deraadtTed Unangst
2012-07-21Add a new mmap(2) flag __MAP_NOREMAP for use with MAP_FIXED toMatthew Dempsky
indicate that the kernel should fail with MAP_FAILED if the specified address is not currently available instead of unmapping it. Change ld.so on i386 to make use of __MAP_NOREMAP to improve reliability. __MAP_NOREMAP diff by guenther based on an earlier diff by Ariane; ld.so bits by guenther and me bulk build stress testing of earlier diffs by sthen ok deraadt; committing now for further testing
2012-04-22Add struct proc * argument to FRELE() and FILE_SET_MATURE() inPhilip Guenthe
anticipation of further changes to closef(). No binary change. ok krw@ miod@ deraadt@
2012-04-10Return EINVAL on 0-byte mmap invocation.Ariane van der Steldt
- Posix rules that a 0-byte mmap must return EINVAL - our allocators are unable to distinguish between free memory and 0 bytes of allocated memory
2012-03-09New vmmap implementation.Ariane van der Steldt
no oks (it is really a pain to review properly) extensively tested, I'm confident it'll be stable 'now is the time' from several icb inhabitants Diff provides: - ability to specify different allocators for different regions/maps - a simpler implementation of the current allocator - currently in compatibility mode: it will generate similar addresses as the old allocator
2011-07-09More syscalls.master cleanup:Matthew Dempsky
sys_osigaltstack() is 7 years old and no longer needed; all glory to the sys_sigaltstack()! sys_ogetdirentries() is about 9 months old, but still acceptable within our release cycle; move from STD to COMPAT_48 to make this clearer for tedu@ next year. sys_sbrk() and sys_sstk() are completely obsolete: all they do is return ENOSYS. ok guenther@
2011-07-05msync has some code that is based on *old* bsd behaviour whereOwain Ainsworth
msync(size == 0) did strange things based on the original mapping segments and trying to manipulate same. This code was copied from the original vm when we moved to uvm. posix says nothing about this behaviour and anything that depends on it is systemically broken, so rip it out and make sys_msync about 30% smaller. ok deraadt@, tedu@, guenther@.
2011-07-04move the specfs code to a place people can see it; ok guenther thib krwTheo de Raadt
2011-06-06Backout vmmap in order to repair virtual address selection algorithmsAriane van der Steldt
outside the tree.
2011-05-24Reimplement uvm/uvm_map.Ariane van der Steldt
vmmap is designed to perform address space randomized allocations, without letting fragmentation of the address space go through the roof. Some highlights: - kernel address space randomization - proper implementation of guardpages - roughly 10% system time reduction during kernel build Tested by alot of people on tech@ and developers. Theo's machines are still happy.
2010-12-24add a param to uvm_map_hint to not skip over the heap, and use it as a lastTed Unangst
resort if mmap fails otherwise to enable more complete address space utilization. tested for a while with no ill effects.
2010-12-15add a BRKSIZ define and use it for the heap gap constant, decouplingTed Unangst
heap gap from max data size. nothing else changes yet. ok deraadt
2010-05-21Fix a locking problem in mincore where it was possible for us to sleepOwain Ainsworth
with a spinlock (even vslocked() buffers may fault in the right (complicated) situation). We solve this by preallocating a bounded array for the response and copying the data out when all locks have been released. ok thib@, beck@
2009-07-25Add an extra argument to uvm_unmap_remove(), for the caller to tell itMiod Vallat
whether removing holes or parts of them is allowed or not. Only allow hole removal in uvmspace_free(), when tearing the vmspace down. ok art@
2009-07-22Put the PG_RELEASED changes diff back in.Owain Ainsworth
This has has been tested very very thoroughly on all archs we have excepting 88k and 68k. Please see cvs log for the individual commit messages. ok beck@, thib@
2009-07-09Remove the VREF() macro and replaces all instances with a call to verf(),Thordur I. Bjornsson
which is exactly what the macro does. Macro's that are nothing more then: #define FUNCTION(arg) function(arg) are almost always pointless and should go away. OK blambert@ Agreed by many.
2009-06-17date based reversion of uvm to the 4th May.Owain Ainsworth
More backouts in line with previous ones, this appears to bring us back to a stable condition. A machine forced to 64mb of ram cycled 10GB through swap with this diff and is still running as I type this. Other tests by ariane@ and thib@ also seem to show that it's alright. ok deraadt@, thib@, ariane@
2009-06-16Backout all changes to uvm after pmemrange (which will be backed outOwain Ainsworth
separately). a change at or just before the hackathon has either exposed or added a very very nasty memory corruption bug that is giving us hell right now. So in the interest of kernel stability these diffs are being backed out until such a time as that corruption bug has been found and squashed, then the ones that are proven good may slowly return. a quick hitlist of the main commits this backs out: mine: uvm_objwire the lock change in uvm_swap.c using trees for uvm objects instead of the hash removing the pgo_releasepg callback. art@'s: putting pmap_page_protect(VM_PROT_NONE) in uvm_pagedeactivate() since all callers called that just prior anyway. ok beck@, ariane@. prompted by deraadt@.
2009-06-01Deal with wraparound when checking RLIMIT_DATA.Todd C. Miller
OK guenther@ otto@
2009-06-01Since we've now cleared up a lot of the PG_RELEASED setting, remove theOwain Ainsworth
pgo_releasepg() hook and just free the page the "normal" way in the one place we'll ever see PG_RELEASED and should care (uvm_page_unbusy, called in aiodoned). ok art@, beck@, thib@
2009-03-20While working on some stuff in uvm I've gotten REALLY sick of readingOwain Ainsworth
K&R function declarations, so switch them all over to ansi-style, in accordance with the prophesy. "go for it" art@
2008-11-10vm_map_lock() around calls to uvm_map_findspace(); ok teduTheo de Raadt
2007-09-01replace the machine dependant bytes-to-clicks macro by the MI ptoa()Martin Reindl
version for i386 more architectures and ctob() replacement is being worked on prodded by and ok miod
2007-06-18Bring back Mickey's UVM anon change. Testing by thib@, beck@ andPedro Martelletto
ckuethe@ for a while. Okay beck@, "it is good timing" deraadt@.
2007-05-31zap the vm_amap am_l simplelock, and amap_{lock/unlock} macros forThordur I. Bjornsson
simple_{lock/unlock}. ok art@
2007-03-27Clean up some return value handling now that we know that what's returnedArtur Grabowski
is proper errnos. millert@ ok and some help
2007-03-26Rip out the KERN_ error codes.Artur Grabowski
ok otto@
2007-03-25remove KERN_SUCCESS and use 0 instead.Artur Grabowski
eyeballed by miod@ and pedro@
2007-02-25Make integer wrap checks the same for mmap, munmap, msync, etcTodd C. Miller
by factoring most of the checks into a macro. OK otto@
2006-07-13Back out the anon change. Apparently it was tested by a few, but most ofTheo de Raadt
us did not see it or get a chance to test it before it was commited. It broke cvs, in the ami driver, making it not succeed at seeing it's devices.
2006-06-29fallout from previous: remmapping anonymous memory did not account dsize ↵Michael Shalayeff
proper; found by krause and mmap_fixed
2006-06-21from netbsd: make anons dynamically allocated from pool.Michael Shalayeff
this results in lesse kva waste due to static preallocation of those for every phys page and also every swap page. tested by beck krw miod
2006-04-06Fix a process datasize leak with MAP_FIXED. When zapping old mappingsKurt Miller
call uvm_unmap_p instead of uvm_unmap so that it has the process information and can adjust vm_dused. okay pedro@ tedu@