Commit Graph

1758 Commits

Author SHA1 Message Date
mrg
1e9cf43a79 extend the pmap_activate/pmap_deactivate UVMHIST logs to include the
pid, lid, and either l_name or p_comm.
2016-12-01 02:15:08 +00:00
mrg
07b8fffc31 allow the sizes of the maphist and pdhist to be set in the config
file via UVMHIST_MAPHIST_SIZE and UVMHIST_PDHIST_SIZE.
2016-12-01 02:09:03 +00:00
mrg
97d7454638 fix the output of ddb's "show uvmexp" and also print the
reserve_pagedaemon, reserve_kernel, and zeropages values.
2016-12-01 01:59:17 +00:00
mrg
4df368747f fix the start index generation in pmap_segtab_release() to
ensure it fits in the actual array.  fixes N64 binaries from
triggering later panic.  move the panic check itself into a
common function that is called from a couple of new places too.
2016-11-23 03:30:53 +00:00
christos
9015c01fa3 PR/51540: Henning Petersen: replace , with ; 2016-10-09 14:49:51 +00:00
skrll
061de4b243 Move some code before pmap_enter_pv in pmap_enter so that when we are
re-mapping a VA to a new PA the old mapping is removed first.  This means
the cache alias code need to do less work and works better with the last
va tracking.
2016-10-05 20:50:00 +00:00
skrll
07838e6706 Increment resident_count if we're remapping onto new PA as
pmap_remove -> pmap_pte_remote will decrement it
2016-09-30 12:10:40 +00:00
matt
cfe955c546 When removing a page, make sure to clear its execness regardless of whether
the page is clean or dirty.  This fixes the problem of execpages leaking
into the freepage lists.
2016-09-16 17:27:09 +00:00
mrg
bd0724a2f0 put a variable under the #ifdef it's only used in. 2016-08-20 20:09:47 +00:00
matt
a35e54e697 Don't track kenter_pa/kremove PVs unless we are worrying about cache aliasing. 2016-08-18 21:42:27 +00:00
skrll
b2c79c587e Make UVMHIST_PRINT work again by making it define KERNHIST_PRINT 2016-08-12 13:40:21 +00:00
kre
9b3c80dbbd The only error that can occur from munlock() on NetBSD is ENOMEM.
Make it be that way.
2016-08-09 12:17:04 +00:00
maxv
06ab45be44 KNF a little. 2016-08-07 10:07:58 +00:00
maxv
d6f286364d Explicitly return syscall-specific error codes, instead of the ones given
by range_test. This fixes msync, mlock and munlock, which all return EINVAL
instead of ENOMEM if the address is not in the va space.

It should also fix the recent ATF failures.
2016-08-07 09:55:18 +00:00
maxv
e727235220 The way the kernel tries to prevent a userland process from allocating page
zero is hugely flawed. It is easy to demonstrate that one can trick UVM
into chosing a NULL hint after the user_va0_disable check from uvm_map.
Such a bypass allows kernel NULL pointer dereferences to be exploitable on
architectures with a shared userland<->kernel VA, like amd64.

Fix this by increasing the limit of the vm space made available for
userland processes. This way, UVM will never chose a NULL hint, since it
would be outside of the vm space.

The user_va0_disable sysctl still controls this feature.
2016-08-06 15:13:13 +00:00
jakllsch
fb5b48267a Only include static inline pmap_asid_check() if it might be used.
Should fix HEAD-llvm evbppc autobuild.
2016-08-05 20:54:28 +00:00
martin
07832dcc0c PR kern/51371: fix misleading indentation 2016-07-28 07:52:06 +00:00
maxv
9192e87177 Use UVM_PROT_ALL only if UVM_KMF_EXEC is given as argument. Otherwise, if
UVM_KMF_PAGEABLE is also given as argument, only the VA is allocated and
UVM waits for the page to fault before kentering it. When kentering it, it
will use the UVM_PROT_ flag that was passed to uvm_map; which means that it
will kenter it as RWX.

