minix/lib/libsys
Ben Gras 565f13088f make vfs & filesystems use failable copying
Change the kernel to add features to vircopy and safecopies so that
transparent copy fixing won't happen to avoid deadlocks, and such copies
fail with EFAULT.

Transparently making copying work from filesystems (as normally done by
the kernel & VM when copying fails because of missing/readonly memory)
is problematic as it can happen that, for file-mapped ranges, that that
same filesystem that is blocked on the copy request is needed to satisfy
the memory range, leading to deadlock. Dito for VFS itself, if done with
a blocking call.

This change makes the copying done from a filesystem fail in such cases
with EFAULT by VFS adding the CPF_TRY flag to the grants. If a FS call
fails with EFAULT, VFS will then request the range to be made available
to VM after the FS is unblocked, allowing it to be used to satisfy the
range if need be in another VFS thread.

Similarly, for datacopies that VFS itself does, it uses the failable
vircopy variant and callers use a wrapper that talk to VM if necessary
to get the copy to work.

	. kernel: add CPF_TRY flag to safecopies
	. kernel: only request writable ranges to VM for the
	  target buffer when copying fails
	. do copying in VFS TRY-first
	. some fixes in VM to build SANITYCHECK mode
	. add regression test for the cases where
	  - a FS system call needs memory mapped in a process that the
	    FS itself must map.
	  - such a range covers more than one file-mapped region.
	. add 'try' mode to vircopy, physcopy
	. add flags field to copy kernel call messages
	. if CP_FLAG_TRY is set, do not transparently try
	  to fix memory ranges
	. for use by VFS when accessing user buffers to avoid
	  deadlock
	. remove some obsolete backwards compatability assignments
        . VFS: let thread scheduling work for VM requests too
          Allows VFS to make calls to VM while suspending and resuming
          the currently running thread. Does currently not work for the
          main thread.
        . VM: add fix memory range call for use by VFS

