summaryrefslogtreecommitdiff
path: root/sys/uvm
AgeCommit message (Collapse)Author
2017-07-20Accessing a mmap(2)ed file behind its end should result in a SIGBUSAlexander Bluhm
according to POSIX. Bring regression test and kernel in line for amd64 and i386. Other architectures have to follow. OK deraadt@ kettenis@
2017-05-21Enable radeondrm(4) on loongson to get accelerated graphicsVisa Hankala
with the RS780E chipset. OK kettenis@, jsg@
2017-05-17Raise "uvm_map_entry_kmem_pool" IPL level to IPL_VM to prevent a deadlock.Martin Pieuchot
A deadlock can occur when the uvm_km_thread(), running without KERNEL_LOCK() is interrupted by and non-MPSAFE handler while holding the pool's mutex. At that moment if another CPU is holding the KERNEL_LOCK() and wants to grab the pool mutex, like in sys_kbind(), kaboom! This is a temporaty solution, a more generate approach regarding mutexes and un-KERNEL_LOCK()ed threads is beeing discussed. Deadlock reported by sthen@, ok kettenis@
2017-05-15Enable the NET_LOCK(), take 3.Martin Pieuchot
Recursions are still marked as XXXSMP. ok deraadt@, bluhm@
2017-05-11unbreak PMAP_DIRECT archs.David Gwynne
found by jmc@
2017-05-11reorder uvm init to avoid use before initialisation.David Gwynne
the particular use before init was in uvm_init step 6, which calls kmeminit to set up malloc(9), which calls uvm_km_zalloc, which calls pmap_enter, which calls pool_get, which tries to allocate a page using km_alloc, which isnt initalised until step 9 in uvm_init. uvm_km_page_init calls kthread_create though, which uses malloc internally, so it cant be reordered before malloc init. to cope with this, uvm_km_page_init is split up. it sets up the subsystem, and is called before kmeminit. the thread init is moved to uvm_km_page_lateinit, which is called after kmeminit in uvm_init.
2017-05-09Stop considering some sleeping threads are running.Martin Pieuchot
PZERO used to be a special value in the first BSD releases but since the introduction of tsleep(9) there's no way to tell if a thread is going to sleep for a "short" period of time. This remove the only (ab)use of ``p_priority'' outside the scheuler logic, which will help moving avway from a priority-based scheduler. ok visa@
2017-05-08Unifed PMAP_UAREA, unused since we stopped supporting ARM < v7.Martin Pieuchot
ok kettenis@
2017-05-03Mark uvm_sync_lock as vnode'ish for witness purposes, as it is takenPhilip Guenther
between mount locks and inode locks, which may been recorded in either order ok visa@
2017-04-30Unifdef KGDB.Martin Pieuchot
It doesn't compile und hasn't been working during the last decade. ok kettenis@, deraadt@
2017-04-20Tweak lock inits to make the system runnable with witness(4)Visa Hankala
on amd64 and i386.
2017-04-09Convert a malloc(9) to mallocarray(9)David Hill
ok deraadt@
2017-03-17Revert the NET_LOCK() and bring back pf's contention lock for release.Martin Pieuchot
For the moment the NET_LOCK() is always taken by threads running under KERNEL_LOCK(). That means it doesn't buy us anything except a possible deadlock that we did not spot. So make sure this doesn't happen, we'll have plenty of time in the next release cycle to stress test it. ok visa@
2017-03-09Don't take the vmmap lock when dumping core: it's not actually necessaryPhilip Guenther
and it creates a lock-order-reversal with inode locks ok stefan@
2017-03-05Handle unshared amaps in uvm_coredump_walkmap() such that untouched pagesPhilip Guenther
don't get written out to the core file but rather are represented via segments which have memory size greater than their file size. This shrinks core files and eliminates a case where core dumping fails with EFAULT. This can still happen in the shared amap case. Based on a problem report from (and testing by) semarie@ ok stefan@
2017-03-05Generating a coredump requires walking the map twice; changePhilip Guenther
uvm_coredump_walkmap() to do both with a callback in between so it can hold locks/change state across the two. ok stefan@
2017-02-14Convert most of the manual checks for CPU hogging to sched_pause().Martin Pieuchot
The distinction between preempt() and yield() stays as it is usueful to know if a thread decided to yield by itself or if the kernel told him to go away. ok tedu@, guenther@
2017-02-12Split up fork1():Philip Guenther
- FORK_THREAD handling is a totally separate function, thread_fork(), that is only used by sys___tfork() and which loses the flags, func, arg, and newprocp parameters and gains tcb parameter to guarantee the new thread's TCB is set before the creating thread returns - fork1() loses its stack and tidptr parameters Common bits factor out: - struct proc allocation and initialization moves to thread_new() - maxthread handling moves to fork_check_maxthread() - setting the new thread running moves to fork_thread_start() The MD cpu_fork() function swaps its unused stacksize parameter for a tcb parameter. luna88k testing by aoyama@, alpha testing by dlg@ ok mpi@
2017-02-05Update a comment that suggested the stack was executable. Nope!Philip Guenther
2017-02-05Delete comment obsoleted by the rewrite in rev 1.136 (2011-05-24)Philip Guenther
2017-02-02When dumping core, skip pages marked as unreadable instead of abortingPhilip Guenther
the dump. tracked down with help from semarie@ ok mpi@
2017-01-31Sprinkle some free sizes in uvm/David Hill
ok stefan@ visa@
2017-01-25Enable the NET_LOCK(), take 2.Martin Pieuchot
Recursions are currently known and marked a XXXSMP. Please report any assert to bugs@
2017-01-23Move static function to the bottom of the file, to the only userPatrick Wildt
of that function, to guard it with SMALL_KERNEL. ok mpi@
2017-01-21p_comm is the process's command and isn't per thread, so move it fromPhilip Guenther
struct proc to struct process. ok deraadt@ kettenis@
2017-01-17Remove uaddr_hint allocatorStefan Kempf
The hint allocator would have to check that the allocation does not overlap with brk, stack or text areas. This would make the address selectors too entagled. Just use the rnd allocator for hinted allocations in case pivots are used. This also reduces the amount of code somewhat. ok kettenis visa deraadt
2016-11-07Split PID from TID, giving processes a PID unrelated to the TID of theirPhilip Guenther
initial thread ok jsing@ kettenis@
2016-10-19Change pmap_proc_iflush() to take a process instead of a procPhilip Guenther
powerpc: rename second argument of pmap_proc_iflush() to match other archs ok kettenis@
2016-10-08Prevent infinite loops for amap allocations with >= 2^17 slotsStefan Kempf
This was caused by an integer overflow in a loop. mlarkin@ noticed the hang when trying to run a vmm(4) guest with lots of RAM.
2016-10-05Display/test/use the process PID, not the thread's TID, in a few places.Philip Guenther
ok mpi@ mikeb@
2016-09-24use hashfree for aobj hashes. from Mathieu -Ted Unangst
ok guenther
2016-09-16put RBT_PROTOTYPE inside #ifdef _KERNELDavid Gwynne
2016-09-16fix some DEBUG code so its using the right rb tree codeDavid Gwynne
2016-09-16fix spelling of RBT_NEXT in a commentDavid Gwynne
2016-09-16move uvm_pmemrange_addr from RB macros to RBT functionsDavid Gwynne
2016-09-16move the vm_page struct from being stored in RB macro trees to RBT functionsDavid Gwynne
vm_page structs go into three trees, uvm_objtree, uvm_pmr_addr, and uvm_pmr_size. all these have been moved to RBT code. this should give us a decent chunk of code space back.
2016-09-16move uaddr_free_rbtree from RB macros to RBT functionsDavid Gwynne
2016-09-16move the uvm_map_addr RB tree from RB macros to the RBT functionsDavid Gwynne
this tree is interesting because it uses all the red black tree features, specifically the augment callback thats called on tree topology changes, and it poisons and checks entries as theyre removed from and inserted back into the tree respectively. ok stefan@
2016-09-15all pools have their ipl set via pool_setipl, so fold it into pool_init.David Gwynne
the ioff argument to pool_init() is unused and has been for many years, so this replaces it with an ipl argument. because the ipl will be set on init we no longer need pool_setipl. most of these changes have been done with coccinelle using the spatch below. cocci sucks at formatting code though, so i fixed that by hand. the manpage and subr_pool.c bits i did myself. ok tedu@ jmatthew@ @ipl@ expression pp; expression ipl; expression s, a, o, f, m, p; @@ -pool_init(pp, s, a, o, f, m, p); -pool_setipl(pp, ipl); +pool_init(pp, s, a, ipl, f, m, p);
2016-09-03Only use uaddr_exe for address selection when PROT_EXEC is requestedStefan Kempf
Checking whether a memory range could be mprotect()'ed to PROT_EXEC attempts to put every mapping into the uaddr_exe range, if it exists. This would fill up the exe range on i386 quickly, once uaddr_exe gets used. So only use uaddr_exe if we know PROT_EXEC is needed for sure No change in current behavior, since uaddr_exe will only be used with uvm pivots. ok tedu@
2016-09-02Mask out lower bits of randomly selected addressStefan Kempf
Fixes uvm pivots bug that would create non-page aligned addresses. This fix is in code that's not yet enabled.
2016-08-31Simplify arguments to uaddr_*_create functionsStefan Kempf
min is already clamped before invoking these functions. ok kettenis@
2016-08-18uvm_wxcheck() should only abort the process if kern.wxabort is set.Theo de Raadt
The new semantics are W^X violations are reported to the application via ENOTSUP. Forgot to fix this during the last change. Spotted by kettenis
2016-08-12Include map entries that have an amap associated with them in the coredump.Mark Kettenis
This fixes coredumps of processes that use relro to make part of their writable address space read-only. ok guenther@
2016-08-11replace abuse of the static map entries RB_ENTRY pointers with an SLISTDavid Gwynne
free static entries are kept in a simple linked list, so use SLIST to make this obvious. the RB_PARENT manipulations are ugly and confusing. ok kettenis@
2016-08-08W^X violations are only permitted for binaries marked "wxneeded" onTheo de Raadt
"wxallowed" filesystems. mmap(2) & mprotect(2) now return ENOTSUP. (To diagnose buggy programs, consider using sysctl kern.wxabort=1 and looking at the coredumps) ok kettenis tedu naddy
2016-07-30Check for wraparound before the "commit" phase of uvm_map() and uvm_mapanon(),Mark Kettenis
to prevent hitting assertions and/or corrupting data structures during that phase. ok deraadt@, tedu@
2016-07-30Add a few checks for potential integer overflow and underflow related to theMark Kettenis
size of an address range. ok deraadt@, tedu@
2016-07-29add a check that the arguments to isavail don't overflow.Ted Unangst
callers should probably check too, but checking here won't hurt. possible panic reported by tim newsham. ok kettenis
2016-07-27check flags with mask instead of equality, in case we decide to mixTed Unangst
another flag in at some point. ok stefan