With this change, the number of RWX pages in the amd64 kernel reaches
strictly zero.
2016-07-27 16:45:00 +00:00
matt
fbaba5f3ad Lock the tlbinfo if it wasn't when doing a pmap_tlb_pai_check 2016-07-23 20:06:25 +00:00
maxv
154c680895 Introduce uvm_km_protect. 2016-07-20 12:38:43 +00:00
skrll
bf5805b9c2 Use KERNEL_PID instead of 0 2016-07-14 15:50:31 +00:00
skrll
6f2e9c1031 Fix some comments. 2016-07-14 15:49:43 +00:00
skrll
ccd0ac494d Spell PMAP_TLB_NEED_SHOOTDOWN correctly 2016-07-14 05:00:51 +00:00
skrll
7f64d56466 Trailing whitespace 2016-07-14 04:49:55 +00:00
skrll
44cfabd557 Fix typo for build check 2016-07-12 15:30:46 +00:00
maya
d4a9fd26c1 Fix build by removing accidential duplicate line. 2016-07-11 19:16:03 +00:00
matt
5528d7fdbf Changes so that MIPS can use the common pmap.
Change/augment the virtual cache alias callbacks.
2016-07-11 16:06:09 +00:00
skrll
a867508b57 Remove '\n' from UVMHIST_LOG format - it is not needed. 2016-07-08 06:45:34 +00:00
msaitoh
8bc54e5be6 KNF. Remove extra spaces. No functional change. 2016-07-07 06:55:38 +00:00
martin
cda3a81fa7 Change two KASSERT to KASSERTMSG to provide better diagnostics. 2016-06-18 14:56:03 +00:00
pgoyette
e18edc06c0 Variable rv is always used as a true/false boolen, so set its type
correctly.

From PR kern/46369
2016-06-01 12:14:08 +00:00
christos
bafdaf94ba Avoid locking issues when copying out requires taking a fault and we are
finding out our own maps, by allocating a buffer and copying out after
we collected the information.
2016-06-01 00:49:44 +00:00
christos
19ea743456 Introduce security.pax.mprotect.ptrace sysctl which can be used to bypass
mprotect settings so that debuggers can write to the text segment of traced
processes so that they can insert breakpoints. Turned off by default.
Ok: chuq (for now)
2016-05-25 17:43:58 +00:00
martin
8ae1d7229f PR kern/50985: use the runtime limits of the vmspace in range_test()
instead of the compile time defaults for it.
2016-05-24 20:20:57 +00:00
christos
b039ee7763 reduce #ifdef mess caused by PaX 2016-05-22 14:26:09 +00:00
maxv
eeda8f022a Revert my previous change. I missed an entry on NXR. 2016-05-22 09:10:37 +00:00
maxv
54d6f71a61 USPACE and USPACE_ALIGN are constants. Use a #if instead. Probably saves
some instructions.
2016-05-21 06:37:28 +00:00
christos
57b625b6f2 remove more ifdefs 2016-04-07 12:06:50 +00:00
christos
03c12592a0 Add PAX_MPROTECT_DEBUG 2016-04-07 03:31:12 +00:00
riastradh
16f79cd0ea Use IPL_NONE for pserialized lock. Assert sleepable. (OOPS.) 2016-02-07 18:41:25 +00:00
christos
54eb2755d8 PR/50744: NONAKA Kimihiro: Protect more stuff with _KERNEL && _KMEMUSER to
make uvm_extern.h compile standalone again for net-snmp.
2016-02-05 04:18:55 +00:00
wiz
97b0e5c3cc Fix typo in comment. 2015-12-06 09:38:54 +00:00
mlelstv
4a1ce99b9b Clean up assertions and catch integer overflow. 2015-12-06 08:53:22 +00:00
martin
76713fa86f We never exec(2) with a kernel vmspace, so do not test for that, but instead
KASSERT() that we don't.
When calculating the load address for the interpreter (e.g. ld.elf_so),
we need to take into account wether the exec'd process will run with
topdown memory or bottom up. We can not use the current vmspace's flags
to test for that, as this happens too early. Luckily the execpack already
knows what the new state will be later, so instead of testing the current
vmspace, pass the info as additional argument to struct emul
e_vm_default_addr.
Fix all such functions and adopt all callers.
2015-11-26 13:15:34 +00:00
skrll
0ab5498d57 Remove #if 0 / #endif includes 2015-11-11 08:22:36 +00:00
skrll
b70033bc21 Split out the pmap_pv_track stuff for use by others.
Discussed with riastradh@
2015-11-11 08:20:22 +00:00
pgoyette
58afeafa2a Remove unnecessary #include for sys/shm.h - there's nothing here that needs
anything from there.
2015-11-05 00:12:28 +00:00
pgoyette
51126f7011 Now that SYSVSHM is modularized, reattach the linkages from uvm so that
we can correctly clean up on process exit or fork.

Without this, firefox attaches to a shared memory segment but doesn't
detach before exit.  Thus once firefox causes an autoload for sysv_ipc
it cannot be unloaded since the segment still retains references.
2015-11-05 00:10:47 +00:00
mrg
0b782e1e89 disable the previous for now; it fails for me on a different system. 2015-10-26 09:02:49 +00:00
mrg
6e1ac70a71 in uvm_obj_init(), KASSERT(ops), to ensure we have an actual pager ops
set for this object.  suggested by chuq.
2015-10-26 07:13:01 +00:00