Change-Id: I295794269cea51a3163519a9cfe5901301d90b32
2014-07-28 17:05:14 +02:00
..
arch Getting rid of "old-style-definition" 2014-07-28 17:05:09 +02:00
alloc_util.c drop the minix_ prefixes for mmap and munmap 2014-03-03 20:47:03 +01:00
assert.c drivers: resolve compiler warnings 2012-03-05 22:32:55 +01:00
asynsend.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
checkperms.c libsys: various updates 2014-03-01 09:05:00 +01:00
copyfd.c Clean up interface to PM and VFS 2014-03-01 09:05:01 +01:00
ds.c libsys: various updates 2014-03-01 09:05:00 +01:00
env_get_prm.c Getting rid of "old-style-definition" 2014-07-28 17:05:09 +02:00
env_panic.c vm: make WARNS=5 proof 2013-09-06 11:51:20 +02:00
env_parse.c vm: make WARNS=5 proof 2013-09-06 11:51:20 +02:00
env_prefix.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
fkey_ctl.c libsys: various updates 2014-03-01 09:05:00 +01:00
gcov.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
getepinfo.c Clean up interface to PM and VFS 2014-03-01 09:05:01 +01:00
getprocnr.c Clean up interface to PM and VFS 2014-03-01 09:05:01 +01:00
getsysinfo.c For common calls, give servers unique call numbers 2014-03-01 09:05:00 +01:00
getticks.c libc: add clock_getres()/clock_gettime() system calls. 2013-04-04 15:04:53 +02:00
getuptime.c libc: add clock_getres()/clock_gettime() system calls. 2013-04-04 15:04:53 +02:00
kernel_call.c SYSENTER/SYSCALL support 2012-09-24 15:53:43 +02:00
kprintf.c panic() cleanup. 2010-03-05 15:05:11 +00:00
kputc.c Kernel: make SIGKMESS target process list dynamic 2014-03-01 09:04:54 +01:00
kputs.c intercept puts() in libsys, for gcc 2010-04-23 20:23:33 +00:00
Makefile Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
mapdriver.c Clean up interface to PM and VFS 2014-03-01 09:05:01 +01:00
optset.c Getting rid of "old-style-definition" 2014-07-28 17:05:09 +02:00
panic.c libsys: panic hook feature 2013-05-07 17:18:40 +00:00
pci.h Incorporate bsdmake into buildsystem and reorganize libs 2010-02-16 14:41:33 +00:00
pci_attr_r8.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
pci_attr_r16.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
pci_attr_r32.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
pci_attr_w8.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
pci_attr_w16.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
pci_attr_w32.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
pci_del_acl.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
pci_dev_name.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
pci_find_dev.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
pci_first_dev.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
pci_get_bar.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
pci_ids.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
pci_init.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
pci_next_dev.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
pci_rescan_bus.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
pci_reserve.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
pci_set_acl.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
pci_slot_name.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
safecopies.c make vfs & filesystems use failable copying 2014-07-28 17:05:14 +02:00
sched_start.c libsys: various updates 2014-03-01 09:05:00 +01:00
sched_stop.c libsys: various updates 2014-03-01 09:05:00 +01:00
sef.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
sef_gcov.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sef_init.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
sef_liveupdate.c Getting rid of "old-style-definition" 2014-07-28 17:05:09 +02:00
sef_ping.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
sef_signal.c Changing the message union to anonymous. 2014-03-03 20:46:47 +01:00
shlib_version Adding shlib_version for libsys 2012-11-15 16:07:29 +01:00
sqrt_approx.c introduce sqrt_approx() in -lsys 2011-07-04 02:51:12 +02:00
srv_fork.c Clean up interface to PM and VFS 2014-03-01 09:05:01 +01:00
srv_kill.c Clean up interface to PM and VFS 2014-03-01 09:05:01 +01:00
stacktrace.c libsys: remove unused stacktrace variant 2012-08-09 00:16:35 +02:00
sys_abort.c Remove ability to pass commands to bootloader 2012-11-22 19:16:17 +01:00
sys_clear.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_cprof.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_diagctl.c Kernel: make SIGKMESS target process list dynamic 2014-03-01 09:04:54 +01:00
sys_endsig.c Removing SYS_SIG_* field macros. 2014-03-03 20:47:00 +01:00
sys_exec.c Removing CSU patches 2014-02-18 11:25:02 +01:00
sys_exit.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_fork.c No more intel/minix segments. 2012-07-15 22:30:15 +02:00
sys_getinfo.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_getsig.c Removing SYS_SIG_* field macros. 2014-03-03 20:47:00 +01:00
sys_hz.c Replaced common u64.h functions with operators. 2014-03-02 12:28:32 +01:00
sys_irqctl.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_kill.c Removing SYS_SIG_* field macros. 2014-03-03 20:47:00 +01:00
sys_mcontext.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_memset.c further libexec generalization 2012-06-07 15:15:02 +02:00
sys_padconf.c kernel: add padconf kernel call 2013-08-28 12:53:05 -04:00
sys_physcopy.c make vfs & filesystems use failable copying 2014-07-28 17:05:14 +02:00
sys_privctl.c Incorporate bsdmake into buildsystem and reorganize libs 2010-02-16 14:41:33 +00:00
sys_profbuf.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_runctl.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_safecopy.c make vfs & filesystems use failable copying 2014-07-28 17:05:14 +02:00
sys_safememset.c libsys: add sys_safememset() 2012-09-26 02:18:00 +02:00
sys_schedctl.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_schedule.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_setalarm.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_setgrant.c Incorporate bsdmake into buildsystem and reorganize libs 2010-02-16 14:41:33 +00:00
sys_settime.c Extending time_t to 64bits. 2014-03-03 20:45:28 +01:00
sys_sigreturn.c Removing SYS_SIG_* field macros. 2014-03-03 20:47:00 +01:00
sys_sigsend.c Removing SYS_SIG_* field macros. 2014-03-03 20:47:00 +01:00
sys_sprof.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_statectl.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_stime.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_times.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_trace.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_umap.c drop from segments physcopy/vircopy invocations 2012-06-18 12:28:40 +00:00
sys_update.c New RS and new signal handling for system processes. 2010-03-17 01:15:29 +00:00
sys_vircopy.c make vfs & filesystems use failable copying 2014-07-28 17:05:14 +02:00
sys_vmctl.c Rename sys_vmctl_get_cr3_i386 2012-08-12 23:30:54 +02:00
sys_vsafecopy.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_vtimer.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
sys_vumap.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
syslib.h Incorporate bsdmake into buildsystem and reorganize libs 2010-02-16 14:41:33 +00:00
sysutil.h Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
taskcall.c Adding ipc_ prefix to ipc primitives 2014-03-01 09:05:01 +01:00
tickdelay.c Replacing timer_t by netbsd's timer_t 2014-03-01 09:04:54 +01:00
timers.c Replacing timer_t by netbsd's timer_t 2014-03-01 09:04:54 +01:00
vm_cache.c Synchronize on NetBSD-CVS (2013/12/1 12:00:00 UTC) 2014-07-28 17:05:06 +02:00
vm_exit.c libsys: various updates 2014-03-01 09:05:00 +01:00
vm_fork.c libsys: various updates 2014-03-01 09:05:00 +01:00
vm_info.c libsys: various updates 2014-03-01 09:05:00 +01:00
vm_map_phys.c libsys: various updates 2014-03-01 09:05:00 +01:00
vm_memctl.c libsys: various updates 2014-03-01 09:05:00 +01:00
vm_notify_sig.c libsys: various updates 2014-03-01 09:05:00 +01:00
vm_procctl.c make vfs & filesystems use failable copying 2014-07-28 17:05:14 +02:00
vm_query_exit.c libsys: various updates 2014-03-01 09:05:00 +01:00
vm_set_priv.c libsys: various updates 2014-03-01 09:05:00 +01:00
vm_update.c libsys: various updates 2014-03-01 09:05:00 +01:00