minix/kernel/system
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
..
do_abort.c Remove ability to pass commands to bootloader 2012-11-22 19:16:17 +01:00
do_clear.c Replacing timer_t by netbsd's timer_t 2014-03-01 09:04:54 +01:00
do_copy.c make vfs & filesystems use failable copying 2014-07-28 17:05:14 +02:00
do_cprofile.c profiling related cleanup 2012-07-15 21:56:55 +02:00
do_devio.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
do_diagctl.c Kernel: make SIGKMESS target process list dynamic 2014-03-01 09:04:54 +01:00
do_endksig.c Removing SYS_SIG_* field macros. 2014-03-03 20:47:00 +01:00
do_exec.c Removing CSU patches 2014-02-18 11:25:02 +01:00
do_exit.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
do_fork.c kernel: spelling fixes 2013-10-09 20:24:17 -04:00
do_getinfo.c Replaced add64, add64u and add64ul with operators. 2013-11-13 13:11:33 +00:00
do_getksig.c Removing SYS_SIG_* field macros. 2014-03-03 20:47:00 +01:00
do_irqctl.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
do_kill.c Removing SYS_SIG_* field macros. 2014-03-03 20:47:00 +01:00
do_mcontext.c <machine/mcontext.h> 2014-03-03 20:47:03 +01:00
do_memset.c kernel: handle pagefaults in vm_memset() 2012-09-26 02:17:59 +02:00
do_privctl.c Kernel: make SIGKMESS target process list dynamic 2014-03-01 09:04:54 +01:00
do_profbuf.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
do_runctl.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
do_safecopy.c make vfs & filesystems use failable copying 2014-07-28 17:05:14 +02:00
do_safememset.c make vfs & filesystems use failable copying 2014-07-28 17:05:14 +02:00
do_schedctl.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
do_schedule.c Kernel: use okendpt() to resolve stored endpoints 2012-08-15 08:50:30 +00:00
do_setalarm.c Replacing timer_t by netbsd's timer_t 2014-03-01 09:04:54 +01:00
do_setgrant.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
do_settime.c Extending time_t to 64bits. 2014-03-03 20:45:28 +01:00
do_sigreturn.c <machine/signal.h> 2014-03-03 20:47:07 +01:00
do_sigsend.c Kernel: fix register corruption on signal delivery 2014-03-03 20:47:07 +01:00
do_sprofile.c Libraries updates and cleanup 2013-01-14 11:36:26 +01:00
do_statectl.c retire PUBLIC, PRIVATE and FORWARD 2012-03-25 21:58:14 +02:00
do_stime.c Extending time_t to 64bits. 2014-03-03 20:45:28 +01:00
do_times.c Extending time_t to 64bits. 2014-03-03 20:45:28 +01:00
do_trace.c kernel:enable trace on arm. 2013-02-17 08:40:38 +01:00
do_umap.c drop from segments physcopy/vircopy invocations 2012-06-18 12:28:40 +00:00
do_umap_remote.c make vfs & filesystems use failable copying 2014-07-28 17:05:14 +02:00
do_update.c Kernel: make SIGKMESS target process list dynamic 2014-03-01 09:04:54 +01:00
do_vdevio.c kernel: spelling fixes 2013-10-09 20:24:17 -04:00
do_vmctl.c drop safemap code 2012-10-30 13:55:42 +01:00
do_vtimer.c Alignement on netbsd types, part 1 2014-02-18 11:25:01 +01:00
do_vumap.c make vfs & filesystems use failable copying 2014-07-28 17:05:14 +02:00
Makefile.inc Remove support for MKTRACE, MKMCONTEXT, MKSTATECTL 2014-03-01 09:04:59 +01:00